I have 200 MB assigned for the /boot partition. Whenever I try to update the kernel, I receive an error message that basically states /boot is full.
What can I do to cleanup /boot and remove/backup the older kernels?
|
I have 200 MB assigned for the What can I do to cleanup |
|||||
|
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.
Example:
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 Finally, Suggestion, run 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. |
|||||||||||||||||||||
|
|
There is documentation about this at https://help.ubuntu.com/community/RemoveOldKernels In summary: Use
The
If you want a copy-paste solution, ReSearchIT Eng suggested the following:
|
|||||||||||||||||
|
|
I found that it is far easier to abandon the small partition and move First move your data from the boot partition to root (run as
Remove (or comment) the
Update grub and make sure everything is correct:
This leaves an unused 200mb partition (which you could use for something else if you find it worth the trouble). |
|||||
|
|
Removing old Kernels (to free space on /boot) see: http://askubuntu.com/questions/89710/how-do-i-free-up-more-space-in-boot
Then run
|
|||||
|
|
This removes all but last 2 kernels. Tested on Ubuntu 16.04 LTS when |
|||
|
|
|
Why do it by hand when you can do it with a tool? You know you're going to need it again in 30 seconds, because it takes 30 seconds for them to push a new kernal update these days =P I recommend using this tool, bootnukem
Then
Remove |
||||
|
|
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 (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?