The grand unified bootloader (grub) not being updated since 2006 Canonical announced to release the next Ubuntu version 9.10 - also known as “Karmic Koala” - with grub2 as the default boot manager. Of course I got curious and as I read an article in c’t about this topic I had to see what grub2 was about!
If you’re running Ubuntu 9.04 Jaunty it’s quite easy to switch to grub2. However, if you installed Jaunty to boot from an ext4 partition you’re likely to have grub2 installed already.
There is a nice howto which explains installing grub2 in Jaunty at Ubuntu’s wiki here. If you follow the instructions, grub2 will end up in your boot partition (not the MBR) first and a new entry to your old grub is added, giving you the chance to boot grub2 via chainloader. You are advised to follow these instructions, because if grub2 doesn’t work for you, you’re still able to boot with grub. However, I decided skip this step and installed grub2 straight to MBR.
CAUTION: fiddling around with the bootmanager may leave you’re system unbootable!! If you don’t know how to recover from such a state, please don’t do it!
So, this is how it worked out for me with Ubuntu Jaunty (I guess this would work with Debian squeeze/sid also, but haven’t tried) on my desktop PC: Install grub2 via
You’ll will be asked if you want to start grub2 by chainloading it via the old grub - I opted for “NO” (again: do this at your own risk!! If something goes wrong, you need to boot from CD, USB stick or whatever and repair the MBR!!). Next, you’re prompted for the “kopt” line of your old “/boot/grub/menu.lst”. In my case it was completely empty, so I took a look at my menu.lst file and copied the kopt-line over. It should look something like this:
root=UUID=XXXXXXXXXXXXXXXXXXXXXXXX ro quiet
Now activate grub2 by
That was basically it. You may now remove all “
menu.lst” files from
/boot/grub, which are not needed anymore.
Now for the tweaking! :-)
The new config file for grub2 is
/boot/grub/grub.cfg, which is generated by running
Editing this file manually is not recommended and by the way useless, as it’s being regenerated every time there is kernel-update by
update-grub. So, how can we change grub2’s default settings? Basically there seem to be two locations/files we should take a closer look at:
To change the timeout until grub boots the default entry or to change the default entry itself, edit
In this case, the default boot entry would be the first in the list (0) and the timeout until booting it - if no key is pressed - is 15 seconds. The next time you run
update-grub those settings will be written to
As I don’t want to have the ‘memtest’ entries in grub’s list, I removed the execution bit from
By the way, if you take a look at
/boot/grub/grub.cfg, you can see which script in
/etc/grub.d/ is responsible for which entry. By removing the execution bit,
update-grub can’t execute it and thus can’t write then menu entries for ‘memtest’.
To change screen resolution of grub2, edit
/etc/grub.d/00_header, search for “
set gfxmode=640x480” and change it as you like. I tried
800x600, finding that the latter was a bit faster to display grub.
The last thing I wanted was a background image. I created a 800x600 png image file, a new directory
/boot/grub/images and dropped the image there. To make it display at boot edit
/etc/grub.d/05_debian_theme. Find the line (should be line 16)
for i in XXXXX ; do
and change it to something like this
for i in /boot/grub/images/background.png ; do
It is also recommended to change the text color of the highlighted entry to something else but “magenta”… This is done in line 40 (as you can see I changed it to “white”):
Now, don’t forget to run
cross fingers and reboot!
I found - at least with background image enabled and 800x600 screen resolution - grub2 is slower in starting up compared to grub. Besides that, no difference to the old grub. OK, it looks better! But the big thing about grub2 is it’s capability to boot directly from lvm or raid devices without the need of a separate
/boot partition (haven’t testet that, though).