Dist upgrade ->17.10 pre-step helpful hint

Having been bitten by a limited /boot partition running out of space when dist-upgrading to 17.10 - it is helpful to remove dated and unused linux-header image and extra packages, either before the upgrade, or periodically, as these all get re-built onto /boot as part of the disposal of old packages during the upgrade.

for upg in  20 22 24 26 28
do  
  sudo dpkg -r --purge linux-headers-4.10.0-${upg} linux-headers-4.10.0-${upg}-generic linux-image-4.10.0-${upg}-generic linux-image-extra-4.10.0-${upg}-generic 
done
3 Likes

If you didn’t install any kernel manually the option autoremove from apt should do the trick:

$ sudo apt-get autoremove --purge

2 Likes

There’s also the sudo purge-old-kernels option if you have Byobu installed. Works fairly well in my tests :slight_smile:

http://blog.dustinkirkland.com/2016/06/purge-old-kernels.html

I’ve heard that fixing automatic removal of old kernels would be properly tackled in the near future (doesn’t work in some corner cases); unfortunately I can’t remember a source.

There is also ucaresystem that integrates all of the above:

  • Updates the list of available packages
  • Downloads and installs the available updates
  • Checks if there are older Linux kernels on the system and removes them. However it keeps the current and one previous version of the kernel.
  • Cleans the cache of the downloaded packages
  • Removes obsolete packages
  • Removes orphan packets
  • Deletes package configuration files from packages that have been uninstalled by you.

You can install it either with ppa or just the deb package:

https://utappia.org/2017/10/20/ucaresystem-core-v4-0-added-option-to-upgrade-ubuntu-to-the-next-release/