Ubuntu 11.04 (64-bit) won't boot. Forgot to install GRUB 2. Manual GRUB install fails

2

1

I cannot get Ubuntu to boot. I downloaded the Ubuntu 11.04 64-bit mini.iso and installed it in Virtualbox (v.4.1.2 running on OS X 10.5.8). When I installed Ubuntu, I selected "Command-line expert install", and I may have made two mistakes:

  1. I chose to install the generic virtual kernel.
  2. I didn't install a boot loader.

The installation finished, and when I reboot, I get this blank black screen with an arrow that doesn't flash

enter image description here

I think this happens because GRUB was not installed. (If I hold down SHIFT or E during boot, nothing comes up. update-grub also doesn't work.) I tried installing grub using sudo aptitude install grub-pc, but that returned several error messages:

screen capture of sudo aptitude #1

screen capture of sudo aptitude #2

Could someone please help me get Ubuntu to boot? I can post more details if they are helpful.

Brandon Lebedev

Posted 2011-09-29T20:01:56.863

Reputation: 183

Are you adverse to just reinstalling? It's a fresh install like you said. If I were to try to fix it, I'd boot off a LiveCD, chroot in and attempt grub installation much like it sounds like you've attempted. That should work, maybe you're not chrooting correctly? – James T Snell – 2011-09-29T20:34:01.723

@Doc - It'd be nice if I didn't have to spend the ~2 hours again to reinstall it manually, but that may be my best bet. I found a tutorial on installing GRUB using the CD's installer environment, but it had a bad argument variable, and I've since forgotten where it was. Could you suggest how to chroot and install GRUB from an online repository? – Brandon Lebedev – 2011-09-29T21:07:58.000

Okay Brandon, I gave ya about the best answer I can without doing a bunch of investigating.. Not sure I'd learn anything more anyway, as once I learned as below, I didn't seem to need more for dealing with messed up booting. The whole chrooting thing was taught to me by the Gentoo Handbook - Gentoo's a pretty educational distro to run, and their docs are astonishingly good. – James T Snell – 2011-09-29T22:25:09.960

Answers

1

Here's my approximate notes on how I chroot in and play with grub stuff:

Step 1) Boot from a LiveCD, I prefer USB drives to CDs.. Just be sure the LiveCD is as close as possible to the installed environment.... It certainly needs to be the same general architecture (x86 versus x64). You can get in to other weirdness if the live environment is otherwise sufficiently different too.

Step 2) Mount your ubuntu installation's root partition to /mnt:

# sudo mount /dev/sda1 /mnt

Obviously your root partition may not be on /dev/sda1 - if you're unsure, use fdisk or gparted to figure out where it is.

If you intended to have a boot partition, you'll want to mount that too:

# sudo mount /dev/sdaX /mnt/boot

Step 3) Get networking going, under the live environment. Ping google.com or something to confirm you've got connectivity.

After you've got networking going, you'll need to copy your DNS settings over to your installed environment before chrooting:

# sudo cp /etc/resolv.conf /mnt/etc/

Get ready to chroot:

# sudo mount -o bind /proc /mnt/proc
# sudo mount -o bind /sys /mnt/sys
# sudo mount -o bind /dev /mnt/dev

Step 4) Chroot in to the installed environment:

# sudo chroot /mnt /bin/bash

Step 5) Test that things are working. Try to ping google again - if it works, now your 'installed' environment can be totally played with. If they're not working, umm, maybe go back over the steps and make sure you did them correctly - or post a comment...

Step 6) Install Grub:

# sudo apt-get update; sudo apt-get install grub-pc

Step 7) Try rebooting and check things out. If you're still out of luck, you can re-enter your installation via chroot and try more things... Such as below..

Still having problems? You may want to manually run stuff such as:

# sudo dpkg-reconfigure grub

or:

# sudo grub-update

IF you're still having problems, try installing "boot-repair":

# sudo add-apt-repository ppa:yannubuntu/boot-repair
# sudo apt-get update && sudo apt-get install -y boot-repair && boot-repair

More about boot-repair here.

Other Helpful Stuff I often suggest people check out Super Grub Disk, it's pretty epic for booting otherwise messed up set ups.

For those multi-booting with Windows Vista or Windows 7, I often like suggest checking out EasyBCD - it provides a really snazzy means of managing booting. And I've found it helpful for getting an otherwise under-cooperative system booting again. I gotta hand it to them, I like EasyBCD over grub, for now. Note there's a free version there.


There ya go, hope that helps.. Here's where I first really learned about chrooting, which, as you can see, is very very powerful and handy.

James T Snell

Posted 2011-09-29T20:01:56.863

Reputation: 5 726

That somewhere is here: http://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd

– indivisible – 2015-07-23T16:33:21.140

Steps 1-6 installed GRUB2, but that didn't configure the GRUB menu. dpkg-reconfigure grub doesn't work because the grub package isn't installed, and neither does grub-update (bash: not found). – Brandon Lebedev – 2011-09-30T14:55:30.483

Still, for anyone checking this post, Doc's explanation of chroot-ing is an excellent resource. – Brandon Lebedev – 2011-10-02T03:44:55.787

@Brandon - yeah, it's good to have written out - obviously it can be inferred from the Gentoo docs and may well even be written out somewhere for Ubuntu. Nevertheless, it should help a few people out. – James T Snell – 2011-10-18T21:14:05.223