Last active
September 29, 2017 17:06
-
-
Save wickchucked/44c25883685f0c6bb30c to your computer and use it in GitHub Desktop.
Clean up boot partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://askubuntu.com/questions/345588/what-is-the-safest-way-to-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. This command will show installed kernels except the currently running one sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`. Note the two newest versions in the list. You don't need to worry about the running one as it isn't listed here. You can check that with uname -r. | |
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}-*. You can also use a range with the syntax {80..84}. | |
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. | |
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. | |
shareimprove this answer | |
edited Oct 12 at 14:55 | |
answered Mar 7 '14 at 16:54 | |
flickerfly | |
1,88711226 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment