Posts Tagged ‘grub2’

Grub 2

As I noted in the previous post, Fedora 16 now uses Grub 2 on some architectures. Thanks to this, one of my long standing bug reports against grub2 in Fedora is finally fixed (all it needed was to add os-prober dependency to grub2 which, unfortunately, was unnoticed for a long time). The other bug, which is also very easy to fix, is unfortunately not solved yet… (sorry, but I’m really disappointed to see this bug is still open).
Grub 2 comes with a number of interesting features. One of them is auto-detecting other installed OSes using os-prober (as I have written here, you can do the same for Legacy Grub using my script). This means that now Fedora will detect other installed OSes when installed… well, not completely. Currently, Fedora doesn’t recognize OSes installed on LVM partitions during the installation (apparently because LVM volumes are not active when it is run). Therefore, you should run grub2-mkconfig again after Fedora 16 installation if you have any OSes installed on LVM partitions. Also, there is another problem with os-prober itself: it doesn’t recognize OSes installed on MD RAID partitions. The bug, with the possible fix, is reported upstream and I hope to see it fixed soon too.

Unfortunately, Grub 2 in Fedora doesn’t come with any artwork. You’ll see an ugly black and white grub menu (I never liked the look of Grub2 in Ubuntu and I hoped that it won’t happen in Fedora too). Hopefully, it’ll be fixed soon; but for the time being you can do it yourself. With the pointers given here (Hey! Ask Fedora is also officially launched!), I came up with the following:
First, you should create a font file for Grub 2 using any TTF fonts. I did the following:

grub2-mkfont --output=/boot/grub2/unicode.pf2 \
           /usr/share/fonts/dejavu/DejaVuSansMono.ttf

Then, you need appropriate settings in /etc/default/grub:

GRUB_GFXMODE=1024x768x32
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_BACKGROUND=/usr/share/backgrounds/verne/default/normalish/verne.png

 

Yes, it sets the default Fedora 16 background for Grub and it automatically scales the image to the Grub’s resolution! Finally, don’t forget to regenerate your grub’s config file (remember that the following command completely overwrites the existing config. Therefore, if you have manually edited /boot/grub2/grub.cfg all of your changes will be overwritten by it):

grub2-mkconfig -o /boot/grub2/grub.cfg

 

A part of the result is given below (for whatever reason (see Update 2 for the reason and the fix!), grub 2 selects a very high resolution in qemu, so I was forced to crop the image):

A sample image of Grub 2 with Fedora 16 background and BiDi (Persian) Text

Grub 2 with Fedora 16 background and BiDi (Persian) Text

And yes, Grub 2 supports UTF-8 BiDi (right-to-left) text automatically (It’d be great if it was also possible to right align the menu entries, but apparently it is not supported). And notice that you should use qxl or vmware vga driver for qemu if you are using Grub 2’s graphical menu.

This is just the begining, and I’m at the beginning too! Grub 2 supports themes, and I hope to see great themes for Fedora. A Fedora theme for grub 2, along with a new Plymouth theme (which has not been changed for a long time) could be very interesting for Fedora 17…

Update: I forgot to say that since Grub 2 can be installed on an LVM partition, you no longer need to have a separate /boot partition in LVM setups. While anaconda still suggests that, you are not forced to do so.

Update 2: Use lower case ‘x’ in GFXMODE variable. Initially I used upper case X so it was actually ignored!