Distro-provided mechanism to clean up old kernels
Dustin Kirkland
kirkland at ubuntu.com
Thu Feb 16 16:11:39 UTC 2012
I understand that I'm not the first to ask this question. In fact, I
see at least 10 similar questions at AskUbuntu.com, and many more
duplicates:
* http://askubuntu.com/search?q=remove+old+kernels
This week, I received a message from one of our commercial ISP/Cloud
Hosting Providers, saying:
>>> Unlike other Linux distributions, Ubuntu does not automatically remove older, unused kernel packages after an update. Over time, this will fill the boot partition and result in future updates failing.
The email continued, recommending that we clean up old Ubuntu kernels
using this command:
# dpkg --get-selections|grep 'linux-image*'|awk '{print $1}'|egrep
-v "linux-image-$(uname -r)|linux-image-generic" |while read n;do
apt-get -y remove $n;done
Truly, I connected to several of my Ubuntu servers, some of which have
been running for over 4 years, and I manually purged 3GB+ of old
kernels on some machines!
I don't want to go into all the ways and reasons that the one-liner
above is sub-optimal or even evil, but I would like to call attention
to the generic problem and suggest that as a distribution, we provide
a supported and recommended utility to handle this.
I asked about this in IRC yesterday, and Colin Watson pointed me to
the computer-janitor utility, which is intended to handle this.
Seconds later, Barry Warsaw told me that computer-janitor should die
:-) I tried computer-janitor on my desktop, and it seemed to work
okay. But then I tried it on my servers and it failed:
# sudo computer-janitor find
ERROR:dbus.proxies:Introspect error on :1.3:/:
dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1
matched rules; type="method_call", sender=":1.8" (uid=0 pid=26155
comm="/usr/bin/python /usr/sbin/computer-janitor find ")
interface="org.freedesktop.DBus.Introspectable" member="Introspect"
error name="(unset)" requested_reply="0" destination=":1.3" (uid=0
pid=19905 comm="/usr/bin/python /usr/share/computerjanitor/janitor")
So I guess my questions are:
1) Surely we're not the only Ubuntu users whose /boot or root
partition has filled up with age-old kernels, are we?
2) Is computer-janitor here to stay, or to be abandoned in favor of
something else?
3) Can we expect computer-janitor to work on command-line only
environments (Ubuntu servers) too? If so, can we get SRUs out so that
it works on older distributions?
4) Can we, as a distro, provide and recommend a utility to clean out
specifically old kernels (perhaps aside from cleaning up userspace
cruft a la computer-janitor)?
--
:-Dustin
Dustin Kirkland
Ubuntu Core Developer
More information about the ubuntu-devel
mailing list