June 24, 2009
This article was contributed by Koen Vervloesem
At the Ubuntu Developer Summit, some discussions took place about the
status of GRUB 2, and in early June Canonical's Colin Watson announced
that GRUB 2 would be the default boot loader for new Ubuntu installations,
starting with Ubuntu 9.10 scheduled for release later this year. GRUB 2
will replace GRUB, which has been used for many years for the task of
selecting different kernel images or other operating systems to boot from,
both in Ubuntu and other Linux distributions.
GRUB is the first thing a user sees after the computer's BIOS has
initialized the PC. In recent times Linux distributions have had the tendency to hide GRUB's menu, so one might wonder why users should care about it. Nevertheless, Ubuntu's switch to GRUB 2 will bring internationalization support, greater flexibility and many other improvements to the boot loader. As changing the boot loader is an inherently risky operation, upgrades from existing Ubuntu installations will not replace GRUB by GRUB 2.
Problems with legacy GRUB
Although GNU GRUB is used by virtually all Linux distributions, it has a couple of problems. First, official development for the most used version, called GRUB Legacy, was stopped. The developers still accept bug fixes but don't add new features. They have refocused on GRUB 2, a complete rewrite of the boot loader. This leaves Linux distributions with a maintenance problem, according to Watson in an email interview with your author:
By far the most pressing problem is that we have no upstream for GRUB Legacy; nobody's interested in it. The Debian GRUB maintainers are not especially interested in it either, and are planning to switch over as well. This means we have nobody to forward bugs to, unless we want to treat one of the forks maintained by other GNU/Linux distributions, e.g. Fedora, as effectively "upstream", which would mean figuring out all the stuff that's different between ours and theirs and what might regress.
Because the GRUB developers don't accept new features, each distribution has actually forked the package to add the features it needs. Ubuntu, for example, added support for UUIDs (a "Universally Unique Identifier" to identify a partition uniquely, even when the boot order and hence the name changes) and for the Ext4 file system. But this is not the preferred way to go, Watson admits:
We really don't want to be going it alone on the boot loader if we don't have to, and we think it's generally a net loss for lots of distributions to be maintaining separate boot loader forks for the rest of eternity. It's a lot of effort that we could be spending on something else, it doesn't serve our users very well, and it doesn't serve the free software community very well.
There are also a variety of technical problems without much hope of a good resolution. For example, the mapping of Linux device names to and from GRUB device names, which on a PC-class system ought to be derived from the BIOS boot order, has long been problematic. In principle the primary master hard disk is known to GRUB as hd0, but some BIOSes let the user configure the secondary master hard disk to become the first one to boot, which confuses GRUB. BIOS Enhanced Disk Drive (EDD) Specification support helps when it works, but hardware support for it is rather limited: BIOSes older than a few years don't have it and even newer BIOSes do not implement it consistently or completely. Ubuntu has papered over this with the use of UUIDs, but this only works for some parts of the boot chain. For example, it doesn't help GRUB find its own stage 1.5, the stage that understands a file system. Another problem is the format of the configuration file /boot/grub/menu.lst, which Watson describes as "a historical disaster".
New features of GRUB 2
So which problems would GRUB 2 solve? First, GRUB 2 adds built-in UUID support, so different distributions no longer have to maintain their own hacked-up versions for this. The boot loader has also refactored its multi-stage load process, which according to Watson "is likely to be less of a practical problem than the current load process". Stage 1.5 was eliminated.
Another change is the new configuration file format, which has been entirely overhauled. It has more extensive scripting support, with conditionals, loops, variables and functions, allowing the user to express some more complex booting logic. However, according to Watson this complexity doesn't make it more complex to use these features:
Changing, for example, the default boot options in /etc/default/grub is a matter of a one-line change (GRUB_CMDLINE_LINUX_DEFAULT) and running update-grub. While you could do this kind of thing with our GRUB Legacy packages too if you knew how they worked, it was very unconventional (you edited one part of the file, then ran update-grub to generate the rest of the file ...) and relatively few people discovered it successfully. We hope the more conventional layout here will be more discoverable.
Other interesting new features are the graphical boot menu, internationalization (including support for non-ASCII character codes, fonts and message catalogs like gettext), a modular framework and the possibility of dynamic loading of modules at run time. Beyond that, GRUB 2 also supports non-x86 platforms, such as PowerPC.
What will Ubuntu do with GRUB 2?
Now the question is what GRUB 2 will bring for Ubuntu's users. The more reliable configuration handling should let the developers do some more interesting things at the desktop level, which according to Watson have been difficult in practice before, "as inserting the right options ran a significant risk of stomping over people's local changes." One example he gives is to offer a straightforward interface to reboot into a specific operating system at the desktop level. The user doesn't have to first reboot and then pick that operating system from GRUB's boot menu.
The use of a graphical menu means that, in principle, distributions have a chance of integrating fairly smoothly with kernel mode setting even when a boot menu is displayed. Watson adds:
Whether we can entirely avoid a visible mode switch between the boot loader and the kernel is as yet unclear, but we should at least be able to make it a smoother transition than it is right now.
There's a Google Summer of Code project to add graphical menu support to GRUB 2, although it hasn't landed yet. Even though Ubuntu will be aiming for a so-called "quiet-by-default" boot loader, which doesn't show a boot menu by default, Watson expects from the sheer volume of requests that many Ubuntu users will be interested in a graphical boot menu that they can tweak with their own theme.
Why switch now?
The switch to GRUB 2 doesn't come out of the blue. According to Watson, Ubuntu has been keeping half an eye on GRUB 2 for some time:
I think it was first brought up as a possibility for Ubuntu 5.10, but it was just far too early. Anyone who's been watching GRUB 2 for some time will agree that there was a long period when development was very slow, focus was not as much on the common case as it should have been, and anything that might be usable in production looked a long way off.
This situation has changed considerably in recent times. The pace of development over the last year has picked up markedly, and there's now quite an active GRUB 2 community in place. Then, pressure to add proper support for things like EFI and boot menu internationalization in Ubuntu has been growing, so the developers thought they'd take the opportunity to have another look at the new boot loader:
We ran it through all the machines the Ubuntu kernel team could get their hands on (a respectable selection). The results from that were encouraging - in fact, I don't think there was a single failure on the hardware we had, although of course we probably had somewhat newer hardware than the average.
Ubuntu is not alone in this task. As Watson says, Debian makes a big difference to Ubuntu too:
The guts of our installer support for boot loaders is largely shared with Debian, and a lot of the work to integrate GRUB 2 has already been done there. The Debian GRUB maintainers are determined and confident to switch Debian over for Squeeze. As a Debian installer developer myself, I think it benefits both projects for Ubuntu to be up to date with current development efforts.
With all this in mind, the Ubuntu developers felt that switching over was much more feasible than they'd previously thought, and that the risk of there still being a couple of missing features was tolerable given the pace of upstream development. Watson considers the time ripe now for GRUB 2 in Ubuntu:
I think we've struck a reasonable balance between the risk of regressions and the risk of being a really conservative late adopter only to find that it doesn't work for us but everyone else is now totally reliant on it and scared to change it. The timing works out pretty well for us, as this gives us a couple of release cycles to get used to it before our next long-term-support release.
No switch to GRUB 2 in openSUSE 11.2
While Ubuntu is switching later this year, openSUSE currently has no plans to switch to GRUB 2 in its next release, version 11.2. Andreas Jaeger explains this:
Experience with GRUB and LILO showed that there are many subtle ways that can break and therefore a change will need really good testing. GRUB 2 is not released yet, and the latest alpha version was released more than a year ago - nothing that gives much confidence into the stability of the code and the interfaces from my perspective for the moment. However, I applaud Ubuntu for taking this risk - and in the same way helping to move GRUB 2 forward to a stable release.
Jaeger is right that GRUB 2 is not entirely ready. For example, some GRUB Legacy functionality isn't yet supported in GRUB 2: it doesn't have boot password support yet, and the savedefault functionality which saves the current menu entry as the default entry doesn't work properly.
According to Jaeger, the openSUSE developers have so far not received a single request to move to GRUB 2. But if somebody volunteers to maintain the package and integrate it in openSUSE, he welcomes it to give it some testing and then decide if it can be used for future releases. He adds that support for GRUB 2 doesn't mean only a new package, but also changes the way the boot loader setup is automatically generated by openSUSE's system management tool YaST.
Fedora
The Fedora developers also have no concrete plans to use GRUB 2 as their default boot loader. However, Fedora's GRUB 2 maintainer Lubomir Rintel sees the current situation with GRUB clearly as unsatisfactory:
What I see as a big problem with legacy GRUB is that currently inactive former upstream failed to provide a single place for GRUB users (distributions) to cooperate and share fixes, declaring the project dead long before any viable alternative existed. On top of that, distributions somehow failed to cooperate either, virtually each of them having its own fork of GRUB with unique features (ext4 support, EFI, bugfixes, ...)
GRUB Legacy has posed some real problems for Fedora. For example, the support for Ext4 didn't land in the version shipped with Fedora 11, because the patches weren't ready in time for the beta. This means that Fedora 11 users can't boot from an Ext4 file system, something that is possible in Ubuntu 9.04.
Rintel sees the active upstream community of GRUB 2 as a nice advantage, especially now that Ubuntu is going to use it. He expects the community around it to grow and the quality of the GRUB 2 code to increase rapidly, increasing chances of inclusion in other distributions, including Fedora. In the meantime, he will ensure that GRUB 2 is up-to-date with upstream code and easily installable for anyone interested in using it in Fedora. The short runway for Fedora 12 means that there's really not that much time to get GRUB 2 in shape for Fedora's next release, but according to Fedora's wiki the integration is planned for Fedora 13.
With respect to the technical qualities of GRUB 2, Rintel is mostly impressed about GRUB 2's modular architecture. He calls other features such as the graphics subsystem with mouse support capable of rendering antialiased Unicode glyphs "hardly things that would convince anyone to switch to GRUB 2".
An interesting adventure
It remains to be seen which hurdles Ubuntu has to take for the switch from the stable legacy GRUB to the new GRUB 2. Adventurous Ubuntu users can already test GRUB 2 in Jaunty Jackalope and are invited to report any bugs. If this experiment turns out successfully, other distributions could very well follow Ubuntu's lead.
(
Log in to post comments)