I've got 200 MB assigned for the
/boot partition. Everytime I try to update the kernel I get an error message that basically says the size of
/boot is full.
What can I do to cleanup
/boot and remote/backup the older kernels?
Command line method:
First check your kernel version, so you won't delete the in-use kernel image, running:
Now run this command for a list of installed kernels:
and delete the kernels you don't want/need anymore by running this:
Replace VERSION with the version of the kernel you want to remove.
When you're done removing the older kernels, you can run this to remove ever packages you won't need anymore:
And finally you can run this to update grub kernel list:
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
Get the list of kernel images and determine what you can do without. This command will show installed kernels except the currently running one
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.
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
Suggestion2, Review https://help.ubuntu.com/community/AutomaticSecurityUpdates and consider setting Unattended-Upgrade::Remove-Unused-Dependencies to true in /etc/apt/apt.conf.d/50unattended-upgrades. This will be the equivalent of running autoremove after each security updates to be sure you clean out unused kernels but will also remove other things it thinks are unused saving you from this problem in the future.
This one-liner from http://ubuntuforums.org/showthread.php?t=1435818 did the trick for me
However, this only worked once! The second time I ran it, my computer no longer had a kernel (see comment below). Be careful with this command as I spent about 10 hours figuring out what happened and then replacing the kernel.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?