Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu 10.04 (Lucid Lynx) installed on my notebook via wubi. Since a recent ubuntu update however my system doesn't work anymore. When I boot I get into grub rescue>. After some internet reading I concluded that I would have to re-install grub (I was forgotten :$ that I installed Ubuntu via wubi, thought I had it standalone..) and used this tutorial. Now I have a command line grub and am confused about what to do.

My directory structure is as follows:

/dev/sda5 (NTFS)  
    /boot
        /grub
            <grubfiles>
    /ubuntu
        /disks
            /boot
                /grub
                    <empty>
        /install
        /winboot
        ...
    ...

Is it logical that /ubuntu/disks/boot/grub/ is empty? I would like to get the bootloader back to being able to choose between windows and linux. Any help appreciated :)

Update My problem is kind of solved by installing a standalone Ubuntu 10.10. Now I got my bootloader back correctly, have to go through 3 bootloader screens now to enter Ubuntu 10.04 though ^^

share|improve this question
    
it seems that the third grub points to the correct partition. when you are on the third grub, press 'e' before the timoeout and see the /hd/foo and remember it. now reboot, and pres 'e' on the first grub, and edit the current partition with partition that you remembered from the previous step. It wont screw up your system, because its not permanent, and I am not even sure if that would work, but worth a shot. It might make u boot into ubuntu in one grub. –  theTuxRacer Nov 29 '10 at 13:59
    
It isn't clear where the 10.04 image you want to boot resides. If it has its own partition, you can make the 10.10 grub boot either version. If your 10.04 image is living inside a Windows file system, it will probably be more difficult. –  msw Nov 29 '10 at 13:59
    
Thanks for the tips. It is as follows: I now have 1 partition for windows, 1 partition for 10.10 and 1 NTFS os-less storage partition which happens to also have the 10.04 image :) installed via wubi.. (this last one is /dev/sda5 as described above) –  Lucasmus Nov 29 '10 at 14:06
add comment

2 Answers

up vote 4 down vote accepted

At first I answered this question to match Lucasmus' situation where he actually had been able to restore the ability to boot already, and had a working grub from a (non-wubi Ubuntu install) on his MBR. Since most people coming here are probably not in that situation, but just getting the grub rescue shell at boot and can't boot Windows or their Wubi install at all, I've remade the instructions for the normal case. The answer for Lucasmus's question was basically to follow what's now steps 2 through 5 below.

This is unfortunately a known bug in Wubi https://bugs.launchpad.net/bugs/610898. I've submitted a patch to hopefully prevent future users from having Wubi render their drive completely unbootable but until that or another fix is accepted this is what you need to do (in Wubi) to get Windows and Ubuntu booting and prevent this from happening again:

1: Boot from an Ubuntu LiveCD and run sudo software-properties-gtk -e universe && sudo apt-get update && sudo apt-get install mbr && sudo install-mbr /dev/sda.

If you have more than one hard drive you will need to change /dev/sda in that last command to the drive windows is on. But it will always be a drive, never a partition. So /dev/sdb might be appropriate but never /dev/sdb1 (doing the latter could overwrite Window's PBR making it even harder to boot back into windows).

Now you should be able to boot into Windows or your Wubi install like before. If you want to continue using Wubi then follow the next steps to be sure that you don't get into an unbootable situation again.

2: Boot into your Wubi install and run sudo dpkg-reconfigure grub-pc This will bring up some dialogs with questions.

3: For the first question The following Linux command line was extracted from /etc/default/grub or the 'kopt' parameter in GRUB Legacy's menu.lst. Please verify that it is correct, and modify it if necessary. Leave the field at its default (probably blank) and press enter to continue to the next question.

4: For the second question The following string will be used as Linux parameters for the default menu entry but not for the recovery mode. again leave it at the default (probably "quiet splash") and press enter to continue

5: This question ...GRUB install devices: is the important one. Make sure that you uncheck everything but /dev/loop0. You can check/uncheck an entry with the space bar, and change entries with the arrow keys.

If you press enter before unchecking /dev/sda from this list your computer will become unbootable again.

Now you can safely update/upgrade your Wubi install without worrying about your computer becoming unbootable.

share|improve this answer
    
So I followed your instructions and I booted Ubuntu from a liveCD and put the command above "sudo software-properties-gtk -e universe && sudo apt-get update && sudo apt-get install mbr && sudo install-mbr /dev/sda" into the Ubuntu terminal. After it did its thing, I restarted without the CD to find that neither my Ubuntu or my Windows VISTA will boot. If I hit enter on either choice, I am told that windows failed to start and I should reload using my windows DVD (which I don't have). So what do I do now? I'd like to have a working computer...this is urgent, so any help would be –  user9757 Jan 28 '11 at 3:13
add comment

If, as your comment suggests, /dev/sda5 has a full /boot directory then add something like:

menuentry 'Ubuntu Lucid 10.04' --class ubuntu --class os {
    recordfail
    set root='(hd0,5)'
    linux   /boot/vmlinuz-<version> root=/dev/sda5 ro
    initrd  /boot/initrd.img-<version>
}

where <version> is replaced with the actual filenames on sda5/boot to /etc/grub.d/40_custom under your 10.10 system. Then run update-grub within your running 10.10 system and upon reboot there should be a 10.04 option on the grub menu for direct booting.

Caveats:

  1. update-grub rewrites /boot/grub/grub.cfg check that for correctness before rebooting.
  2. I always forget if /dev/sda5 corresponds to (hd0,5) or (hd0,4) in grub.cfg so double check me or be prepared to boot back into 10.10 and fix it.

Good luck.

share|improve this answer
1  
/dev/sdx and (hdx,y) aren't guaranteed to match up (they can change). It's much safer to use a UUID: sudo blkid /dev/sda5 –  Oli Nov 29 '10 at 15:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.