Remove Old Kernels

PPA description

This script will prevent the disk filling up with unused kernels, by only keeping the most recent N (3 by default) versions. If last-good-boot is enabled in /etc/default/kernel-helper-rc then this version is never removed either, and neither is the currently running kernel.
Recent versions of GRUB hide old versions, but they are still installed forever, and no one ever needs to go back more than a version or two ("argh, that update broke my ... how do I boot something that works"). This behaviour is present by default in distributions like Fedora.

Please note, the DUMMY_RUN setting should not be changed to 0. This will prevent updates from installing. There is probably no way to make things work using my approach. Instead you'll need to cut and paste the output by hand, or vote for https://blueprints.launchpad.net/ubuntu/+spec/desktop-q-clean-old-kernels

Install
-------
Open a console window (press ctrl-alt-f1, or use the GUI to start Terminal, Konsole, Xterm, etc) and run:
sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels && sudo apt-get update && sudo apt-get install remove-old-kernels

Configuration
-------------
Configuration is done using a text file called /etc/remove-old-kernels.conf
Currently you *must* edit this file and set DUMMY_RUN to 0 or the script simple prints out the command it would run.
The contents of this file should be the 5 lines below.

#The number of old kernels to keep around
NUM_TO_KEEP=3

#Change to 1 to print out the command to be run but not run it
DUMMY_RUN=1

Usage
-----
The old kernels will be uninstalled the next time a new kernel is installed. Currently you must edit the configuration file for this to take effect, see above.

Adding this PPA to your system

You can update your system with unsupported packages from this untrusted PPA by adding ppa:bugs-launchpad-net-falkensweb/remove-old-kernels to your system's Software Sources. (Read about installing)

sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels
sudo apt update
        
Technical details about this PPA

This PPA can be added to your system manually by copying the lines below and adding them to your system's software sources.

Display sources.list entries for:
deb https://ppa.launchpadcontent.net/bugs-launchpad-net-falkensweb/remove-old-kernels/ubuntu YOUR_UBUNTU_VERSION_HERE main 
deb-src https://ppa.launchpadcontent.net/bugs-launchpad-net-falkensweb/remove-old-kernels/ubuntu YOUR_UBUNTU_VERSION_HERE main 
Signing key:
1024R/AE35216F422A42898E567E96E958E2005A4A14B5 (What is this?)
Fingerprint:
AE35216F422A42898E567E96E958E2005A4A14B5

For questions and bugs with software in this PPA please contact Tom Chiverton.

PPA statistics

Activity
0 updates added during the past month.
View package details

Overview of published packages

15 of 5 results
Package Version Uploaded by
remove-old-kernels 1.3-0ubuntu1 Tom Chiverton ()
remove-old-kernels 1.3-0ubuntu1 Tom Chiverton ()
remove-old-kernels 1.3-0ubuntu1 Tom Chiverton ()
remove-old-kernels 1.3-0ubuntu1 Tom Chiverton ()
remove-old-kernels 1.2-0ubuntu3 Tom Chiverton ()
15 of 5 results

Latest updates

  • remove-old-kernels 619 weeks ago
    Successfully built
  • remove-old-kernels 619 weeks ago
    Successfully built
  • remove-old-kernels 619 weeks ago
    Successfully built
  • remove-old-kernels 619 weeks ago
    Successfully built
  • remove-old-kernels 626 weeks ago
    Successfully built