Determine Fastest Mirror

netselect-apt can do this:

netselect-apt -n -s

will benchmark Debian mirrors and generate sources.list containing the fastest stable mirror, including non-free packages and source packages. This file can then overwrite /etc/apt/sources.list to become the default source for Debian packages.

Extract Package

First use ar:

ar vx *.deb

which will generate the following files:

x - debian-binary
x - control.tar.gz
x - data.tar.lzma

lzma may be gz, in which case, use tar -xpvf data.tar.gz to proceed further. Otherwise, in case it is compressed using lzma:

tar --lzma -xpvf file.tar.lama

Hold Package

Useful, for example, while manually recompiling a source package:

aptitude [hold|unhold] package

in order to avoid it being overwritten by a binary package.

Recompile Kernel

In order to do this the Debian way, download the source and configure the kernel. The current kernel source for the installed Debian distribution can be fetched with:

aptitude install linux-source kernel-package

along with kernel-package which gives us the tools to compile the kernel.

which will download the current kernel source and place it in /usr/src/linux-source-*.tar.bz2 depending on the version of the kernel. The next step is to unarchive the source:

cd /usr/src/
tar -jxpvf linux-source-*.tar.bz2

To configure the kernel for compilation, first copy the current kernel configuration from /boot/config-* depending on the version of the kernel to /usr/src/linux-source-*. This will give you the basis from which to start:

cp /boot/config-* /usr/src/linux-source-*/.config

then we change the directory to /usr/src/linux-source-* and use make menuconfig:

cd /usr/src/linux-source-*
make menuconfig

After configuring, we issue:

make-kpkg --initrd kernel_image

which places the deb files in the immediately superior directory. To install the image, issue:

cd ..
dpkg -i linux-image-2.6.32.Custom_amd64.deb

depending what version of the kernel has been compiled.

Determine What Package a File Belongs To

For example, to determine what Debian package /etc/samba/smb.conf belongs to, issue:

dpkg -S /etc/samba/smb.conf

CPAN Modules as Debian Packages

First install dh-make-perl and update apt-file:

aptitude install dh-make-perl
apt-file update

Then install packages with:

dh-make-perl --build --cpan Desired::CPAN::Module

Repair Filesystem on Boot

Filesystem repairs on boot can hang the machine if the filesystem was not cleanly unmounted. By editing /etc/default/rcS and setting:

# automatically repair filesystems with inconsistencies during boot

will allow the server to automatically repair the filesystem on boot.

Install Packages from Different Debian Release

In order to install packages from other releases, first add the repository to /etc/apt/sources:

deb squeeze main
deb-src squeeze main

Then edit /etc/apt/apt.conf and set the default release to stable:

APT::Default-release "stable";

Now, to install the package libace-dev from squeeze, the syntax is:

aptitude install libace-dev/squeeze

Install From Backports

Backports are useful when you want a new package from the unstable branch. A good use for them is for example a newer kernel that supports features you may need. The procedure consists in:

  • Editing /etc/apt/sources.list in order to add:
deb wheezy-backports main
  • Running aptitude update to pick-up the changes.
  • Finally, in order to install a package from backports, issue:
aptitude -t wheezy-backports install linux-image-amd64

Boot ISO with Grub

grub can boot an ISO file using the grml-rescueboot package. First install the grml-rescueboot package:

aptitude install grml-rescueboot

and then place the ISO file in /boot/grml/:

cp rescue.iso /boot/grml

Finally update grub using the update-grub command:


Once the system restarts you will have a new option to boot from the ISO file.

Install Extra Netfilter Modules

aptitude install module-assistant xtables-addons-source
module-assistant prepare
module-assistant auto-install xtables-addons-source
depmod -a

Change the Time Zone

To change the time-zone, the Debian way, issue:

dpkg-reconfigure tzdata

List All Packages Not Installed Automatically

The following command will list all packages that were not installed automatically (for example, as a dependency of some other package):

aptitude search ~i | grep -v "i A" | cut -d " " -f 4

Enable Periodic TRIM for SSDs

As root, execute:

cp /usr/share/doc/util-linux/examples/fstrim.{service,timer} /etc/systemd/system
systemctl enable fstrim.timer

which will schedule a TRIM operation on all SSDs every week.

Enable IPX Networking

To enable IPX networking in Debian you should first follow the tutorial on installing unstable packages because the ipx package providing the ipx_interface command is (at the time of writing) available in the oldstable branch of Debian.

Next, to set-up the network, edit the configuration file /etc/network/interfaces. In that file you will find your LAN interface (either a bridge or an ethernet device), or the interface you want to enable IPX on. For example:

# The primary network interface
auto br0
iface br0 inet static
        bridge_ports eth0
        bridge_stp off
        bridge_maxwait 0
        bridge_fd 0

After that you can add the IPX network:

iface br0 ipx static
        frame 802.2
        netnum AABBCCDD

where AABBCCDD is the IPX network number represented in hex (excluding 00000000 and FFFFFFFF which are reserved).

An interesting idea would be to set the network number by transforming the TCP/IP address into hexadecimal, for example for we would replace AABBCCDD with C0A80101.

Enable Debian HTTPs Support for Repositories

In case you are trying to install packages from HTTPs repositories, you may encounter the error message:

E: The method driver /usr/lib/apt/methods/https could not be found.

In order to resolve the issues, the following packages can be installed:

aptitude install apt-transport-https ca-certificates

such that Debian will accept package repositories that have to be fetched through HTTPs.

Add Modules to InitD

To add modules to be loaded by initd, install initramfs-tools:

aptitude install initramfs-tools

and then edit /etc/initramfs-tools/modules and add the module name to the list.

Finally, issue:

update-initramfs -k all -u

to update the initrd image.

Regenerate Snakeoil Certificates

On Debian, the default snakeoil certificates at /etc/ssl/certs/ssl-cert-snakeoil* can be regenerated with the command:

make-ssl-cert generate-default-snakeoil --force-overwrite

Ignoring Missing Library Information when Compiling Packages

When compiling packages on Debian that use libraries that are not managed by the Debian package system the following error may appear at the end of the build process: dpkg-shlibdeps: error: no dependency information found followed by the library you are compiling against.

In order to ignore missing library information, add the following snippet:

    dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

to rules/debian.

Note that the spaces before dh_shlibdeps is actually a tab!

Additionally, you can issue:

export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info

before compiling.

Required Packages for Intel Compiler

If you want to install the Intel Compiler (icc) on Debian, the 32-bit version libraries are required. To install them, issue:

dpkg --add-architecture i386
aptitude update
aptitude install gcc-multilib libstdc++6:i386 libgcc1:i386

Reload LUKS Encrypted Drives Without Restarting

After editing /etc/crypttab, issue:

systemctl daemon-reload
systemctl restart

followed by:

mount -a

to remount all encrypted drives.

Generate MD5 Sums for Package

The following line, when executed inside a package directory tree, will generate the DEBIAN/md5sums file.

md5sum $(find * -type f -not -path 'DEBIAN/*') >DEBIAN/md5sums

Reinstall Package and All Dependencies

The following command will reinstall a package along with all its dependencies and additionally create any new configuration files:

apt-cache depends PACKAGE | grep '[ |]Depends: [^<]' | cut -d: -f2 | tr -d ' ' | xargs apt install --reinstall  -o Dpkg::Options::="--force-confask,confnew,confmiss" -y


  • PACKAGE is a debian package.

Execute Java Program under Different JDK Version

Execute the command:

update-java-alternatives -l

to list the available JDKs.


update-java-alternatives -s java-1.8.0-openjdk-amd64


  • java-1.8.0-openjdk-amd64 - is the java JDK obtained from the previous command.

to set the java JDK version to be used.

Recompile Debian Kernel

Summarizing, either use apt to fetch the source code, ie:

apt-get source linux-image-4.19.0-8-amd64

or download the kernel source code manually from

Since Debian does not define the kernel compilation parameter to include the current kernel configuration in memory under /proc/config.gz but stores the configuration under /boot, the configuration can be copied into the current kernel source directory:

cp /boot/config-4.19.0-8-amd64 .config

In case a different kernel version is to be compiled compared to the current kernel configuration, the following command:

make olddefconfig

should accept the default for the current kernel version.

If compiling under Debian, the current configuration .config has to be edited and CONFIG_SYSTEM_TRUSTED_KEYS set to the empty string:


in order to avoid a compilation error:

No rule to make target 'debian/certs/debian-uefi-certs.pem', needed by 'certs/x509_certificate_list'.  Stop.

Additionally, since Debian builds the debug packages of the kernel by default which takes a long while and uses up a lot of disk resources, the kernel configuration in .config can be edit and the parameter CONFIG_DEBUG_INFO adjusted to n to skip building the debug packages:


The usual pair of commands, either nconfig:

make nconfig

or makeconfig can be issued in order to make any changes to the copied configuration:

make menuconfig

Finally, issue:

make deb-pkg LOCALVERSION=-custom


  • -custom is a build name appended to the kernel package that will be built.

Persisting Network Hardware Settings

When installing ethtool on Debian, a script is placed at /etc/network/if-up.d/ethtool that, once an interface is brought up, runs through all the settings for all interfaces and makes changes to the hardware driver via ethtool.

The proper way to persist settings in Debian, for instance, to enable checksum offloading, is to make the settings in the interfaces file but without using an up or post-up script.

For instance, the following settings will bring up the interface eth0 via DHCP and then enable TSO on the interface:

auto eth0
iface eth0 inet dhcp
    offload-tx on
    offload-sg on
    offload-tso on

Disable nftables and Continue Using Legacy iptables

update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
update-alternatives --set arptables /usr/sbin/arptables-legacy
update-alternatives --set ebtables /usr/sbin/ebtables-legacy

Fix Issues on Release Change

When a repository changes its release data the following error should appear when updating packages:

This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details

the solution is to run apt as:

apt-get update --allow-releaseinfo-change

with the extra --allow-releaseinfo-change.

fuss/debian.txt ยท Last modified: 2022/04/19 09:28 (external edit)

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key

For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy, copyright and the plagiarism pages.