Easy (enough) recovery from Debian Testing installer’s failure to install grub during setup

Went to install Debian Testing (Wheezy) on my shiny new Dell Latitude E6520, but the installer sadly choked during GRUB install:

GRUB installation failed

The 'grub-pc' package failed to install into /target/. Without the GRUB boot loader, the insalled system will not boot.

This of course left me an unbootable system since it also screwed up the existing GRUB installation so I couldn't boot Ubuntu I had previously installed on another partitition.

Recovery though was easy enough and could be done with the installation media.

There's more than one way to skin this cat, but here's how I did it. Chose "Continue" upon receiving the GRUB installation failure message, then selected "Continue without boot loader" from the Debian installer main menu. Noted the partition in the notice that followed (root=/dev/sda2). Hit "Continue" or "Next" (forget which) then once installer reported that installation was finished, rebooted.

Booted to the installation disk again, but instead of "Install", chose "Advanced options" > "Rescue mode". Answered the questions, then chose the partition Debian was installed onto (in my case, "root=/dev/sda2"). Selected "Execute a shell in /dev/sda2".

This dropped me into an ugly shell (what? no autocomplete? I'm so spoiled..). Anyway, could ping debian.org, but aptitude didn't work (e.g. aptitude search couldn't find GRUB). This is because no repository was configured. Ran "nano /etc/apt/sources.list" (because I'm used to vim and get lost in vi) and added:

deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free

Saved the file, now can install GRUB:

aptitude update
aptitude install grub-pc

Package configuration screen asked where to install GRUB, chose "/dev/sda". Installation was successful, it generated GRUB.cfg, found the Wheezy kernel and initrd (2.6.38-2-amd64) and even found the Ubuntu installation on /dev/sda3. Great.

Upon reboot, got the lovely GRUB screen, booted into Debian, but had a very basic system. To get Gnome, ran:

tasksel install gnome-desktop --new-install

Rebooted, got the GNOME login, but keyboard and mouse didn't work. WTF? The solution was simply to hookup an external keyboard/mouse, fire up the shell, and:

rm -rf /run

And reboot once more. Nice, a working keyboard/mouse (again, what a freakin princess). Now on to installing the Nvidia driver since testing repo didn't have a recent enough driver this NVS 4200m card required. Install steps were the same as for Ubuntu.

Fortunately, Wheezy's kernel was new enough that wired Ethernet adapter worked out of the box (unlike Ubuntu 10.04 LTS Lucid).

Though unlike Ubuntu, I did have to install the nonfree firmware to get the wireless card to work (I love it how Debian seems to have a great Wiki page for every possible problem). Ubuntu of course, made it even easier because they include nonfree firmware so the card worked out of the box (this is because Ubuntu doesn't care about your freedom). 🙂

9 Comments

  • 1. James replies at 14th July 2011, 12:26 pm :

    Well done. I had the same exact experience with the latest, supposedly weekly build. I went into the lovely debian irc and they said “just install squeeze and then “upgrade” Wheezy… but I said, ” I want to make this install work– and hence saving another DVD from the landfill– without useful purpose”. Well the respond,”go on over to the #debian-next which focuses on help for testing and other such things”. I said was so happy, even having to look up the debian IRC server wasn’t a big deal…I was just so happy… thinking I would hop in the debian-next and just ask how to make this install work and I’d get some really experienced people… instead it was more like 2 control freak chat operators who basically repeated the original “install squeeze and go to wheezy” saying emphatically, ” shut up we already told you what to do.” Over and over again. I was somewhat shocked to say the least. Having heard of the friendliness of Debian. I stayed in the room for some minutes as another chap had a similar problem I had whilst using LMDE which is a 100 percent Debian distro using the testing repos. I was immediatly jumped on by the other chat dictator who said, “LMDE is off topic as are all other offshoots.” I said it wasn’t really an offshoot, and it did serve to help the person with their problem.

  • 2. James replies at 14th July 2011, 12:32 pm :

    As I had not seen your great recovery page on the grub problem, I did go over to squeeze and replace the “squeeze”s with “testing”. Great. Well my system seemed to work after doing an update. But I after rebooting I got the same problem on this particular system that I had on Ubuntu and Linux Mint.. that is there is a strange kind of maze looking graphic that takes over the whole of the screen… and freezes during boot. Well in the case of Ubuntu that occurs just during the install and is solved by specifying nomodeset, only during the install phase. Nothing seems to allow me to boot for the Wheezy problem. I am certain they are related because the graphic which looks something like a maze, is very much the same. I have a new laptop with a fairly new nvidia/ i7 intel cpu etc. My plan now is – squeeze and slowly adopt Wheezy… at least until I can fix the boot problem.

  • 3. César Avelar replies at 17th September 2011, 4:16 am :

    Hello

    Anybody would be say how to resolve this issue whitout internet conection?

    I donwloaded Debian DVD from work, and in home I’t have Internet conection.

    This DVD lacks the Grub package?

    /thanx

  • 4. alain replies at 17th September 2011, 1:06 pm :

    @César

    Yes, grub-pc package is on the DVD (1). I would add the DVD to sources.list (2), comment out other sources, try “apt-get update” and “apt-get install grub-pc”.

    (1) http://www.debian.org/CD/faq/#search-for-package
    (2) http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html#s-cdrom

  • 5. Roken replies at 25th September 2011, 8:03 pm :

    This is a nice quick fix. After jumping ship from LMDE to a pure (and minimal) Debian install I had exactly the same grub failure problems. I finally managed to fix it, after restarting the installation several times and ultimately creating a new /boot partition during installation (which was worrying since I wanted to keep my partitioning, and more importantly my /home partition).

    This was a reinstall caused by own error (not too careful with rm -r on the / partition) so I knew that /home was fine and would save me a lot of time with the install. I never even thought of using recovery options – good call, and noted for next time.

  • 6. Lisa replies at 22nd February 2012, 10:49 am :

    Hi,

    I am trying to follow your instructions as I am having the same problem with Grub. But after I edit the sources.list I am unable to aptitude update or apt-get update, it says is is not available or installed (not sure of the wording). If you have any suggestions I would really appreciate them, this is driving me crazy. I had the same failure with Squeeze.
    Thanx

  • 7. Peterkin replies at 10th April 2012, 9:38 am :

    Unbelievable!
    Attempted net install. At file 921 of XXXX files locked up. Waited from 03:30 until o8:30 for it to continue if possible. I needed sleep anyway. No luck!
    Decided to repeat the install. Same issue.
    Decided to download the KDE CD1.iso and install from there.
    Ran for about two hours on a 6Mb DSL and failed to install GRUB.
    Followed all the suggestions I could find before bothering anyone.
    Nothing worked, including lilo.
    As I read the suggestions and comments I started losing faith.
    Soon as I asked for help I was told this issue has been thoroughly covered in the discussions. Read the discussions.
    I replied that I have read the discussions until I’m tired.
    The conversation digressed to a suggestion I might be better off going back to MicroSnot.
    Sorry guys. I’ve been using Linux since 1995 when just about the only thing to use was Slackware.
    I’ve used several distributions, “RED HAT, Slackware, Ubuntu, “PUKE”, Several others.”
    I also have a great deal of experience with, “HPUX, Solaris, “PUKE”, Sun OS, and others.”
    I have not used a MicroSnot system since the late 90’s.
    I did have a contract installing and supporting Red Box at the McDonald’s restaurants.
    That was a disgusting trip.
    For info: Red Box is software running on XP at the worst food in the world chain in the Walmart super centers. You’ve probably heard the announcement on the paging system.
    That’s all Red Box does.
    I had a reason to use Debian but It’s a long story.
    I can tell you one thing though. I’ll never say a damned thing about Debian that can be considered good or a recommendation due to the little Juvenal primadonas at Debian.

    So where does that leave me?
    It’s simple.
    MicroSnot———— UP YOURS!
    Debian ————–Likewise!
    See ya you damned Democrat assholes!

  • 8. Alain Kelder replies at 15th April 2012, 4:11 pm :

    @Peterkin

    Sounds like your problem might have been with the net install. I’d try installing just a base system from CD1 (e.g. offline, not a net install), then once the system is up and running, add online repos to sources.list (and comment out CD1) and then install additional software that wasn’t included on CD1.

  • 9. Muun Dahweed replies at 31st July 2012, 4:33 pm :

    I got the could not install to /target/ error just now. My case might be specific, but since this was the first link in google I’ll try to add my fix. I am trying to install Debian 64 from a YUMI multiboot stick. There were two errors, but to get by this one I had to:

    Exit installation.

    Use the Applications -> System -> Root Terminal from the Live System to

    # apt-get install grub-pc

    Re start Debian Installer.

    Yes! the live distro did have grub-pc installed. I guess that is why it failed to install the boot loader to the /target/. Doh!

Leave a comment

NOTE: Enclose quotes in <blockquote></blockquote>. Enclose code in <pre lang="LANG"></pre> (where LANG is one of these).