CQuirke’s Long View

Long lead times need long forward planning

Archive for November, 2009

Edit grub Menu In Ubuntu 9.10 and Older

Posted by cquirke on 20 November 2009

Technorati tags: , ,

Windows users who install Ubuntu as a dual boot installation to try it out, will usually want their PCs to boot into Windows by default.  Ubuntu makes this possible, but not easy; it’s a major “paper cut” to address.

Ubuntu 9.04 and older

Before Ubuntu 9.10, you would start a Terminal session and do this:

cd /boot/grub
sudo chmod 666 menu.lst
gedit menu.lst
sudo chmod 644 menu.lst

You can set an explicit default boot entry, but I prefer to leave grub to boot the first entry as it does by default, but make that first entry the one I want.

So, when editing the menu.lst file, I usually cut the entry at the end of the file that launches Windows, and paste it into the top of the section that defines the boot menu entries.  I then rename the displayed text from something horrible like “Microsoft Operating System” to what I want, e.g. “Windows 7 Pro 64”.  Then I page down and delete the redundant do-nothing “Other Operating Systems” entry at the end.

Ubuntu 9.10 with grub 2

Ubuntu 9.10 uses a newer version of grub that works differently; do this:

cd /etc/default
sudo chmod 666 grub
gedit grub
sudo chmod 644 grub
sudo update-grub

You can’t edit the menu text that will be displayed in the boot menu anymore, because the new grub version doesn’t use your setting file directly.  Instead, it builds a new internal “don’t edit this” settings file that combines your settings with what it detects – and the menu entry text is built from what it detects, not your settings.  The update-grub command is needed to force a new build of the internal settings file.

When I edit the grub file, I don’t try to specify which boot menu entry to use by default, nor re-arrange the order of these entries with my choice at the top.  Because update-grub spawns a new menu that may differ from what is in effect as I edit the grub file, the first approach could misfire, and the second approach won’t work.

Instead, I use a new “saved” value for the “default” setting, which has the happy effect of defaulting to whatever the user chose last time.

But by default, the grub boot menu is not displayed, so I change entry to force it to be displayed, and set the timeout value after which the default kicks in:

GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT="20"

Alert!

If you dual-boot Ubuntu (or similar, using grub) and Windows, have multiple Windows-visible partitions, and use WAIK or OPK imaging tools (WinPE, ImageX) then there’s a serious bum-biting trap waiting for you – not so much a bug, as a natural consequence of how grub works.

Posted in Linux | 2 Comments »

Edit grub Menu In Ubuntu 9.10 and Older

Posted by cquirke on 20 November 2009

Technorati tags: , ,

Windows users who install Ubuntu as a dual boot installation to try it out, will usually want their PCs to boot into Windows by default.  Ubuntu makes this possible, but not easy; it’s a major “paper cut” to address.

Ubuntu 9.04 and older

Before Ubuntu 9.10, you would start a Terminal session and do this:

cd /boot/grub
sudo chmod 666 menu.lst
gedit menu.lst
sudo chmod 644 menu.lst

You can set an explicit default boot entry, but I prefer to leave grub to boot the first entry as it does by default, but make that first entry the one I want.

So, when editing the menu.lst file, I usually cut the entry at the end of the file that launches Windows, and paste it into the top of the section that defines the boot menu entries.  I then rename the displayed text from something horrible like “Microsoft Operating System” to what I want, e.g. “Windows 7 Pro 64”.  Then I page down and delete the redundant do-nothing “Other Operating Systems” entry at the end.

Ubuntu 9.10 with grub 2

Ubuntu 9.10 uses a newer version of grub that works differently; do this:

cd /etc/default
sudo chmod 666 grub
gedit grub
sudo chmod 644 grub
sudo update-grub

You can’t edit the menu text that will be displayed in the boot menu anymore, because the new grub version doesn’t use your setting file directly.  Instead, it builds a new internal “don’t edit this” settings file that combines your settings with what it detects – and the menu entry text is built from what it detects, not your settings.  The update-grub command is needed to force a new build of the internal settings file.

When I edit the grub file, I don’t try to specify which boot menu entry to use by default, nor re-arrange the order of these entries with my choice at the top.  Because update-grub spawns a new menu that may differ from what is in effect as I edit the grub file, the first approach could misfire, and the second approach won’t work.

Instead, I use a new “saved” value for the “default” setting, which has the happy effect of defaulting to whatever the user chose last time.

But by default, the grub boot menu is not displayed, so I change entry to force it to be displayed, and set the timeout value after which the default kicks in:

GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT="20"

Alert!

If you dual-boot Ubuntu (or similar, using grub) and Windows, have multiple Windows-visible partitions, and use WAIK or OPK imaging tools (WinPE, ImageX) then there’s a serious bum-biting trap waiting for you – not so much a bug, as a natural consequence of how grub works.

Posted in Linux | 4 Comments »