Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
Is there a way to remove/hide old kernel versions?

I've been using dual boot on my PC for some time now, to use Ubuntu along side with Windows 7. One very disturbing thing happens, when Ubuntu linux core gets updated (this happens once in a while). They are added as options to the grub menu so, my boot menu now looks like this:

Ubuntu, with linux 2.6.35-27 generic
Ubuntu, with linux 2.6.35-27 generic (recovery mode)
Ubuntu, with linux 2.6.35-25 generic 
Ubuntu, with linux 2.6.35-25 generic (recovery mode)
Ubuntu, with linux 2.6.35-24 generic
Ubuntu, with linux 2.6.35-24 generic (recovery mode)
Ubuntu, with linux 2.6.35-22 generic
Ubuntu, with linux 2.6.35-22 generic (recovery mode)
Memory test
Windows 7

This gets very annoying, because I want to load windows by default, but after every update it shifts down and I have to go to grub config and change the default option.

My question: How to get rid of older versions of linux in the grub menu and leave only the newest one?

share|improve this question

marked as duplicate by Marco Ceppi Mar 4 '11 at 15:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
this is a duplicate of my question here: askubuntu.com/questions/2793/… –  ImaginaryRobots Mar 4 '11 at 14:40

6 Answers 6

up vote 3 down vote accepted

With Ubuntu Tweak is the easiest way to remove old kernel images.

Here is a tutorial http://www.ubunturoot.com/2010/03/how-to-remove-old-kernel-images-in-grub.html

share|improve this answer

I would suggest that you always keep not only the latest kernel, but also the previous one. This way if at some point you find issues with latest kernel, you can still 'downgrade' your system to the previous stable configuration.

share|improve this answer
1  
+1 for keeping the previous kernel - I've had issues where I update the kernel, reboot, and I get a panic (or something like that) the prevents me from booting. Keeping the previous kernel has saved my butt more times than I care to remember. :) –  jrg Mar 4 '11 at 12:20
    
+1 It will be foolishness not to keep more than just the latest kernel –  Ashfame Mar 4 '11 at 13:49
    
The information is true (+1), but does not answer the question (-1). –  Lekensteyn Mar 4 '11 at 15:42

The simple way is to go to synaptic and search for the kernels which are not in use

In your case search for 2.6.35-25 & 24 & 22 and completely remove them. You can even check which kernel you are using with uname command in your terminal and remove other kernels that are installed or You can use softwares like ailurus or ubuntu-tweak which will remove unused kernel.

This thread on askubuntu talks about your issue and says Computer Janitor in Administration > Computer Janitor will do the trick as well.

share|improve this answer

You could install ubuntu-tweak and then Go to Applications -> System tool -> ubuntu tweak and

enter image description here click package cleaner and clean kernels. it does not show the currently used kernel so you will always be safe.

share|improve this answer

Install startup manager sudo apt-get install startupmanager (GUI for grub, usplash and splash screens).

Pick the default OS in the Boot options tab, and the number of previous kernel entries to keep in the Advanced tab. You can adjust many other options to your liking, too...

share|improve this answer
    
This looks like a good solution, but my "Advanced" tab has no such settings. Screenshot: habreffect.ru/files/e33/f4752a7c8/Screenshot.png –  Silver Light Mar 4 '11 at 13:28
    
interesting. what version of ubuntu (10.10) and startupmanager(1.9.13-5?)? what happens if you exec "su-to-root -X -c /usr/sbin/startupmanager"? I actually got 4 tabs, not 2 like you. –  Christoph Mar 4 '11 at 13:38
    
are you using grub2? if yes, maybe you've run into this bug: bugs.launchpad.net/ubuntu/+source/startupmanager/+bug/312933 –  Christoph Mar 4 '11 at 13:55
    
-1 startupmanager is a great way to break a system in my experience. In this case, removing old kernel packages is a much cleaner method, requires no additional software and frees up a ton of disk space. –  Oli Mar 4 '11 at 13:57
    
well, in my experience it does what it's supposed to do, without problems. ymmv, of course. I wonder, though, if it's really so much worse than inexperienced users manually removing kernel packages....? –  Christoph Mar 4 '11 at 15:00

There has been a lot of answers. Adding to these answers you may try this : The grub menu is loaded from /boot/grub/grub.cfg ; if you are using ubuntu version later than 9.10. For previous versions it is the file /boot/grub/menu.lst.

Open that file and you will see the detailed lists of the menu (after a few lines of codes) block as the following style:

 ### BEGIN /etc/grub.d/. ...###
 menuentry  ...
            ...
 ### END ....................###

The last menuentry will be windows 7 . If you want windows 7 at the first of the menu cut this section and paste it before "Ubuntu, with linux 2.6.35-27 generic" menuentry block. If you don't want other menuentries youcan comment them out or delete them.

share|improve this answer
    
This file will be regenerated when GRUB or the kernel gets updated. –  Lekensteyn Mar 4 '11 at 15:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.