GRUB2 experiences with Ubuntu 9.10 (Karmic Koala)

September 4, 2009 by Resa
Filed under: Linux, Ubuntu 

Since the early Alpha releases of Ubuntu 9.10 (Karmic Koala) I have tried this release in VirtualBox, on a PIII and it has become the main distribution on my “new” desktop after the “upgrade“.

One of the new features of Karmic Koala is that it uses GRUB2 by default. In this post I like to share some experiences that I have had with GRUB2, particularly since I multiboot with variousĀ  Linux distributions.

A major change is the fact that the file /boot/grub/menu.lst, probably known to many who have used multibooting, does no longer exist. This file is basically replaced by two new files:

  • /etc/default/grub: A file that contains – as the name indicates – the default settings when grub is updated
  • /boot/grub/grub.cfg: Best described as the replacement of the “old” menu.lst file.

The content of my default file, which I modified slightly, is currently as follows
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"

I have not “played” around much with the various default settings, but what I did remove is the “quiet” option from the GRUB_CMDLINE_LINUX_DEFAULT statement. Something that I also did with the “old” grub, simply because I like to see what is happening during boot up.

The grub.cfg file may look a bit unusual when seen for the the first time, but a second look will show that it has quite a logical setup and when used to it, an easy understandable format.
Personally I found the explanation as provided in the edubuntu wiki very clear and easy understandable. Of course also information can be found on the GNU GRUB site and the GRUB wiki.

Simply put the grub.cfg file consists of several, numbered sections. The header (00) which basically contains the settings from the default file, followed by theme section (05) for setting back- and foreground colors. After this there are four sections containing the information about the distributions installed.

  • Section 10, containing the kernels based on the lsb_release -i -s command.
  • Section 20 containing the memtest provided that the file /boot/memtest86+ exists.
  • Section 30 containing the result of the search for other OS’s and
  • Section 40 containing custom commands.

With the “old” GRUB I mostly made use, when multibooting, of the chainloader. This prevented that I had to update the menu.lst file each time a new kernel was installed in one of the other distros. However, based on what I have read about GRUB2 I have not used the chainloader now (yet) and make use of the detection mechanism. Until now I have installed two additional distributions, Dreamlinux 3.5 and CentOS 5.3. Each of these distributions are installed on a separate partition WITHOUT GRUB!

Does the detection for these two distributions work flawlessly? Not entirely, but personally the things that do not work perfect (yet) are easily overcome. So what have I noticed? The section 30 that is generated after the command sudo update-grub is as follows:
menuentry "Debian GNU/Linux (5.0.2) (on /dev/sda5)" {
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set e7912a23-cc28-4d98-984a-704930df3296
linux /boot/vmlinuz-2.6.28.5-1-i686-dream root=/dev/sda5
initrd /boot/initrd.img-2.6.28.5-1-i686-dream
}
menuentry "CentOS release 5.3 (Final) (on /dev/sda6)" {
insmod ext2
set root=(hd0,6)
search --no-floppy --fs-uuid --set 4870fcd7-5b5b-4276-97ee-a8134dd68e2a
linux /boot/vmlinuz-2.6.18-128.el5 root=/dev/sda6
}

The fact that Dreamlinux is not recognized as Dreamlinux is not to be blamed on GRUB since the release is still recognized as Debian Lenny, the base on which Dreamlinux is built.

What is an issue is the fact that for both Dreamlinux and CentOS the root is indicated as /dev/sdaX, however both require the option to be /dev/hdaX. Maybe this can be overcome, but I have not yet had the time to investigate this in detail and currently simply fix this by editing the grub.cfg file.

Another issue that arises is the fact that for CentOS the initrd line is completely lacking. Also the cause for this is until now still unknown for me and will require some investigation on my part. But also this can be easily fixed by manually adding the initrd line.

One thing that is to be noted is the fact that by default the grub.cfg file can not be edited. Thus, in order to enable editing, the following command is required
sudo chmod 644 /boot/grub/grub.cfg

After this the file can be edited using a text editor or, if preferable, a terminal editor like nano.
Enabling writing to the grub.cfg is also not a permanent setting. Each time grub is upgraded the setting will be back to read only. So, if you can not edit the grub.cfg file, please check the rights.

For reference, after editing the grub.cfg file, section 30 for me looks like this:
menuentry "Dreamlinux 3.5 XFCE (on /dev/sda5)" {
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set e7912a23-cc28-4d98-984a-704930df3296
linux /boot/vmlinuz-2.6.28.5-1-i686-dream root=/dev/hda5 ro splash
initrd /boot/initrd.img-2.6.28.5-1-i686-dream
}
menuentry "CentOS release 5.3 (Final) (on /dev/sda6)" {
insmod ext2
set root=(hd0,6)
search --no-floppy --fs-uuid --set 4870fcd7-5b5b-4276-97ee-a8134dd68e2a
linux /boot/vmlinuz-2.6.18-128.7.1.el5 root=/dev/hda6 ro splash
initrd /boot/initrd-2.6.18-128.7.1.el5.img
}

Concluding, I am impressed with the detection mechanism although it contains (for me) still some minor flaws but nothing that can be easily overcome. Feel free to comment your experiences or … if you have solutions to the issues I have encountered so far.

delicious | digg | reddit | facebook | technorati | stumbleupon | chatintamil

Comments

2 Comments on GRUB2 experiences with Ubuntu 9.10 (Karmic Koala)

  1. david on Thu, 5th Nov 2009 17:57
  2. Hi, Resa,

    Thank you for your post on GRUB2 with a real-life example, as well as the pointers to the documentation. I’m not yet using GRUB2 but am considering whether to install a new distro which does use it as the default bootloader. So I’m trying to do some research / homework first …

    It sounds like it is a step into the Brave New World — especially for those people who multiboot Linux. GRUB2 + KDE 4.x (which I haven’t experimented with yet) increases the initial learning curve. But development is headed in this direction, so I guess we need to adapt as users.

    In case you (or anyone else) is interested, today I came across a very thorough post on GRUB2 in the JustLinux Forum:

    http://www.justlinux.com/forum/showthread.php?t=152790
    Saikee. “How to use Grub2 to boot Linux manually.” 7 Sept. 2009.

    Met vriendlijke groeten,
    =david

  3. Resa on Thu, 5th Nov 2009 18:40
  4. Hi David,
    Thank you for your kind comments.
    On my blog I try to mention as much as possible experiences I had with distros, installs and/or software packages. Partially to help others and — to be honest — partially also for my own reference. ;)

    Furthermore thank you for the link, always good to have some additional reference.

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!