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.

When the computer starts, GRUB shows a long list of previous kernels in addition to the usual stuff, e.g.

Ubuntu 10.10, kernel 2.6.35-23-generic
Ubuntu 10.10, kernel 2.6.35-23-generic (recovery mode)
Ubuntu 10.10, kernel 2.6.35-22-generic
Ubuntu 10.10, kernel 2.6.35-22-generic (recovery mode)
[6 more similar]
Ubuntu 10.10, memtest86+
Other operating systems:
Dell Utility Partition
Windows Vista (loader)

Is it safe to delete those extra "Ubuntu 10.10, kernel" lines from /etc/grub/menu.lst? Currently I have commented-out from the third one up to (not including) memtest86. But I wonder if they are ever needed for a particular reason?

share|improve this question
add comment

5 Answers

up vote 18 down vote accepted

Safe but pointless. The next time update-grub runs, they'll probably pop back up.

Kernels are installed as packages and so can be removed like other packages.

You can see what you have installed with this command. The active kernel will be highlighted:

dpkg -l | grep -Eo "^.i +linux-(image|headers)[^ ]+" | cut -c 5- | grep --color -E "$|"`uname -r`

In my case I see (I use lots of home-built and custom kernels):

linux-headers-2.6.36-1.dmz.1-liquorix-amd64
linux-headers-2.6.36-woof
linux-headers-2.6.36.1-cat
linux-image-2.6.36-1.dmz.1-liquorix-amd64
linux-image-2.6.36.1-cat

From there you can remove things using sudo apt-get purge <package-name>. Just make sure you don't remove your current kernel (uname -a to see what version you're on) and I agree with what other have said, keep the next newest one in case things blow up.

The massive benefit over just hitting on grub is you will free up hundreds of megabytes of disk space.

share|improve this answer
1  
I always come back to this answer... thanks a lot again! –  ecoologic Jan 20 '13 at 0:48
add comment

Yes. But i recommend leaving the previous one in there, just in case the default one you have gives any kind of weird problem. If you happen to have at least a full week of testing with no problem you can delete the old ones and update the configuration of grub. Or if you just want to NOT SEE the other version then just simply edit the grub.cfg file and remove the options for the menu there without removing the actual old kernel. That way you have them just in case. Besides the kernel is not that big to worry about hehe.

share|improve this answer
    
Yes, leaving the previous one is probably a good idea. –  Adam Thompson Dec 14 '10 at 21:57
add comment

Yes it's safe. But do it only if you're sure the latest kernel works fine. Also keep old kernel so you can manually boot them if something goes wrong.

share|improve this answer
add comment

Well the memtest and the current kernel and current kernel recovery mode should be left on there, but as long as the new kernel is working properly then there is no problem with removing the old kernels.

share|improve this answer
add comment

delete them from package manager and they will disappear automatically

for example:

apt-get remove linux-image-2.6.35-22-generic
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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