Distro-provided mechanism to clean up old kernels

Sander Smeenk ssmeenk at freshdot.net
Fri Feb 17 09:17:21 UTC 2012


Quoting Kees Cook (kees at ubuntu.com):

> FWIW, this is the highly advanced system I use for my auto-updated VMs.
> It keeps the latest 2 kernels:
> OLD=$(ls -tr /boot/vmlinuz-* | head -n -2 | cut -d- -f2- | \
> 	awk '{print "linux-image-" $0}')
> if [ -n "$OLD" ]; then
>     apt-get -qy remove --purge $OLD
> fi

Clean. I wrote this little perlscript which i hook from APT:
https://8n1.org/raw/8337/e0ec

At my workplace we manage >150 servers for customers, this saved us a
lot of space in backups and on the physical serves. For what it's worth,
i don't think Ubuntu should introduce dbus services just to clean up
kernels.

Ubuntu Server installs are bloated enough as it is.
But that's just my 25 cents.

-Sander.
-- 
| If you think nobody cares, try missing a couple of payments.
| 4096R/20CC6CD2 - 6D40 1A20 B9AA 87D4 84C7  FBD6 F3A9 9442 20CC 6CD2




More information about the ubuntu-server mailing list