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!

Advertisements

19 responses to this post.

  1. Posted by Luya Tshimbalanga on November 15, 2011 at 10:57 pm

    Would you mind to write that tutorial on Fedora Project Wiki? Thanks.

    Reply

    • You are right. I’m not sure exactly where in the wiki should such tutorials exist, but I’ll try to figure it out. Actually, each time I decide to write a documentation on Fedora Project Wiki I get confused and give up. It seems to be related to its Documentation project, but it is not very clear about where to write it and which categories to use… it would be nice if someone can write a simple tutorial about creating documentation in Fedora Project Wiki which doesn’t need hopping from one link to another! 😀

      Reply

    • Hmmm… I’m not sure. It could be added to the repositories but doesn’t seem to be a suitable option to be used by default. And since grub 2 already supports themes, I’m not sure if there will be much interest in using it, specially since it seems to not be a very active project.

      Reply

      • It is actually active, active enough to be the default for Chakra (see http://www.linuxbsdos.com/2011/11/11/chakra-edn-2011-11-review/).

        Word on the street says it’s going to be the default for Ubuntu soon.

      • About the activity. As far as I can see the latest release of BURG happened more than 1 year ago and the source repository is not changed too. This means that it is already behind Grub 2. In that time, grub 2 didn’t support themes but currently it does. It might not be as flexible as BURG, but it is NOT what most people care about. Less bugs and more features for booting OSes is much more important than visual design.

        BTW, it would be great if someone can compare these two. Personally I think it would not be easy to convince Fedora to switch over BURG.

  2. Posted by mether on November 16, 2011 at 5:01 pm

    Well, if wiki is confusing, you can ask a question and answer it yourself in Ask Fedora. It is a way of creating documentation

    Reply

    • Really? I mean I wonder if that would be more accessible and organized than a blog post like this. Is Ask Fedora really a good place to write documentation? A good thing about wiki is that it can be more organized and be updated and extended as time passes. Arch and Gentoo wikis are good examples of accessible documentation (I should admit that I have always found them using google though).

      Reply

      • Posted by mether on November 16, 2011 at 5:49 pm

        Accessible, yes because it is part of fedoraproject.org, it has a higher relevance in search results. much higher infact and unlike a blog post, can be collectively edited and in fact, if you can mark it is a wiki answer when you post it, it functions like one. Also unlike the wiki, anyone with a openid will be able to login and post comments or edit. So yes, I think it can work very well for documentation.

      • Thanks for your explanation. 🙂

    • I found that Fedora has a related page too:
      http://fedoraproject.org/wiki/Grub2

      I found it using google. Unfortunately, you can not find such guides by navigating Fedora wiki. It would be nice if a user can easily find links to such pages in the wiki.

      Reply

      • Posted by mether on November 16, 2011 at 5:51 pm

        Yes, GRUB2 has a wiki page which was created in response to a discussion in the Fedora test list by me and I have edited it as well but participation in such documents is very low. Usually one person has to write everything.

      • Posted by Anonymous on November 18, 2011 at 3:42 am

        I agree about your search point, it’s not only this wiki, but most wiki’s searches is absolutely useless. Missing 1 letter, replacing e with i , adding space would mean you would get nothing. Google as u said is the solution.

        And it really awesome that grub2 supports UTF-8 BiDi 🙂

        Thx for the post brother 🙂

      • You’re welcome! 🙂

  3. Posted by mether on November 16, 2011 at 5:25 pm

    BURG is not a serious choice. It is a vanity fork that is going nowhere. Every distribution will choose GRUB2.

    Reply

  4. Hey, it’s mostly my fault Fedora 16 shipped without a graphic for GRUB 2… I had a very difficult time figuring out how to make it work, made several attempts, and decided to work on other graphics instead.

    This write up you’ve done here will be very useful for to make one for Fedora 17, so thank you very much. It’s great!

    Reply

    • 🙂 I think that’s fine for the first version. Currently I’m playing with grub 2 themes. If there are no objections to providing a graphical boot experience, we can try to prepare an interesting theme for Fedora 17’s grub 2. I’m not an artist but I think I can help with the technical parts for implementing a selected mock-up for grub 2 theme. Hopefully, I’ll write a new post about grub 2 themes soon.

      Reply

  5. […] received some love from the artwork team and you’ll see a graphical Grub2 menu rather than the black and white text menu of previous […]

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: