Navegación de entradas

Clearing Out /boot

The /boot partition sometimes needs a bit of attention. If you enable
automatic updates, it will fill up with old kernels that you'll probably
never need. It also will stop you from running aptitude to install or remove
anything. If you find yourself in this situation, you can use
dpkg to get
around it. dpkg is the higher-level package manager in Debian-based
distributions, and it's very useful when aptitude has broken.

If you look in the directory /boot you will see it full of old kernels and
images. it is not advisable to just delete them as you can break your system.
Run the following command, this will tell you what kernel you are currently
on: uname -r:

3.13.0-137-generic

Lets find out what kernels are installed and which ones can be purged from
your system. To do this, run the following:

dpkg --list "linux-image*" | grep -v $(uname) | grep ii

This will use dpkg to list all linux kernel images excluding the one you are
using, that is installed.

The output might still be quite big, let's refine it by piping the results in
to awk. The awk command below is an instruction to print the second column
from the output.

This gives us a list to work with. We can stick this in a script or run it
from the command line to purge them all.

CAUTION: make sure that the kernel you are using is not in the list. We
should have eliminated that when we specified grep -v $(uname
-r). The -v
part tell grep exclude anything that contains the output of uname -r.

To finish off run sudo update-grub2 - This will ensure grub is updated with
the available kernels - otherwise you may be heading for trouble. Then fix
aptitude by running: sudo apt-get -f install followed by sudo apt-get
autoremove to clear the images out of aptitude.