LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 12-27-2008, 12:14 PM   #1
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[45] {x86,x86_64}, Debian "testing" {x86,x86_64}
Posts: 219

Rep: Reputation: 36
What controls the number of Debian kernels automatically installed?


Is there some maximum value of old kernels that the automatic update mechanism installs, and after that, starts uninstalling old kernels? Or, is the number of kernels being installed likely to grow without bound, leaving it up to me to manually uninstall old kernels (say, maybe leaving one or two old kernels as a backup for safeties sake)? My fear here is that the number of installed kernels will build up to the point of causing the filesystem in which they are stored to run out of file space, and who knows what weird sorts of failures at boot time that will cause later on if not addressed now.

Thanks,
bgoodr
 
Old 12-27-2008, 12:30 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
You have to uninstall the kernels you no longer require, but they do not take up much space on your HDD.

Most people will keep at least one previous kernel, in case an update causes problems (in my experience, they don't).

In any case, after 10 or so kernel upgrades, it'll be time to move to the next distro release, so maybe best not to worry about it
 
Old 12-27-2008, 12:53 PM   #3
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[45] {x86,x86_64}, Debian "testing" {x86,x86_64}
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by tredegar View Post
In any case, after 10 or so kernel upgrades, it'll be time to move to the next distro release, so maybe best not to worry about it
Yes, I agree. Thanks!

bgoodr
 
Old 12-27-2008, 01:09 PM   #4
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
Quote:
Originally Posted by tredegar View Post
In any case, after 10 or so kernel upgrades, it'll be time to move to the next distro release, so maybe best not to worry about it
Unless he's using debian testing or unstable ofcourse, where you can just upgrade for ever.
 
Old 12-27-2008, 01:12 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
If he's using debian testing or unstable, I'd expect him to be able to answer his own question
Fair comment though!
 
Old 12-27-2008, 01:35 PM   #6
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
Well, he's Distribution: say Lenny.
To the op, the kernels don't just magically get updated, you do that yourself by accepting or starting the install. Therefore you also are expected to take care of removing not wanted ones.
 
Old 12-27-2008, 01:44 PM   #7
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[45] {x86,x86_64}, Debian "testing" {x86,x86_64}
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by makuyl View Post
Unless he's using debian testing or unstable ofcourse, where you can just upgrade for ever.
Let me get this straight: Since I'm using Debian testing, it is as if apt-get dist-upgrade were to be executed automatically, and that the kernels will accrue without bound, leaving it up to me to periodically purge the old kernel packages.

If that is correct, then I can live with that. But, I would have expected http://www.debian.org/devel/testing to describe such behavior without forcing me to post "question spam" into this forum.

bg
 
Old 12-27-2008, 02:22 PM   #8
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
That's not what I meant. I meant that debian testing and unstable allow you to upgrade basically forever, without doing a single big release upgrade. Oh well, in practise you get these packagelumps when a new stable gets out, but it's still not a reinstall.
 
Old 12-27-2008, 03:36 PM   #9
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 59
As far as I know, Debian will never automatically uninstall a kernel. The exception that proves the rule is that if you get a new version of the same kernel release (because of a security-related patch), then that will overwrite the other version. So if you have 2.6.26.1-686, and the 2.6.26-1 kernels get a security patch, then your kernel will get overwritten. However, if you are in Lenny, and 2.6.27-4 becomes the new kernel, then 2.6.26-1 will not be removed. I've never read an official reason why not, but here's my guess: sometimes new kernels mess up existing systems or have regressions in terms of performance. In such a case, it's very smart to have a back-up, in case you need to "downgrade" (so to speak). After a reasonable amount of experience with a new kernel, I think you are safe to uninstall anything from current-2 back.

That said, there's nothing intrinsically wrong with keeping old ones unless your /boot partition is very small. If it is and it fills up, then you will have problems booting into regular user mode. (There's a small amount of extra space reserved for root to protect you from being completely locked out of your system, as I recall.) In any case, I can't see any reason to keep even four or five old kernels, much less ten.

As for automatic upgrades: you will get an automatic kernel upgrade if you have one of the dummy/virtual kernel packages installed. An example of those is linux-image-2.6-686. That package doesn't install any particular kernel. Instead it's a hook: it brings in whatever kernel in the -686 series is current in your sources. So if you were in Lenny going back a bit, at one point that would have dragged in 2.6.22-x-686, then 2.6.24-x-686, etc. Right now, it's pointing at 2.6.26-1. I'm not sure if the plan is to release Lenny with that or try for a 2.6.27 (or even 28) before release.

You can see what kernels you have installed - to check if you have a virtual kernel and to clean up - by running this command:
Code:
aptitude search ~ilinux-image
If you've been installing kernel-headers along with the kernels (say to build modules for graphics or wireless), you should remove those when you remove the corresponding kernel. The command to search for those is parallel:
Code:
aptitude search ~ilinux-headers
Hope this helps.
 
Old 12-27-2008, 04:18 PM   #10
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[45] {x86,x86_64}, Debian "testing" {x86,x86_64}
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by Telemachos View Post
...
If you've been installing kernel-headers along with the kernels (say to build modules for graphics or wireless), you should remove those when you remove the corresponding kernel. The command to search for those is parallel:
Code:
aptitude search ~ilinux-headers
Hope this helps.
Yes that does help a lot. I will need to continue to use apt-get for package management since that is what I started with, and got burned pretty badly last year for attempting to mix apt-get with aptitude, but I get your point.

Thanks for everyones help!
bgoodr
 
Old 12-27-2008, 10:00 PM   #11
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 59
Quote:
Originally Posted by bgoodr View Post
I will need to continue to use apt-get for package management since that is what I started with, and got burned pretty badly last year for attempting to mix apt-get with aptitude, but I get your point.
Fair enough. Just so you know, you can always safely do searches from aptitude or apt-get (or Synaptic or any other package manager), no matter which you use for installation. The searches just look for available packages or packages on your sytem; they don't change anything.
 
Old 12-29-2008, 09:10 AM   #12
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
I've already run into that problem of filling up the boot partition because there were so many old / custom kernels hanging around.

I now proactively remove all the old kernels from my systems, keeping only my current running kernel and the previous working kernel. anything older than that is hunted down and purged, then the headers for it are purged, then I search for modules related to that kernel and they get removed as well.

Even if you are not running Sid, you can have a system that you roll from one version of stable to the next, and the kernels will eventually start to add up.

In addition to the searches suggested above.
aptitude search ~ilinux-image
aptitude search ~ilinux-headers


I also check the modules and sources directories. No need to keep modules and junk around for kernels i've already removed.
ls -al /lib/modules
ls -al /usr/src
 
Old 12-30-2008, 08:29 PM   #13
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[45] {x86,x86_64}, Debian "testing" {x86,x86_64}
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by farslayer View Post
I also check the modules and sources directories. No need to keep modules and junk around for kernels i've already removed.
ls -al /lib/modules
ls -al /usr/src
Thanks. See also some related info in the other thread.

bgoodr
 
Old 01-03-2009, 11:58 AM   #14
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Rep: Reputation: 45
For us lazy types, it would be nice to have something like the fedora option which tells the system how many kernels you would like to be kept. My fear is always that someday I will accidentally remove the incorrect kernel.
 
Old 01-03-2009, 12:36 PM   #15
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Quote:
For us lazy types, it would be nice to have something like the fedora option which tells the system how many kernels you would like to be kept. My fear is always that someday I will accidentally remove the incorrect kernel.
Please define "incorrect kernel" [That one I really, really wanted to keep?]

Seriously, if it is annoying you, isn't this something that is crying out for you to write a script for?

Run it once at every boot (you only reboot when you add a new kernel, right? )

Psloppy pseudocode for said script follows:

keep=5; do find the kernels available | sort by date | count | if <= keep then done and exit cleanly, else rm the oldest until done

There are many ways of doing this (with and without paranoid error-checking, and sensible reporting), and you do not have to follow the recursive outline I have suggested.

Maybe fedora have already written such a script, and in true linux tradition it just needs a few minor changes (or maybe none at all) for your distro.

Sorry, I don't have the time to do this for you, and this is not high on my list of priorities at the moment, but it might be a fun little project with a high satisfaction-quotient. Feel free to post your efforts here, or even in a new thread.

I shouldn't have to warn you to take a system backup before you start playing with kernel-removing scripts:

Oops! Recursion went wrong.
All kernels gone.

Have fun!
 
  


Reply

Tags
apt-get, aptitude


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locating Installed Kernels in Debian carlosinfl Debian 9 07-11-2008 07:11 AM
LXer: Debian Linux controls copter-like UAV LXer Syndicated Linux News 1 04-03-2007 03:17 PM
If you installed huge26.s or the test26.s kernels cwwilson721 Slackware 46 01-27-2007 02:27 PM
How can I prevent my box from automatically forcing fsck after the default number of abefroman Linux - Software 4 12-16-2005 04:25 PM
GRUB boot with 2 kernels installed philnk Linux - Software 2 07-07-2005 07:47 PM


All times are GMT -5. The time now is 11:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration