Distro-provided mechanism to clean up old kernels

Bryce Harrington bryce at canonical.com
Fri Feb 17 20:30:24 UTC 2012

On Fri, Feb 17, 2012 at 08:29:08AM +0100, Vincent Ladeuil wrote:
> >>>>> Martin Pitt <martin.pitt at ubuntu.com> writes:
> <snip/>
>     > I think it'd be best if update-manager would auto-remove all kernel
>     > packages except the most recent two or three during dist-upgrade. This
>     > needs to be specified carefully of course, as people might explicitly
>     > run a kernel from the previous distro release. So perhaps some
>     > clevernes like if you install linux-image-3.2.0-N-generic, delete all
>     > kernels up to linux-image-3.2.0-(N-2)-generic. 
> My own use case here is that I had to work around a bug in newer kernels
> by running a very old one for *months*, I don't have the precise number
> anymore but I think I had at least 5 or 6 kernels newer than the only
> one I could use.

Having 5 or so kernels would also be handy for troubleshooting drm bugs;
once and a while we have to have the user boot earlier kernels to
bracket when a regression started.  It's not a huge issue though; we can
always just have them download older kernels.  But if they're already on
disk it makes troubleshooting a bit more convenient.

> Is there a way to know the last time a kernel was booted and use that as
> a criteria to keep it ?
> This will allow removing kernels unused for months limiting the risks
> that we remove a vital one.

Time of last boot, and/or total number of times booted would be
interesting metrics.  For fallback purposes I'd love to hang onto a old
known-good kernel that I'd booted a hundred times, rather than the one
from last week which may well have the same bug I'm trying to get
around.  But maybe this is overthinking things.  ;-)


More information about the ubuntu-server mailing list