Skip to content

Instantly share code, notes, and snippets.

@claudiobizzotto
Created May 22, 2018 21:56
Show Gist options
  • Save claudiobizzotto/d9944668ccd3779206397ea974237309 to your computer and use it in GitHub Desktop.
Save claudiobizzotto/d9944668ccd3779206397ea974237309 to your computer and use it in GitHub Desktop.
Linux clean up /boot - remove old kernels

Linux clean up /boot - remove old kernels

Easiest and safest

sudo apt-get autoremove --purge

This command will usually keep the last 3 kernels in the partition, which is good in case anything goes wrong with the current kernel.

If Linux is still complaining that the boot partition is running out of space, try the option below.

Harder, but still safe

Get only the kernels (and depencies) that are not currently being used:

dpkg --list "linux-image*" | grep -v ^ii

Delete them one by one. Example:

sudo apt-get purge linux-image-4.10.0-28-generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment