[SOLVED] Grub 2, delete unwanted lines from the start menu
UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
As you probably know Ubuntu now uses Grub 2.
Over several months I have accumulated a lot of extra lines on the start up menu but I can't work out how to get rid of them.
I have read the Grub 2 Tutorial and just don't understand it
Can anyone help?
Cliff
Thanks Amani,
I have 7 extra kernels listed which do not boot. Plus there recovery modes and a couple of MeMTests.
In the original Grub it was easy to # these out but not in Grub 2
However there must be a similar mechanism to get rid of them.
Why do I want to get rid of them?? because they push my other OS boot off the page.
Cliff
let's get the big picture here, is anyone know how to delete kernel entries (which they are in grub.cfg, and hasn't been add through 40_custom file) that i don't need ?
it seems that with grub2 things gets complicated, i am not complain about it, but i cannot find a good documentation.
Look in your /boot directory and delete any files related to things you don't ever want to boot and delete them; if you find some that you think you might want, but not now, move then to a "backup" directory. then run grub-mkconfig -o /boot/grub/grub.cfg to recreate your boot menu.
Thanks to all for input
;
GRUB DISABLE LINUX RECOVERY = TRUE
This is OK but it removes all the recovery entries. I need to retain the one which relates to the current kernel and possibly the one before.
sudo chmod -x20_memtest86+
Gives me the message "no such file or directory. In any case I don't want to remove all MemTests, I would need to retain one.
As for the extraneous kernels; A couple may have been left over from previous updates and at least 2 have been generated when running "Update Manager"
Only the current kernel will boot.
Sudo update-grub does nothing.
Hen770 has given a good understanding of the question but it doesn't provide an answer.
PTrenholme appears to offer a good suggestion but it raises a question------which files?
each kernel has several files, for example;-
abi-2.6.32.....
config-2.6.32.....
initrd.img-2.6.32....
system.map-2.6.32.....
vmcore-2.6.32.....
vmLinuz-2.6.32.....
There is a strong possibility of creating a non recoverable failure.
More help needed.
Thanks
Cliff
The only thing this seems to have done is that it has removed the line which boots my Windows OS, not good news.
Can you now tell me how to reinstate the Windows Boot?
To my mind this question should have a very simple answer.
Somewhere there must be a file which shows the list of items on the Boot Menu, an editable file which allows you to remove items which are no longer required.
On the original GRUB this was simple, why the **** has it been made so complicated???
Cliff
The file you want to edit is the grub.cfg file. I know that the comments at the start of that file say "do not edit." but that's just advice, not some law you have to follow. (I edit mine all the time.) Just make sure you chmod the grub.cfg so Ubuntu's "helpful" update installer can't modify it, and all you'll need to do is run the grub-mkconfig program with the output file pointed someplace other than grub.cfg, and then pick the parts of that output file you want, and put then in your "real" grub.cfg file.
That way you'll have a "hand made" configuration file with a little automated assist.
You might also want to look at the documentation for the /etc/defaults/grub file. It lets you tune lots of the choices made by the automated configuration script. For your edification, here's the default settings I use on my Fedora 17 virtual test system:
Obviously some of those settings would not be appropriate for a Ubuntu system. It's just to show you that there's more you can do than turn off the recovery boot option.
By the way, the recovery boot options in the grub.cfg file are, really, unnecessary since you can always edit the "standard" GRUB boot stanza to include the recovery options "on the fly" using GRUB's built-in editor.
Last edited by PTrenholme; 10-19-2011 at 11:39 AM.
I didn't know if there was a grub.cfg.old that is why I mentioned to make the 30_os_prober file executable again then rerun update_grub to create a new /boot/grub/grub.cfg to get the menu entries to copy and and past to the /etc.grub.d 40_custom file before makeing both files unexecutable . PTrenholme way of doing things is a good idea too.
Last edited by colorpurple21859; 10-19-2011 at 12:54 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.