Ubuntu 11.04 Natty Narwhal Upgrade – Grub Prompt on First Reboot

I just updated one of my VMs from Ubuntu 10.10 to 11.04 Natty Narwhal using the Update Manager. All seemed to go well during the upgrade process. When it rebooted for the first time however, I was left with a grub prompt rather than a booting system. Grrrrrr.

NOTE: The following assumes the default disk layout. If you installed to a different disk or partition, you’ll have to adjust the steps below accordingly.

The fix is to manually boot the system at the grub prompt by typing

set root=(hd0,1)
linux /boot/vmlinux-2.6.38-8-generic root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.38-8-generic
boot

Then once you are successfully booted, re-install grub like this:

sudo grub-install /dev/sda
sudo update-grub

Thanks to Rob Convery for the tip!

Comments

16 responses to “Ubuntu 11.04 Natty Narwhal Upgrade – Grub Prompt on First Reboot”

  1. James Avatar

    I have the same problem with a VM upgrading rom 10.10 to 11.04. Stuck at the grub prompt.

    ls reports: (Linux-swap_1) (Linux-root) (hd0) (hd0,5) (hd0,1) (fd0)

    Tried your instructions above, but get “file not found” on the 2nd command (linux /boot/vmlinux-2.6.38-8-generic root=/dev/sda1 ro)

    Any ideas? The VM hard disk type is SCSI 0:0.

    1. GodsBest Avatar
      GodsBest

      At the grub prompt if you run the following command you will find the corresponding file names to use for your install. I had the same ‘file not found’ error but the command showed me what names to substitute and it worked great!!

      ls -l /boot/

      Hope this helps. And if you run the following command you can confirm which partition actually has your install: At the grub prompt run:

      ls -l

      All partitions will be listed with filesystem if recognized; Ubuntu installs on ext3, right?

  2. James Avatar

    Figured something out…

    set root=(hd0,1)
    linux /mvlinuz-2.6.38-8-server root=/dev/sda1 ro
    initrd initrd.img-2.6.38-8-server
    boot

    It then starts booting but then starts throwing a lot of mounting errors.

    sda1 seems to be the boot partition and sda5 is the root, but the filesystem type is reported as LVM2.

    I tried putting sda5 in the linux command above, but still had same kind of errors.

    Using a 10.10 live cd, I tried “grub-install /dev/sda”, but got a permission error. Tried “sudo grub-install /dev/sda” and got “cannot find a device for /boot/grub (is /dev mounted?).

    I cannot mount sda5. It gives me “unknown filesystem type ‘LVM2_member’

    I’m at a complete loss. I guess I may have to do a full install and then import my mysql databases (i did make a backup). mysql is all this linux machine is used for.

    1. ZachB Avatar

      A few of things:

      First I’m assuming that the typo above with /mvlinuz- rather than /vmlinuz- was when typing out the comment, but double check that you have that correct.

      Second, make sure you have chrooted into your system before running the grub-install commands, otherwise it’s going to try and do it against the temporary filesystems and devices that the LiveCD is using. Your situation seems to be very similar to this guy’s: http://aaron-kelley.net/blog/2011/04/grub-prompt-after-upgrade-to-ubuntu-11-04/

      A full re-install shouldn’t be necessary, but depending on how much customization you’ve done to the system, it may be easiest. You can always backup your data using a LiveCD to grab anything you haven’t already.

  3. James Avatar

    Thanks for the reply.. I saw that post, but it didn’t help much. After searching on “ubuntu grub LVM” I found some info about how LVM devices are mapped to a different device name.. took me a little bit to figure out what it was mapped to but finally came up with /dev/dm-0

    plugged that into the original commands at the top and it worked!

    set root=(hd0,1)
    linux /vmlinuz-2.6.38-8-server root=/dev/dm-0 ro
    initrd initrd.img-2.6.38-8-server
    boot

    after it booted, i did the grub install that you showed at the top..

    All is back online.. THANK YOU THANK YOU.

    1. ZachB Avatar

      Ahh, excellent! Glad I was of (some) help.

  4. GodsBest Avatar
    GodsBest

    This post was extremely helpful. I was just about to give up when I came across it. However, I noticed that the file names have been updated since the post; doing ls -l /boot/ displayed the current file names and the instructions were as follows:

    set root=(hd0,1)
    linux /boot/vmlinuz-2.6.38-10-generic root=/dev/sda1 ro
    initrd /boot/initrd.img-2.6.38-10-generic
    boot

    Then I successfully logged in and followed the second set of instruction as given.

    Zach Burlingame, Rob Convery, thank you so much. Again, thank you.

    1. ZachB Avatar

      Thanks for the updated commands!

  5. Carlos Avatar

    Hello!

    I followed what you said and could enter into the graphical interface. Unfortunately, I tried to install grub, it went fine, then I rebooted. It just started the grub prompt again! Any ideas?

    1. ZachB Avatar

      Two things:
      Make sure that /boot is actually mounted when you do the grub-install / update-grub.
      Make sure that update the lines to match whatever kernel is your latest and greatest. You may have multiple kernels installed.

  6. Abraham Avatar
    Abraham

    Hello sir,

    I have close to know idea of linux/unix except for what a few commands mean.
    I have a laptop with WINDOWS7 AND Ububtu natty narwhal.
    I updated everything on ubuntu required of me and it was succesful. On my next reboot the grub comand comes up.
    Dont know wat to do, would the commands that u mentioned above work for me.
    I got an error >>file not foundโ€ on the 2nd command

    Urgent help required

    Thank you
    Abraham, India

    1. ZachB Avatar

      The steps here would likely work to get your Ubuntu environment booting again. However, you may have to go through additional steps to get Windows booting again depending on how you have grub configured.

  7. kaare Avatar
    kaare

    thank you very much – worked like a charm ๐Ÿ™‚

  8. rfvgyhn Avatar
    rfvgyhn

    Woo, this worked perfect. Thanks!

  9. Umer Avatar
    Umer

    Thanks for all the help. I was wondering what if linux is installed in portable external hard drive, then command will be like set root=(hd1,0). is that right ?

  10. Dennis Avatar
    Dennis

    HI,

    I have the same Setup as James and if I follow the steps described here, it just boots into (initramfs). No way to execute grub-install. What am I supposed to do in (initramfs)?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.