Clean up /boot partition

NOTE: this is only if you can’t use apt to clean up due to a 100% full /boot

If apt-get isn’t functioning because your /boot is at 100%, you’ll need to clean out /boot first. This likely has caught a kernel upgrade in a partial install which means apt has pretty much froze up entirely and will keep telling you to run apt-get -f install even though that command keeps failing.

Get the list of kernel images and determine what you can do without sudo dpkg --list 'linux-image*' The one current running kernel versiot can be found with uname -r. Note the two newest versions in the list and the one in use.

Craft a command to delete all files in /boot for kernels that don’t matter to you using brace expansion to keep you sane. Remember to exclude the current and two newest kernel images. Example: sudo rm -rf /boot/*-3.2.0-{23,45,49,51,52,53,54,55}-*.

sudo apt-get -f install to clean up what’s making apt grumpy about a partial install.

If you run into an error that includes a line like “Internal Error: Could not find image (/boot/vmlinuz-3.2.0-56-generic)”, then run the command sudo apt-get purge linux-image-3.2.0-56-generic (with your appropriate version).

Finally, sudo apt-get autoremove to clear out the old kernel image packages that have been orphaned by the manual boot clean.

Suggestion, run sudo apt-get update and sudo apt-get upgrade to take care of any upgrades that may have backed up while waiting for you to discover the full /boot partition.

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