First Aid Kit for Upgrading Debian
On one of my workstations, I use Debian Sid. It is a rolling-release distribution, which means that it’s always up-to-date with the latest software. However, it can be unstable. I don’t mind that, because I prefer to have the latest compilers around, and I can deal with the occasional breakage. I put together a list of recipes that I use to fix the most common problems encountered during an upgrade.

Upgrade procedure
Sometimes I am interested just in upgrading my kernel, but most of the time I want to upgrade the whole system. Here’s how I do it:
System upgrade
- Fetch the latest package information from the repositories. Updating should always be performed before upgrading.
1
sudo apt update
- Upgrade the packages that can be safely upgraded without removing any other packages. Replacing
upgradewithfull-upgrademay remove some packages or install new ones to satisfy dependency changes. Make sure to review the list of changes before proceeding with the upgrade.1
sudo apt upgrade
- Remove packages that are no longer needed. Although an optional step, it is a good idea to keep the system clean.
1
sudo apt autoremove
Kernel upgrade
- Update package information.
1
sudo apt update
- Check the available kernel versions.
1
apt-cache search linux-image-amd64
- Install the desired kernel version. It’s recommended to install the corresponding kernel headers as well.
If you stumble upon a meta-package, feel free to install it instead. A meta-package
is a convenient way to bulk-install groups of applications, their libraries and documentation.
1
2sudo apt install linux-image-<kernel_version>-amd64
sudo apt install linux-headers-<kernel_version>-amd64 - Reboot the system to use the new kernel. Don’t remove the old one until you try it out.
1
sudo reboot
- Check your kernel version.
1
uname -r
Common problems
Broken packages
When you encounter a broken package, something along the lines of E: Sub-process /usr/bin/dpkg returned an error code,
it could mean that the package is corrupted, or that it depends on another package that is not installed. Here are two
of the things I usually try in order to fix the problem.
- Reconfigure the affected package.
1
sudo dpkg --configure <package_name>
- Fix broken dependencies. This will attempt to fix broken dependencies and finish any interrupted package installation
or removal.
1
sudo apt --fix-broken install
Missing display manager
Sometimes, you might end up with a system that starts in TTY mode, unable to get back your graphical interface.
- Check if there are any available display managers installed on your system.
1
systemctl list-units --type=service | grep -E 'gdm|lightdm|sddm'
- If there is one, start it. Also, enable it to start at boot.
1
2sudo systemctl start <display_manager>
sudo systemctl enable <display_manager> - If there is none, install one. I prefer LightDM, but feel free to choose whatever suits you.
After installation, make sure it is your default display manager. The file
/etc/X11/default-display-managershould contain the path/usr/sbin/lightdm(or the path of your preferred display manager).1
sudo apt install lightdm
- Reboot the system.
1
sudo reboot
Missing desktop environment
- If your desktop environment is gone, install one. I prefer xfce4, but the steps should be very similar, regardless of what you choose to install.
1
2sudo apt update
sudo apt install xfce4 - Your display manager should allow you to select the desktop environment you want to use. If it doesn’t, you can set it manually by adding
the following line to
~/.xinitrc. If you use another desktop environment, replacestartxfce4with the command that launches it.1
exec startxfce4
- Use the following command to launch the desktop environment manually.
1
startx
Related problems
- Sometimes, in order for your desktop environment to work, you have to install missing software. For example,
when trying to start Xfce for the first time, I got the following error message:
Failed to execute child process “dbus-launch”. To resolve this issue, I had to install thedbus-x11package.1
sudo apt install dbus-x11
- The login screen got stuck after entering my username and password. I had to switch to a TTY (
Ctrl+Alt+F1… up toF6), and remove theXauthorityfile, which turned out to have the wrong file permissions. After that, I was able to log in normally.1
rm ~/.Xauthority
- If you’re stuck, open a TTY and check the logs. Use
lessto navigate the log files, as they may be very long.:qcloses the file,:Gtakes you to the end of it, and/<pattern>is used for searching./var/log/Xorg.0.logfor Xorg related issues/var/log/syslogfor system-related issues/var/log/auth.logfor authentication-related issues
No internet
- Check the status of your network interfaces. Look for a network interface that is marked UP.
1
ip addr show
- If all interfaces are DOWN, pick the one you want to bring back up. Common names for wired connections start with
ethorenp. For wireless, they start withwl. I find ethernet easier to set up in such situations, but for that make sure your ethernet cable is plugged in. Replace<interface>with the name of the chosen network interface.1
sudo ip link set <interface> up
- Configure the network interface.
1
sudo dhclient <interface>
- In order to make changes persistent across reboots, add the following line to
/etc/network/interfaces.1
2auto <interface>
iface <interface> inet dhcp - Restart networking services.
1
sudo systemctl restart networking
- Test it.
8.8.8.8is the primary DNS server for Google DNS.1
ping 8.8.8.8
Missing firmware
- Often enough, the system might be unable to find the necessary firmware, especially for Realtek network cards. In this particular case,
the following fixed it for me.
1
sudo apt install firmware-iwlwifi
- Be aware that such packages usually come from non-free repositories, which you might have to enable in your
/etc/apt/sources.list.
Other problems
Incompatible modules when upgrading the kernel
When upgrading to 6.1.0-7-amd64, I encountered a problem with the aufs module. It was the default
storage driver used for managing images and layers on Docker. The module included a BUILD_EXCLUSIVE directive which
did not match my new kernel/arch/config. Docker recommends
migrating to the overlay2 storage driver. Here’s how I did it:
- Stop the Docker service.
1
sudo systemctl stop docker
- Make sure the
aufsmodule is not in use. Unload it using the following command:1
sudo rmmod aufs
- Remove related packages.
1
sudo apt remove aufs-dkms aufs-tools
- Switch to OverlayFS by editing the
/etc/docker/daemon.jsonfile. Add the following line:1
2
3{
"storage-driver": "overlay2"
} - Start the Docker service.
1
sudo systemctl start docker
Closing thoughts
Never be afraid of upgrading your system. Breakages happen, and they’re not the end of the world. It’s not your fault, and it’s not the fault of the developers. It’s just a part of the process. Eventually, as the world moves on, an upgrade is unavoidable. The important thing is to learn from the experience.