I upgraded a couple of machines to Ubuntu 11.04, and after the reboot, they just booted up to a grub prompt. Like this (except an older version of grub reported):

My reading seems to indicate that this happens if you upgrade from Ubuntu 10.10 which itself had been upgraded from Ubuntu 10.04, and grub was never reinstalled.
I think it is completely ridiculous that this bug made it all the way to the Ubuntu 11.04 final release — leaving the system unbootable after an upgrade is a disaster.
The easiest way to fix it is to boot from the Ubuntu 11.04 alternate install CD. Choose the option to “Repair a broken system.” Go through the prompts and choose which disk has your root file system.
After this, you may have the option to just reinstall grub — if so, do it, and reboot, and your system should be fine.
If that’s not an option, choose to start a recovery shell using your root filesystem and then run the commands
grub-install /dev/sda
update-grub
(possibly adjusting for where your root disk is). Then reboot and the machine should boot.
If it still doesn’t, go back to the recovery shell and see if your /boot directory is empty (aside from the “grub” directory). This happened to me on a machine that was set up with LVM. The /boot folder is actually stored on a different partition and you have to mount it before grub can set itself up right. Here’s the commands…
rm -Rf /boot/*
mount /dev/sda1 /boot
grub-install /dev/sda
update-grub
Of course, these may need to be adjusted depending on which disk needs grub and which partition contains /boot. You can use the GUI partition editor on the Live CD to check.
Now, hopefully your machine can boot up. What a mess. :-\
Update: May 12, 2011
dzsi posts another way to recover from this situation in the comments below. This method does not require booting from a CD.
Note that in the commands that follow, “X”, “Y”, and “Z” should be replaced with numbers/letters that represent your boot disk.
At the grub prompt, issue these commands:
set root=(hdX,Y)
linux /vmlinuz root=/dev/sdZ ro
initrd /initrd.img
boot
Your machine should boot up. Start a terminal and issue these commands:
sudo grub-install /dev/sdZ
sudo update-grub
This should fix grub so that you do not have any boot trouble anymore
Tags: Ubuntu
Master!!!!!
You’ve brilliantly solved my problem… Never thank you so much you’ve saved my system!!!
[...] http://aaron-kelley.net/blog/2011/04/grub-prompt-after-upgrade-to-ubuntu-11-04/ Share this:TwitterFacebookLike this:LikeBe the first to like this. « Previous post Next post » [...]
Thanks Very Much.
Brilliant – thanks for this, and Carl’s comment below. I managed to recover my old Ubuntu VM.
How do I know the appropriate value for X,Y and Z?
this commads are not accepted my system.
it shows unrecoganized command
am using ubuntu 10.10 and installed grub2 and grub-customizer
then i change the boot banground after restarting igot this probleplease help me through mail
dilshob003@gmail.com
Thanks so much, saved my day!
Thanks a million, worked for me too.
Note that in the terminal, you want
sudo grub-install /dev/sda
and not
sudo grub-install /dev/sda1
Even though the linux line used /dev/sdZ to correspond to /dev/sda1! Attempting to install to a partition instead of the hard-disk will create a scary warning message and probably error. Perhaps these instructions can be edited so as not to use the notation sdZ to mean two different things.
To find out X and Y, as shekhar notes, use the command:
$root
Then Z seems to correspond sdaY. i.e. if root returns: hd0, 1,
then you want
linux /vmlinuz root=/dev/sda1 ro
in the second line.
Thanks a ton!
Thanks alot for the post. found it very useful
To resolve X and Y.
use command
grub>root
set root=(hdX,Y)
with raid after booting to initrd ls /dev/mapper shows exact name of root partition, which can be used instead of /dev/sda1
error: invalid magic number
after setting root I used the prev. conf. files:
linux /vmlinuz.old root=/dev/sda1 ro
initrd /initrd.img.old
boot
got it – it seems my problem may have been entirely different. Windows moved the files from c:/ubuntu/disk/ into c:/found.000
when i moved it back it booted up fine
I am using wubi and i cant get the x and y values.
Followig Phillip.C’s link I used ls:
(memdisk) (hd0) (hd0,msdos2) (hd0,msdos1)
i tried
ls (hd0,msdos1)/
ls (hd0,msdos1)/boot
ls (hd0,msdos1)/boot/grub
ls (hd0,msdos2)/
ls (hd0,msdos2)/boot
ls (hd0,msdos2)/boot/grub
but only the first and 4th gave a list of files as an output, not including vmlinuz or initrd.img. the others said
“error: file not found”
Thanks to all,
But all the applications, browsers, softwares and setup seems to be vanished.
Its like a new once again!
Do i have to do something to restrore them?
You can press Esc when you see the Ubuntu logo to reveal the bootup messages and maybe get a hint as to where your system is getting stuck.
Hey Andrew,
You can find the information about X,Y,Z over here:
https://help.ubuntu.com/community/Grub2#Rescue%20Mode
somehow I got the system to reboot but freezes at the Ubuntu logo
You have any new findings for this?
Thanks!
When I read:
“Note that in the commands that follow, “X”, “Y”, and “Z” should be replaced with numbers/letters that represent your boot disk.”
I didn’t know how to check what to know what to replace. I checked other comments and no one spoke on this either except giving what they gave.
I tried issuing ‘ls’ and got a list of seeming possible choices for X,Y (I forgot to copy it down). Among them was hd0,1.
By using TAB in grub I found the command ‘root’. When I entered that I got an output that showed that hd0,1 was the root. So I decided to use that.
I still could not figure out how to choose Z. I ended up just using sda1 like others did and that worked I guess.
set root=(hd0,1)
linux /vmlinuz root=/dev/sda1 ro
initrd /initrd.img
boot
sudo grub-install /dev/sda
sudo update-grub
Then when I booted I had the Unity cannot load issue. Now, I am onto troubleshooting that one!
dszi ‘s solution (set root=(hdX,Y) etc.) worked for me too. Thanks!
This worked for me thanks a million!
set root=(hd0,1)
linux /vmlinuz root=/dev/sda1 ro
initrd /initrd.img
boot
and
sudo grub-install /dev/sda
sudo update-grub
many thanks to OP and dzsi as this one has caught me out on every upgrade so far, and I have now stored these cmds as I expect to be caught out again at next upgrade
Thanks so much for this, the second set of instructions worked for me on xubuntu 11.04 following a “minor” update!
I also had the issue with the /dev/sda1. To “attempt” this from being an issue in the future, I edited the fstab and removed sda1, mounted sda1 as boot2, copied the files over, then unmounted boo2.
so more or less the sets were as follows:
Using live CD boot into recovery.
nano /etc/fstab
remove the boot drive listed there.
CTRL-x
CTRL-y
then:
mkdir boot2
mount /dev/sda1 boot2
cd boot2
mv * ../boot
cd ..
umount boot2
rm -rf boot2
grub-install /dev/sda
update-grub
rebooted, in the system.
Seemed to work well for myself, and thinking it might resolve similar issues in the future.
great post!!
Nick
Thank you for posting this invaluable information.
I’ve been delaying the upgrade for weeks and finally decided I would upgrade my dev server and after the reboot I saw the Grub prompt I though “oh no, not this again”.
Your boot from CD/DVD method worked like a charm.
One note, if you have the CD/DVD in the drive then type exit at Grub prompt. It will take you to the screen where you need to be. To complete recovery tasks.
Thanks again.
Thanks to people like you I’ll stick to Ubuntu. My laptop starts again and my headache has disappeared. By the way, it was your second solution that did the work. Thanks again !
This saved my life just! I am forever indebted.
[...] http://aaron-kelley.net/blog/2011/04/grub-prompt-after-upgrade-to-ubuntu-11-04/ [...]
thanks so much for this. thought my system was a goner. I used the second method
Hi used the second method with /dev/sda1
Thank you! It took me a few tries to get the right disk/partition arguments, but my system came right back up.
dzsi’s and Bluehaze’s comments did the trick. Thanks all!
[...] muss. Der Upgrade schafft es leider nicht, sich die Disk-Konfiguration zu merken. Die Lösung dazu hier. Wobei die wirkliche Lösung, dann in einem Kommentar enthalten [...]
Same problem, however none of these suggestions have worked for me yet. CD 11.04 not an option.
#grub-install /dev/sda#
only returns this
#grub-install /dev/sda
cp: cannot create regular file `/boot/grub/915resolution.mod’: Permission denied#
@dysi. Tried yours too, but no success.
@dzsi
Thanks very much for the timely message on how to fix the grub boot after the Ubuntu 11.04 upgrade. I had to use it only a few hours after your post.
As Ubuntu is installed in the first partition of the third drive of my PC, I used the following commands:
linux /vmlinuz root=/dev/sdc1 ro
and
sudo grub-install /dev/sdc
[...] 詳情可參考這篇blog和它的第一篇回應。 [...]
Hi,
I think it is still not the easiest solution because you need a live cd. This problem occurs when you upgraded from 10.04 to 10.10 and then 11.04. So you do not have a live cd.
What I did:
1. When the grub is loaded and you got the above screen you type the following commands. Of course you should substitute X,Y,Z according to your system settings.
set root=(hdX,Y)
linux /vmlinuz root=/dev/sdZ ro
initrd /initrd.img
boot
2. Your system will start, login and type the following commands into a terminal:
sudo grub-install /dev/sdZ
sudo update-grub
After you reboot, your grub should work.
Wouldn’t reload grub, but the final workaround did the job…
Thanks!!
Thanks.
I recognized the possible error,
and simply formatted the upgraded partition.
Then booted the Live-CD (10.10) and did the install again.
I considered just dropping Grub4Dos into the MBR,
but then decided that Grub2 was going to be a major player,
and I should learn to work with it.
Besides, Grub2 allows beautiful backgrounds.
On my “sand-box” computer, I use 6 different OS, and Grub4Dos,
very interesting, although I don’t expect to become a real expert.
I elected to wait for all the 11.04 problems to be resolved,
then I’ll try installing it.
Opps! there was another “Upgrade to 11″ message box,
which I canceled.
Needs to wait a month or so.
glene77is
Thanks a lot for hinting where the problem lies!!
Altough I had to go see at Ubuntu Help how to install grub from live-cd =)
https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD
You saved my life ! Upgrade from 10.10 (installed directly on a new laptop, so no 10.04 there) to 11.04, and same message and grub prompt like yours. I followed your instructions, and the second step (grub-install /dev/sda, update-grub) was the good step. Thanks a lot !
Hm, doesn’t work for me…I get the same window as you and when entering “boot” i get “no kernel” message…
Seems there is a problem with GRUB with every upgrade – I think I’ll have reinstall…
Had the same problem on virtual machines (KVM) with serial consoles. I thought it was some bug around those configurations. I spent almost one day hunting this and found your post afterwards when I solved it as you with grub-install. We got what we pay for with Ubuntu and lesson is: wait a while after new releases….
Aaron, thank you for the instructions on getting my machine back into working order. I agree completely that this kind of failure should never happen. It’s a hideous QA failure on Canonical’s part. But again, thank you for the solution, it did the trick.