🔍 See Original Answer on Ask Ubuntu 🔗
Need to free up space in boot for update, but can't purge kernels due to unmet dependencies
July 30, 2017
Edited: June 12, 2020
November 24, 2022
Copy to clipboard: false
Why do I have to install something when I want to delete images?
You don’t have to install something. It won’t let you delete the images unless you delete the ones that depend on them at the same time. For example you need to use:
$ sudo apt-get purge linux-headers-4.4.33-040433* linux-headers-4.4.33-040433-generic* linux-image-4.4.33-040433-generic* The following packages will be REMOVED: linux-headers-4.4.33-040433* linux-headers-4.4.33-040433-generic* linux-image-4.4.33-040433-generic*
To avoid this manual work try my bash script which automates the process. Yes it may be a shameless plug but I spent many hours in development and fine-tuning so would like to see as many use it as possible.
Do I also have to delete the files with linux-headers-* and linux-signed-image-*?
Yes as answered in the previous section.
Shouldn’t Ubuntu handle the deletion of not needed kernels automatically or what is the reason I have to do it manually?
Ubuntu does remove kernels automatically that it installed automatically when you use:
sudo apt-get autoremove
If you manually installed a kernel using a technique like this: How do I update kernel to the latest mainline version? then you have to manually remove the kernel as well.
I have to encrypt my hard drive. Could this be the reason?
No. But I wouldn’t encrypt my hard drive.