Can’t Clean a Full /boot Because of Unmet Dependencies

By | March 9, 2017

Use the dpkg tool to force the removal of some kernel packages. This is not suggested for common use and is a bit dangerous, but in such case with unmet dependencies might help.

First of all, locate the kernel in which the system is booted. The one that is currently loaded. Open a terminal (CTRL+ALT+T) and issue the following command

uname -r

It will show you the loaded kernel; you should NOT try to remove this one.

Then issue the command

ls /boot

It will return all the installed images. Pick one or two and try to remove them. Try to force remove/purge them. For example

sudo dpkg --force-all -P linux-image-3.13.0-32-generic

You can do the same for other images, to free up some space.

Then you can try to install the missing packages, or

sudo apt-get install -f

to try to resolve the dependencies.

Finally, issue the “clean up old kernels” command

 sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Above command will remove ALL the kernels except the one that is currently loaded.

Because you have a separate /boot partition, keep in mind you will need to track its space and cleaning up often (the frequency depends on the space of /boot)

Original Source:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.