Clean up boot partition in Ubuntu server

Sometimes you forget to clean up the old kernels and your boot partition full. That may cause you trouble when upgrading new kernel. Here is how you can clean up the boot partition when apt-get keeps telling you to "-f install" (that command keeps failing):

1. Check your current installed kernels:

The running one:

$ uname -r

All kernels instlled:

$ sudo dpkg --list 'linux-image*'

Note the two newest versions in the list and the one in use (for example 68, 69, 70).

2. Remove the unused kernels (remember to exclude the current and two newest kernel images), for example:

$ sudo rm -rf /boot/*-3.2.0-{23,45,49,51,52,53,54,55}-*

3. Run 'sudo apt-get -f install' to fix the partial install

4. Finally, run 'sudo apt-get autoremove' to clear out the old kernel image packages.

Note: to see available space on the boot partition:

$ sudo df -h

Reference: http://askubuntu.com/questions/345588/what-is-the-safest-way-to-clean-up-boot-partition

Comments