FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Server Development

 
 
LinkBack Thread Tools
 
Old 02-16-2012, 03:11 PM
Dustin Kirkland
 
Default Distro-provided mechanism to clean up old kernels

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

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 05:23 PM
Imre Gergely
 
Default Distro-provided mechanism to clean up old kernels

On 2012-02-16 18:11, Dustin Kirkland wrote:

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!


[...]


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?


Nope. I have the same problem. I'm managing a couple of LTSP servers
(with 10.04 LTS on them) and I saved around 400MB on the compressed
image file after I purged all the kernels and reinstalled the last one
(and deleted a lot of generated nbi.img files which remained after
purging the kernels).
There are also old linux-headers-* packages which can take up a lot of
space.


--
Imre Gergely
http://havaz.net
gpg --keyserver subkeys.pgp.net --recv-keys 0x34525305

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 07:04 PM
Steve Langasek
 
Default Distro-provided mechanism to clean up old kernels

On Thu, Feb 16, 2012 at 02:21:18PM -0500, Barry Warsaw wrote:
> In c-j 2.0, I worked to separate the backend functionality into a dbus
> service, with gtk and command-line front-ends. I looked at the
> debian/changelog to refresh my memory, and that implies the work was done
> during the Lucid cycle, but I think we ended up not landing it until after
> that LTS release, since my Lucid VM still has c-j 1.13.3.

Bear in mind that dbus is not running on servers by default. So that would
be a fine solution for the desktop, but there's a larger architectural
decision to confront there if we think that should be the solution on
servers as well.

I personally think we should bite the bullet and run dbus on servers as
well, but the server folks may disagree. In any event, there are other
places where lack of dbus is already causing suffering on the server, such
as with upstart bash-completion support.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 07:07 PM
Steve Langasek
 
Default Distro-provided mechanism to clean up old kernels

On Thu, Feb 16, 2012 at 12:04:03PM -0800, Steve Langasek wrote:

> Bear in mind that dbus is not running on servers by default. So that would
> be a fine solution for the desktop, but there's a larger architectural
> decision to confront there if we think that should be the solution on
> servers as well.

Evan Broder has set me straight here that we *are* installing dbus by
default, and I see that it's part of the 'standard' task in precise. So
nevermind.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 07:16 PM
Scott Kitterman
 
Default Distro-provided mechanism to clean up old kernels

On Thursday, February 16, 2012 12:07:58 PM Steve Langasek wrote:
> On Thu, Feb 16, 2012 at 12:04:03PM -0800, Steve Langasek wrote:
> > Bear in mind that dbus is not running on servers by default. So that
> > would be a fine solution for the desktop, but there's a larger
> > architectural decision to confront there if we think that should be the
> > solution on servers as well.
>
> Evan Broder has set me straight here that we *are* installing dbus by
> default, and I see that it's part of the 'standard' task in precise. So
> nevermind.

Right, but that doesn't make it a good thing.

DBus is a desktop technology and I don't think there's a compelling use case
for adding this additional complexity to servers.

Myself, I'd prefer it go away. I'm not clear why it was added.

Scott K

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 07:19 PM
Mario Limonciello
 
Default Distro-provided mechanism to clean up old kernels

On Thu, Feb 16, 2012 at 14:16, Scott Kitterman <ubuntu@kitterman.com> wrote:

On Thursday, February 16, 2012 12:07:58 PM Steve Langasek wrote:

> On Thu, Feb 16, 2012 at 12:04:03PM -0800, Steve Langasek wrote:

> > Bear in mind that dbus is not running on servers by default. *So that

> > would be a fine solution for the desktop, but there's a larger

> > architectural decision to confront there if we think that should be the

> > solution on servers as well.

>

> Evan Broder has set me straight here that we *are* installing dbus by

> default, and I see that it's part of the 'standard' task in precise. *So

> nevermind.



Right, but that doesn't make it a good thing.



DBus is a desktop technology and I don't think there's a compelling use case

for adding this additional complexity to servers.



Myself, I'd prefer it go away. *I'm not clear why it was added.



Scott K


Perhaps it was pulled in because of upstart's support for dbus? *(http://upstart.ubuntu.com/wiki/DBusInterface)*

--
Mario Limonciello
superm1@ubuntu.com

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 07:31 PM
Kees Cook
 
Default Distro-provided mechanism to clean up old kernels

On Thu, Feb 16, 2012 at 02:21:18PM -0500, Barry Warsaw wrote:
> On Feb 16, 2012, at 10:11 AM, Dustin Kirkland wrote:
> >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
> >:-)
>
> c-j needs attention, but I'm not particularly motivated to give it what it
> needs. There's basic housekeeping, such as that the code for c-j is sprinkled
> between the update-manager and the computer-janitor packages, and even more
> important problems such LP: #458872. What's demotivating though is that in
> all the discussions we've had about the tool, most people think it's just not
> user-friendly enough given today's emphasis on software-center.

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

Be warned, of course, that if you don't reboot often, you can end up
removing the kernel you're running. :P

-Kees

--
Kees Cook

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 08:08 PM
Craig White
 
Default Distro-provided mechanism to clean up old kernels

this was interesting but I found that I had to NOT use 'head -n -2' but rather 'head -n 2'

Craig

On Feb 16, 2012, at 1:31 PM, Kees Cook wrote:

> On Thu, Feb 16, 2012 at 02:21:18PM -0500, Barry Warsaw wrote:
>> On Feb 16, 2012, at 10:11 AM, Dustin Kirkland wrote:
>>> 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
>>> :-)
>>
>> c-j needs attention, but I'm not particularly motivated to give it what it
>> needs. There's basic housekeeping, such as that the code for c-j is sprinkled
>> between the update-manager and the computer-janitor packages, and even more
>> important problems such LP: #458872. What's demotivating though is that in
>> all the discussions we've had about the tool, most people think it's just not
>> user-friendly enough given today's emphasis on software-center.
>
> 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
>
> Be warned, of course, that if you don't reboot often, you can end up
> removing the kernel you're running. :P
>
> -Kees
>
> --
> Kees Cook
>
> --
> ubuntu-server mailing list
> ubuntu-server@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
> More info: https://wiki.ubuntu.com/ServerTeam

--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com

Need help communicating between generations at work to achieve your desired success? Let us help!


--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 08:34 PM
Dustin Kirkland
 
Default Distro-provided mechanism to clean up old kernels

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Thu, Feb 16, 2012 at 2:31 PM, Kees Cook <kees@ubuntu.com> wrote:
> On Thu, Feb 16, 2012 at 02:21:18PM -0500, Barry Warsaw wrote:
>> On Feb 16, 2012, at 10:11 AM, Dustin Kirkland wrote:
>> >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
>> >:-)
>>
>> c-j needs attention, but I'm not particularly motivated to give it what it
>> needs. *There's basic housekeeping, such as that the code for c-j is sprinkled
>> between the update-manager and the computer-janitor packages, and even more
>> important problems such LP: #458872. *What's demotivating though is that in
>> all the discussions we've had about the tool, most people think it's just not
>> user-friendly enough given today's emphasis on software-center.
>
> 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
>
> Be warned, of course, that if you don't reboot often, you can end up
> removing the kernel you're running. :P

Yeah, something like this, perhaps with a uname -r check, to also
exclude the current kernel you're running, which apparently *is* known
to work.

Regarding computer-janitor and the dbus discussion -- I certainly like
the idea of computer-janitor in general, but I think I agree with
Barry that it feels much more like a desktop than a server solution.

I guess what I would like to see is to take perhaps Kees' script as a
starting point, improve upon that logic slightly, and ship it within
Ubuntu as a consistent, supported, recommended mechanism for vacuuming
out unneeded kernels. Something like 'remove-old-kernels', perhaps
shipping in computer-janitor, or ideally more pervasive. In order to
be useful, though, we'd need to make that script available to
installed systems via SRU.

Barry, would you be willing to accept a shell script along these
lines, into computer-janitor, if I cleaned it up and proposed a merge
and shepherded it through the SRU process? Or, is there a better home
we can agree upon?

- --
:-Dustin

Dustin Kirkland
Ubuntu Core Developer

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCgAGBQJPPXZdAAoJEJXmQ3PxUpRpLaUP/0WaUkIv2keM+ajQ4WTaCIi5
2pLc3Y5Jeds2/TLqMBKxdlx6M/Hh1wuUaIxYBB3d/nELYKCXbeCxiADfaBraRiet
PbPxooNKti3sbVc/vrgpu8oC54E8vb5Jc8d4zPr0qDcnKNMzHGPbxA78z8MlR+TQ
vqAPcmZcvKF9jUESvrdkYd9pefaLsFludHSwLjt2Dw7+SPsyOr XRBLw8FConBzoV
CHZXiI+FyKaMANwsHVX/2O+RrcpsCgwahQpCEjBFghumR09xTI4ONRpfgqzBDSuN
SSdVTvVCC56ZJ15ufJGCaRVWY7ESTq8deuODnD5/4xIKyVetJtZigPenGLB6N81l
eRtM9brTQAgdLgJ/BDr6TxIibwmgEzJp/EEKDC3tHvd2I7ZJZJ5WqYoyFMdtJRnh
Rwsdt9iEbqIn2pv677rGMpQjldgrAIwBPu+EqgCIbCMTse0/s5oATxhP/953fBB5
S14J+PTSOQh4FwHuzjcyMMdtltQyvjAXRZwm989MvblGcABck0 nNMH1VJqIDR7ke
ujI+5kYeQGDszeddFhy8qtyqAyPj8hpyzgnDzh+5kQdtftMv8Q vci8tuxAvqNjI2
473WDq2RcqKXFI/hMT63Z44dkxzsht8NXwI1ksR8643fT/owsSZiKzwdxUCgWyyD
7ETOc6yNLB/Gs7o2t7z9
=lFFF
-----END PGP SIGNATURE-----

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 02-16-2012, 08:36 PM
Dustin Kirkland
 
Default Distro-provided mechanism to clean up old kernels

On Thu, Feb 16, 2012 at 3:08 PM, Craig White <craig.white@ttiltd.com> wrote:
> this was interesting but I found that I had to NOT use 'head -n -2' but rather 'head -n 2'

You can do 'head -2' or 'head -n2', but not 'head -n -2'. I assumed
it was a typo ;-)

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 

Thread Tools




All times are GMT. The time now is 04:00 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org