Skip to content

Instantly share code, notes, and snippets.

@dasegn
Created September 11, 2017 17:20
Show Gist options
  • Save dasegn/e5c9f096df69eeadcd4af12ec86d09b3 to your computer and use it in GitHub Desktop.
Save dasegn/e5c9f096df69eeadcd4af12ec86d09b3 to your computer and use it in GitHub Desktop.
Boot partition full in Ubuntu Linux
#!/bin/sh
# This line check the actual kernels in /boot partition
dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`
# If apt-get refuse to update or purge old kernels do the next
sudo rm -rf /boot/*-3.2.0-{23,45,49,51,52,53,54,55}-*
# Obviously the last line is an example, be careful to check the kernels to delete
# After the delete, execute apt-get install with "force" parameter
sudo apt-get -f install
# If you get the "Could not find the image" purge the kernel image
sudo apt-get purge linux-image-3.2.0-56-generic
# Execute autoremove to purge the old kernels files
sudo apt-get autoremove
# Finally is recommended execute update and upgrade to be ready for upgrades that may backed up while you discover the /boot partition
sudo apt-get update
sudo apt-get upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment