Since several years my preferred working environment is Ubuntu in combination with the i3 window manager. Both are speeding up my development workflow and increase my productivity. I am not gonna lie, the i3 learning curve was steep at the beginning and I had to read and configure a lot (If you are interested in my configuration, have a look at my dotfiles repository). In this post I want to address one issue which occurred some time after I set up i3.
At some point I tried to manually upgrade my system and therefore executed the following command:
$ sudo apt-get update && sudo apt-get upgrade
The upgrade stopped immediatelly and the following error message was shown on the command line:
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
My boot partition seemed to be full. After some investigation I found out that Ubuntu made automatic kernel updates without fully deleting the old kernels. And those old versions filled up the partition. On an GUI-based Ubuntu this wouldn’t have happened as the update manager would have taken care of it.
Delete old kernels
To fix this issue you have to delete the old kernels. First navigated to the boot folder:
cd /boot
By listing the directory contents (ls
) you will see all kernel versions (e.g. 5.4.0-26-generic
). Check your current version and remember the output:
uname -a
Trigger an automated removing of the old kernels:
sudo apt-get autoremove
After the command has finished, list the directory contents again and ensure that only your current version (the outcome of uname -a
) is left. If not, manually remove the remaining kernels.
Disable automatic updates from command line
The next step is to disable the automatic updates, so that this issue won’t occur again. To do this via the command line you have to adjust the /etc/apt/apt.conf.d/20auto-upgrades
file:
$ sudo vim /etc/apt/apt.conf.d/20auto-upgrades
Change Update-Package-Lists
from 1
to 0
. The file should contain the following content afterwards:
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "1";
Disable automatic updates from GUI
To achieve the same using the GUI, open the activities and use the search to open Software & Updates
:
Go to the Updates
tab and set Automatically check for updates
to Never
:
Make sure to manually update/upgrade your system regularly after those configurations.