Workaround the Grub installation issue in Debian Wheezy

Debian logoThe current testing version of Debian, aka Wheezy, contains a rather annoying bug that prevents the installation of Grub, the multi-OS bootstrapper of Linux. Although this bug will be corrected at some point in the possibly near future, it is already present for a few months, making life harder for the fresh installations. The traditional workaround in order to install Debian Testing is to install a stable version (Squeeze) and then modify your mirrors to upgrade it to a testing version. In this way Grub will be installed correctly. However, if you have encountered the Grub issue, this means you have already completed your install from a broken edition (if you encounter the issue but you haven’t completed the install yet, just finish it in a clean way without a bootloader, and then continue reading here). So, maybe you don’t want to download a new ISO image, burn a new DVD or write a new USB key with it, and then restart the installation process from scratch. The other solution is then to keep the installation that you have just done and to setup the installation of Grub from the stable mirrors. It’s quite straightforward once you know how to do this.

First you need to boot your fresh installation. In order to do this, you can use any valid Debian bootable media, like for example the media you have used to do your installation. In the boot menu, you should select ‘Advanced Options’ and then the ‘Rescue Mode’. This will launch a recovery shell as root user (be careful). In the following screens, select the root partition where Debian is installed in order to mount it (mountpoint /).

The first thing to do now is to make sure the network is started and accessible. You can try a ping debian.org.

Next, use vi to modify the /etc/apt/sources.list file. Make sure the installation media (CD, DVD, USB, etc.) is commented out and replace ‘wheezy’ by ‘squeeze’ in the lines where the networked mirrors are specified (lines starting with deb and deb-src followed by a URL, do not modify the ones that contain the URL for the security patches). Save, quit the editor and update aptitude in order to apply the changes: aptitude update. Now you can download the grub-pc package from the Squeeze mirrors: aptitude install grub-pc. During the install process, you will be asked the partition where you want to get it installed. When this is finished, run update-grub in order to be sure the configuration files are correctly generated. This last step is probably not necessary, but let’s play it on the safe way just in case.

Now, you can remove your bootable media and cleanly reboot the computer: shutdown now -r. It should restart fine.

The next thing to do, as root, is to modify back the /etc/apt/sources.list file with ‘wheezy’ instead of ‘squeeze’ and launch again the command aptitude update to apply the change.

Advertisements

About nidget

Technology enthousiast, Java and JEE expert, IT architect.
This entry was posted in Tips and tricks and tagged , , , . Bookmark the permalink.

14 Responses to Workaround the Grub installation issue in Debian Wheezy

  1. zenlord911 says:

    I’m a little confused. On debian lenny, ‘grub’ = ‘grub 2’ and not ‘grub-legacy’. Is this situation the same with debian wheezy, because if it is not, it would suffise to install grub2 in another terminal after the installation has finished but before rebooting.

    Anyways, thank you for the work-around.

  2. andina says:

    I have tried 10 different attempts to install debian amd64 via a usb netinstaller and I get this lousy bug every single time. However since I have used the USB and not the CD installation media there is no option of ADVANCED OPTIONS at the start of the booting. I have of course failed to install debian now and am at the stage of finish the installation without the boot loader. Any ideas please?

    • nidget says:

      Are you using the mini.iso image file?
      If yes, you should see the “Advanced Options” item.
      If not, you can probably do it too from a live Debian distro: http://live.debian.net/

      • andina says:

        thanks nidget
        I have used UNetbootin an MS application which automatically creates a USB netinstaller which definitely does not include any options.Is there any way I can create a USB disk (dont have a dvd rom on my proliant server) for the live debian?

      • nidget says:

        I have tried UNetbootin with the standard netinst CD image that I have retrieved from here “http://cdimage.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso” and I have managed to get a root prompt in two different ways, either by launching the normal install from the UNetbootin menu and pressing the ‘escape’ key until I get into the menu with all the installation steps – there there is a menu item to launch a root prompt, either (more direct) by selecting “Expert Install” directly from the UNetbootin menu.

        I hope this helps you.

  3. andina says:

    problem is that the “execute a shell” choice allows to execute some commands in root prompt albeit very restricted ones. For instance you cannot use the ping command nor the grub-install command or the apt command. It is pretty much a useless shell unless I am missing something.

  4. topcat says:

    I had the same frustrating GRUB failure problem with a USB installation but was able to fix it using the tip/workaround provided here: http://forums.debian.net/viewtopic.php?f=17&t=80884

    In summary, when you get to the failing GRUB bit of the install, switch to the (braindead) ash shell and run:

    for d in dev proc sys; do mount –bind /$d /target/$d; done

    Then switch back to the GRUB install and this time it will work (although I had to specify the device in the /dev/xxxx format, not as (xxxx))

  5. andina says:

    thanks topcat, will most certainly try this

  6. Biochemistry says:

    Following the best answer to Installation->grub-pc->target problem. It do not require complex reboot and commandline
    1) when asked for language->click “back”
    2) select debconf priority low (from lower part of main menu)
    3) select each step one by one from top
    4) Bypass “Configure installation source” (just above Grub installation entry) – this is the problem source when no internet available. It makes installer forget local repository
    5)Install grub and go to last
    In short, omit configuring software source(just above Grub installation entry)

  7. kf4pi says:

    What i did to solve the grub issue, was go into the bios and turn off my network card, next unplug my wireless card, the do the graphics install, and no problems with the grub… i had tryed 2 times with the live cd and usb install, think the network is screwing up the install with the live cd…

  8. Eddie G. says:

    This is great advice except for one thing. I have no Internet connection where I am, I’m working off a laptop which doesn’t have connectivity. SO how do I install a grub package with no internet? I wish this problem would resolve itself soon, I have ot make the pitch for Debian Servers and this glitch isn’t helping me at all. (Sigh!) guess I’ll just have to head over to CEntOS/Scientific Linux territory until things settle down over here…..oh well….at least I have SOMETHING to use!

    • nidget says:

      Eddie, do you install Debian Wheezy in 2016 ? This version is obsolete. Anyway, you can download the latest grub-legacy deb file with another computer and install it with the command dpkg -i grub-legacy_x.y-z_i386.deb as root.

      • knighthawk5193 says:

        Thanks Nidget! I’ll have to trry this out when I get back to the home office. If this works then everything should be fine from here on in. And I didn’t use Debian Wheezy, it was “Jessie” and I used an .iso file I got from the Debian web-page. Just figured that would be something they would include on the CD/DVD .iso files…maybe not? And why WOULDN’T that be included? seeing as how without it the system would be un-installable?

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