PDA

View Full Version : [ubuntu] Change the order of the boot menu



rpaskudniak
November 29th, 2010, 05:39 AM
Greetings again.

Coming off the my very helpful public conversation with Quackers, in the thread entitled "Where should I have installed grub2" (http://ubuntuforums.org/showthread.php?t=1630908), I am left with one minor dilemma and another that has the potential to get very annoying. Both were easily solved under grub (before grub2).

Just one note: Using StartupManager (as Quackers had suggested) I do indeed have Windows as my default boot, although it appears at the bottom of the menu. See Dilemma 1 below for that detail.

Dilemma 1:
Grub2 has set up the boot menu so that Windows is the last item on the menu. This is because the Menuitem entries for the Ubuntu kernels are generated by script 10_linux, while the Windows Menuitem entry is generated by script 30_os-prober. Of course, in generating /boot/grub/grub.cfg, the 10_linux script is executed before 30_os-prober, dictating the order of their appearance on the menu.

I'd like to see Windows as the top menu item.

Under grub, I would edit /boot/grub/menu.lst, pull the Windows menu item out of the "Automagical" section and voila! It stays on top no matter how many times I upgrade the kernel. While I could possibly do the same with /boot/grub/grub.cfg (see thread "how can I change the order of the boot menu? (http://ubuntuforums.org/showthread.php?t=1480932)" for the suggestion) we should all know by now that the next time I update the kernel, my changes will all go away, because we are not supposed to edit that file by hand.

In my thread with Quackers, I suggested renaming 30_os-prober to 09_os_prober so that the Windows Menuitem should be generated before any of the Linux Menuitems. :twisted: Sounds dodgy to me (am I turning into a Brit? ;) ) but feasible.

Dilemma 2:
So, you thought I'd forgotten about that one, eh? Or did you forget I said there were two dilemmas? :evil:

As I download and install kernel updates, all the old kernels still show up on my boot menu. My concern is that eventually the sheer number of Linux kernels will render the boot menu unreadable. This is especially of concern if I cannot get Windows to the top of the boot menu.

Under grub, I used to edit the menu.lst and comment out the listing of any kernels more than 2 versions old.

Now, how do I arrange this omission?

A manual edit of 10_linux will be acceptable, provided it still displays the 2 or 3 most recent Linux kernels and their corresponding memtests.

I now yield the floor (it was beginning to crack anyway :rolleyes: ) to the gurus who were able to plough through all that and can provide suggestion.

Yup, "Concise" is my middle name... Not. (Hey! Be grateful I waived consecutive translation! 8-) )

Kidding aside, thanks much for advice here.

garvinrick4
November 29th, 2010, 05:44 AM
#Open Synaptic, type offending kernel in upper right window example: (2.6.32-24)
and right click and remove.
Grub2 - Community Ubuntu Documentation (https://help.ubuntu.com/community/Grub2#/etc/default/grub)

gksudo gedit /etc/default/grub

oldfred
November 29th, 2010, 05:50 AM
Yes you can renumber the scripts. Just be aware if updates occur, it may copy back the 30_osprober and you have double entries.

Some other alternatives:
Total Custom menu:
http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Custom_Menu
http://ubuntuforums.org/showthread.php?t=1483827

How to: Create a Customized GRUB2 Screen that is Maintenance Free.
http://ubuntuforums.org/showthread.php?t=1542338

OR Partial Custom menu:
I used drs305's command to limit ubuntu entries to two, turned off os_prober so it does not look for other systems and totally customized my 40_custom.
includes line to limit display to two, also hiding of windows recovery partition
Grub 2 Title Tweaks Thread -drs305 - Lots of good info here:
http://ubuntuforums.org/showthread.php?t=1287602
In /etc/default/grub I added this:
gksudo gedit /etc/default/grub
GRUB_DISABLE_OS_PROBER=true
or
sudo chmod a-x /etc/grub.d/30_os-prober

One way to fix the descriptions is to move the windows entries to 40_custom and edit at will.

Copy the windows entries from this:
gedit /boot/grub/grub.cfg
Copy them to and edit :
gksudo gedit /etc/grub.d/40_custom

You can copy everything into 40_custom and turn off all the scripts, but then you do not get the updates. But you can boot the most current kernel with this entry. (from Ranch Hand). Use the link in / to the most updated kernel. Change to your drive & partition.

menuentry "Most up to date on sda13" {
set root=(hd0,13)
linux /vmlinuz root=/dev/sda13 ro quiet splash
initrd /initrd.img
}

You can houseclean kernels.
Go to Synaptic Package Manager and search for linux-image.
More info in post #8
http://ubuntuforums.org/showthread.php?t=1283521
Some also say Computer Janitor, but I have also heard it can over houseclean things.

rpaskudniak
November 29th, 2010, 09:03 PM
Oldfred said:

Yes you can renumber the scripts. Just be aware if updates occur, it may copy back the 30_osprober and you have double entries.This I can deal with very well; it would be no worse than the way I used to handle the grub. Easier, in fact, because it's easier and safer to rename a file or two than to edit a file.

On the other hand, if I were to also install Fedora (unlikely at this point), then the renumbered os-prober would also list Fedora before the Ubuntu kernels. This would be a pragmatic, albeit imperfect, solution for now. When I next boot Ubuntu, I will look into your other solutions.

Thanks mucho!