CQuirke’s Long View

Long lead times need long forward planning

Archive for May, 2010

Ubuntu grub 2 Boot Menu – Extra Wrinkle

Posted by cquirke on 22 May 2010

Ubuntu 9.10 and later (as of writing this, 10.04 LTS) use grub 2 as the boot manager, which differs substantially from the original grub used previously. You may have heard that Linux uses editable text rather than inscrutible binary files to configure the system; in this respect, grub 2 is a step backwards.

In the original grub, you’d edit the menu.lst file and grub would respect this; in grub 2, grub will build its own configuration file (overwriting your settings) and all you can do is shake the table via an editable file called grub, and hope grub 2 will build your “control” into the actual control file it spawns.

This previous post covers those differences and how to work with each, but misses one detail; the need for yet another setting so that what you thought GRUB_DEFAULT=saved would do, actually works. Without this setting, you have to explicitly set the default boot entry you want to be “saved”; with this setting, it will take your previously booted choice as the current default.

So, if you want to display the boot menu for 20 seconds and default to what you’d selected previously, then this is how your grub settings should look:


Background: GRUB_DEFAULT can take one of three types of parameter; the ordinal number of the boot menu entry, a full and exactly matching text string for that entry, or the keyword “saved”, as used above.

Whenever grub 2 detects relevant changes to the system, it rebuilds the boot menu, padding it out from the top. Linux comes first (of course) so all your other OSs trail at the end, and as the menu gets longer, so the ordinal number gets bumped up.

So trying to set (say) Windows 7 as the default entry via explicit ordinal number, is inherently doomed; that’s why the “saved” value becomes so important. But unless you add the GRUB_SAVEDEFAULT=true setting, it’s as useless as an explicit selection, because the ordinal number used by the grub-set-default command will point to the wrong entry after grub 2 rebuilds the boot menu.

That can happen sooner than you think; Ubuntu 10.04 has just been released, yet already there are over 70M of updates, including a new kernel that spawns two new boot menu entries after the updates are applied.

The pages I found that document all of this, are here, here and here.

Technorati : , ,
Del.icio.us : , ,


Posted in Linux | Tagged: , , | 1 Comment »