Recently I have installed Ubuntu 9.10 - the Karmic Koala - released in October 2009 .I upgraded using update manager many times. So each time I update it is adding one menu in boot screen like recovery mode. I have windows OS also. Right now in booting time it is listing around 10 bootmenu's. Windows OS goes to last line of the menu . How can I clear all the boot menu's except windows and ubuntu latest vesion?
4 Answers
Go into the synaptic package manager, and scroll down until you find linux-image-*
You can safely remove them all, except the one you booted from. (You can find that out by running 'uname -r' from the command line.
Also running 'sudo apt-get autoremove --purge' from the command line may detect the 'old' ones and automatically remove them.
-
Thanks .Worked well.And also I am seeing one more boot menu like "Memory Test".Is it possible to remove that also?– DonXJan 10, 2010 at 2:59
-
1That gets a bit more tricky, but all the info should be in the file /boot/grub/menu.lst. Be Careful with that file though. If you edit it incorrectly, you may not be able to boot anymore... ;) Jan 26, 2010 at 2:15
If you're feeling especially adventurous, you could edit the source of the Grub bootmenu at
/boot/grub/grub.cfg
and delete the menu entries you don't need.
You will have to deliberately ignore the message at the top of the file which says
# DO NOT EDIT THIS FILE
You'll need to be root, and the the danger of making the system unbootable is high.
Make a copy of the file, eg grub.cfg0,
Study grub.cfg carefully, and make sure you understand what you're deleting before you do it. If you're NOT confident, don't do it.
The section relating to Memory Test is as follows in my Ubuntu 9.10
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
-
1Not a good idea because /boot/grub/grub.cfg is overwritten anytime there is a update, a kernel is added/removed or the user runs update-grub. Jan 14, 2010 at 1:40
When update-grub is run, whether by you or by a kernel package installation, it generates /boot/grub/grub.cfg by running, in order, the executable scripts in /etc/grub.d. If you want to change your boot menu order, just change the order of the scripts in /etc/grub.d.
If you want your Windows boot entry first, run this to have that boot entry generated before the Linux kernel entries are generated (in the 10_linux
script):
sudo mv /etc/grub.d/30_os-prober /etc/grub.d/09_os-prober
Once you're done, run sudo update-grub
to generate a new /boot/grub/grub.cfg.
The Memtest86 boot entries are created by the /etc/grub.d scripts 20_memtest86
and 21_memtest86+
. If you don't want the Memtest86 boot menu entries, the easiest and most permanent way to get rid of them (short of uninstalling the memtest86 and memtest86+ packages) is to run these commands:
# unset executable bit for grub menu configuration script sudo chmod -x /etc/grub.d/*memtest86*
The chmod disables the Memtest86 boot entries, and running sudo update-grub
will now create a /boot/grub/grub.cfg that doesn't include the Memtest86/+ entries.
To undo that change, simply add the executable bit back to the script, and re-run update-grub.
# reset sudo chmod +x /etc/grub.d/*memtest86*
- Remove Old Kernel Entries: Just open your Synaptic Package Manage and remove it.
- Remove Memory test (Serial Console): if you want to remove this entry, you have to delete it. Comment won't change anything. Before changing anything in "/etc/grub.d/" directory, you have to change the permission.
- Everything's fine until now. Let's update Grub and watch the result.
See my blog entries How to Edit Boot menu on Ubuntu Grub2 and How to Change Boot Order on Ubuntu for more details and pictures.
-
3Welcome to Server Fault! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.– user9517May 29, 2011 at 9:01