Grub 2, delete unwanted lines from the start menu
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 |
Inside your /etc/grub.d you will find many files. Update these and run update-grub2 for modifications.
What unwanted lines? ... grub2 is supposed to find everything bootable. If you have extra kernels installed, then uninstall them. |
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 |
If you want to disablee the recovery entries, open /etc/default/grub file with sudo in a text editor. There should be a line at the bottom similar to:
Quote:
To remove the memtest entries, do this after navigating to the /etc/grub.d/ directory: Quote:
Quote:
|
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 |
Quote:
|
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 |
copy the entries that you want from /boot/grub/grub.cfg.old to the /etc/grub.d/40_custom or
Quote:
Quote:
|
There is nothing in /boot/grub/grub.cfg.old
Remember we are talking about Grub2 here. 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: Code:
$ cat /etc/default/grub 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. |
Thanks PT, I am comfortable with that but where is the editable file that has the lines which appear on the menu?
Cliff |
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.
|
Unwanted kernels can be removed via Synaptic Package Manager which may run update-grub after removing them
|
All times are GMT -5. The time now is 12:26 PM. |