Clean Old Kernels

Registered by Jason Warner on 2012-04-25

Discuss cleaning old kernels for the user

Blueprint information

Status:
Started
Approver:
Andy Whitcroft
Priority:
Low
Drafter:
Adam Conrad
Direction:
Approved
Assignee:
Adam Conrad
Definition:
Approved
Series goal:
Accepted for raring
Implementation:
Beta Available
Milestone target:
milestone icon ubuntu-13.04-feature-freeze
Started by
Adam Conrad on 2012-10-05

Whiteboard

Plan is to use kernel postinst to mark the kernels which are 'to keep' as manually installed and the others as auto installed and let apt autoremove do the right thing.

We do care if someone manually marks a kernel rather than the post inst doing so, that is we should not mark autoinstalled if it was not us who marked it manual.

We want this to be a configurable somehow, in one of the /etc/ files.

This willl work well for the desktop as the update-manager will clean these up. On the server you will have to apt autoremove to clean up, this is actually desirable.

We likely will consider backporting this to precise, and perhaps lucid.

Tom Chiverton: Excuse me interrupting, but I couldn't see a better way to comment on this.
As part of https://bugs.launchpad.net/ubuntu/+source/linux/+bug/241368/ I wrote a postinst.d script https://launchpad.net/~bugs-launchpad-net-falkensweb/+archive/remove-old-kernels/ that may be of use. My approach in the PPA gets as far as outputting the list to remove (i.e. of kernel and associated packages older than the top N, always preserving last known good boot and the current kernel) but because of using that trigger, it can't actually run the command :-(
I'd love to help get Ubutnu up to the level of RPM based distributions in this area, and stop filling /boot with gigabytes of cruft.

Thomas Hood: Instead of using the "manual" extended-status for this purpose, thus effectively changing the meaning of that status which will almost inevitably lead to confusion, I would suggest creating a new status named "policy" (or choose your own name) and adapting the tools to handle that status. That is, whereas a "manual" package is always kept and an "auto" package is removed if nothing else depends on it, a "policy" package is, like a "manual" package, always kept, but policy scripts are permitted to change the extended-status to "auto". Ref: apt-mark(8)

(?)

Work Items

Work items for ubuntu-13.04-month-2:
[apw] think about whether linux-generic could point to linux-image-generic linux-headers-generic: DONE

Work items for ubuntu-13.04-month-4:
[apw] add Suggests: <headers> to linux-image binaries as per (LP: #1029730): DONE

Work items:
[vorlon] fix apt to allow the kernel to be marked 'auto remove': DONE
[vorlon] write a postinst.d to go in /etc/kernel/postinst.d: DONE
[adconrad] nice to have a good way to get a list of things to autoremove (stretch goal): TODO
[adconrad] consider backporting this to precise and/or lucid: DONE
[adconrad] alias apt-get --purge autoremove -> apt-get autopurge: TODO
[kirkland] add motd.d script for how much autoremove is pending: TODO

Dependency tree

* Blueprints in grey have been implemented.