We'll see | Matt Zimmerman

a potpourri of mirth and madness

Smooth sailing to GRUB 2

GRUB 2 is now the default for new installations of Ubuntu, but as explained in the announcement, existing GRUB 0.x systems won’t be automatically converted to GRUB 2.  This is because switching to a new PC boot loader is tricky business, and it’s generally best to leave it alone if it’s working.

Generally.

The main exception to this rule is, of course, the community of people who test the bleeding edge of Ubuntu development.  Yes, perhaps even you!  If you’re adventurous enough to be running Karmic in this early stage of its development, a little boot loader trouble wouldn’t kill you, would it?  What’s the worst that could happen?  You would have to boot from your handy Ubuntu USB drive, mount your root filesystem, and clean up the mess by hand.  Maybe it’s been a while since you had to recover your system in this way, and it would be good practice!

Thus, I convinced myself to make the switch to GRUB 2.  I wanted to be confident that Ubuntu 9.04 would continue to provide a great experience on my laptop for anyone installing it afresh.

It turns out, this is really easy to do, and not as risky as I thought: sudo apt-get install grub-pc

This will remove the grub 0.x package from your system, but don’t worry.  It stays installed in /boot/grub even though the package is removed. While it’s installing, the grub-pc package explains exactly what to expect, and gives you a choice of whether to preserve your existing setup by chain-loading GRUB 2 from the GRUB 0.x menu. This is the default, and is a good way to confirm that GRUB 2 works properly on your system before making the final leap.

It builds a new configuration for you in /boot/grub/grub.cfg, preserving a few key bits from the old /boot/grub/menu.lst. This takes a surprisingly long time (I suspect os-prober, which has always seemed curiously slow).

When it finished, I rebooted, let it start up with the defaults (not touching any keys), and everything came up fine. To seal the deal, I followed the instructions given earlier and ran: sudo upgrade-from-grub-legacy to install GRUB 2 in the MBR, replacing GRUB 0.x and rebooted again to test that.

Everything just worked.

Refer to the testing instructions for more details, and add your system to the list if you test it.

Advertisements

Written by Matt Zimmerman

June 21, 2009 at 16:49

Posted in Uncategorized

Tagged with ,

18 Responses

Subscribe to comments with RSS.

  1. So, grub2 should be able to replace rEFIt on macbooks too, right? If I install the PPC port of 9.10 on my G4, will it use grub2 instead of lilo or whatever?

    ethana2

    June 21, 2009 at 19:24

    • There is an EFI build available as well, but I don’t have any EFI systems myself, and so have no experience with it yet. I haven’t touched powerpc for years, and know even less about whether that’s supported in the current grub2.

      mdz

      June 21, 2009 at 22:31

    • There is grub-ieee1275 for powerpc machines using openfirmware. Last time I tried it the installation wasn’t as automatic as for grub-pc on my PC.
      And the PPC port has not switched to grub yet. It is still using yaboot.

      Onkar

      June 22, 2009 at 05:45

  2. OK. Did sudo apt-get install grub-pc to install. Converted to chain-loader as suggested. Rebooted. All is well.

    Went to execute second step, sudo upgrade-from-grub-legacy . Command not found. List of installed files for grub-pc package listed below. Which one is it?

    [file list, missing upgrade-from-grub-legacy, elided for brevity -mdz]

    djohnston

    June 21, 2009 at 21:11

    • Perhaps you aren’t running the same version that I am (this is current Karmic):

      perseus:[~] dpkg -S `which upgrade-from-grub-legacy`
      grub-pc: /usr/sbin/upgrade-from-grub-legacy
      perseus:[~] dpkg -s grub-pc |grep Version
      Version: 1.96+20090523-1ubuntu1

      mdz

      June 21, 2009 at 22:07

  3. darrel@Oz-e 04:33 PM~ $ dpkg -S `which upgrade-from-grub-legacy`
    dpkg-query: –search needs at least one file name pattern argument
    […snip… -mdz]

    djohnston

    June 21, 2009 at 22:37

    • My best guess is that you’re not running Karmic yet. If that’s not it, or if you need more help than this, please ask on one of the mailing lists, forums or IRC. These blog comments are not an ideal channel for this. :-)

      mdz

      June 21, 2009 at 22:46

      • Excusez-moi

        djohnston

        June 21, 2009 at 23:23

  4. hi all,
    Testing grub-pc since early may, i daily have various troubles on a fresh karmic install.
    The best, at time, is to wait at least next alpha, except for those like me who test and report bugs.

    dino99

    June 22, 2009 at 07:17

  5. […] Smooth sailing to GRUB 2 When it finished, I rebooted, let it start up with the defaults (not touching any keys), and everything came up fine. To seal the deal, I followed the instructions given earlier and ran: sudo upgrade-from-grub-legacy to install GRUB 2 in the MBR, replacing GRUB 0.x and rebooted again to test that. […]

  6. “I wanted to be confident that Ubuntu 9.04 would…”

    That should read 9.10, of course.

    Matt Zimmerman

    November 2, 2009 at 17:17

  7. I upgraded a (remote, no local access) debian box today. Grub 2 is in debian’s testing branch. So I installed grub2, I got the dialog box asking if I want to chain load for safety and I said yes. Then I got another box telling me to run ‘upgrade-from-grub-legacy’ if it boots successfully, the problem was ‘upgrade-from-grub-legacy’ was invisible on my screen so I had to google to get the text. But anyway it rebooted fine, I ran the command and tested reboot the 2nd time and again no problem, so it seems it is quite an easy process. The only real risk I can forsee is people with multiple drives accidently selecting the wrong one when it updates the MBR.

    Chris

    November 22, 2009 at 20:00

  8. […] GRUB 2 […]


Comments are closed.

%d bloggers like this: