sh:grub Fix Wubi after grub-pc update on Karmic Koala

Why I use Wubi

I love Ubuntu. It’s the operating system I use the most. But even with all my love for the platform, there are still a couple of applications and things that I must do on my computer (mostly legacy Business Intelligence software) that require Microsoft Windows. Because of those applications, my computers have some sort of Windows installed on them. In my case it’s Windows Vista.

Vista is rather picky when it comes to installing service packs. If it finds that the MBR is missing or has been changed or that the partition table has been modified, it fails to install the updates. This is where Wubi comes into the story.

I love Wubi. It lets you install Ubuntu onto your computers without having to partition your Windows hard drive. Your Ubuntu installation lives in a virtual filesystem that lives on a file inside your windows filesystem (NTFS), and to boot into it, Wubi adds itself to Window’s bootloader menu.

The Trouble Begins:

A few weeks ago, Ubuntu updated the grub-pc package to version 2.0, and if you use the Update Manager regularly, chances are it will be automatically downloaded and installed on your computer. Here’s the trouble: It WILL break your Wubi installation! Luckily there’s a fix for it, although it took me a while to find it on the Ubuntu forums. Here I’ve tried to summarize it for you:

The fix:

When you boot and select Ubuntu from the menu, instead of booting Ubuntu (if you are having the problem) you will be confronted by a text prompt like this one:

sh:grub>

To boot back into your existing installation of Ubuntu you will need to type the following commands:

sh:grub> linux /boot/vmlinuz-(Your version of the kernel) root=/dev/(Your Windows partition) loop=/ubuntu/disks/root.disk ro

sh:grub> initrd /boot/initrd.img-(Your version of the kernel)

sh:grub> boot

Quick-tip: The new version of grub features auto-complete (very much like bash does). So, if you are not sure which version of the kernel you have, just use the TAB key when you get to the (Your version of the kernel) part of the command, and it should auto-complete with the files it finds in that directory.

When you get to the part about (Your Windows partition), this will usually be “sda1″ or “sda2″. However your mileage may vary depending on how many drives and partitions your computer has, and where you decided to install Ubuntu when you installed it the 1st time. To find out how many partitions you have, use:

sh:grub> ls -l

This will list all the partitions it can find in this format: hd(0,1), hd(0,2), etc. The first number is the physical disk. The second number stands for the partition number. Hence:

  • hd(0,1) = /dev/sda1
  • hd(0,2) = /dev/sda2
  • hd(1,1) = /dev/sdb1
  • hd(2,1) = /dev/sdc1
  • and so on…

If you can’t boot into your Ubuntu installation with /dev/sda1, try the other partitions that you found with the ls -l command. One of them HAS to be it! Try “root=/dev/sda1″ first, if it doesn’t work, try again but iterate your way up… “root=/dev/sda2″, etc.

After you type in the ” boot” command, Ubuntu should start to load and you should be greeted by your desktop, in full working order. BUT, we’re not done yet: we still have to fix grub so that you don’t have to type in those commands every time you want to boot into your system.

Open your Synaptic Package Manager, found on the Gnome-Panel menu under: System > Administration > Synaptic Package Manager. In the “Quick search” field, type in grub-pc. You should now be confronted with a list of packages. Focus on grub-pc, which should have an Ubuntu logo and a green square next to it. Right click on it, and select “Mark for Reinstallation”. Then click on the big green checkmark (Apply). After it has finished reinstalling that package, your troubles should be over, and your Wubi installation should be back to normal. Try a reboot, just to make sure it has all worked properly!

Hope this helps.

58 thoughts on “sh:grub Fix Wubi after grub-pc update on Karmic Koala”

  1. This problem seems to be solved in 10.04 LTS (the latest wubi install).

    Just did an apt-get upgrade on a fresh install, saw grub try to update, and pre-emptively did a search for “wubi grub apt get blacklist” to try to blacklist a grub update. Stumbled across this site, wrote down what you said, and rebooted after a full upgrade. Ended up not needing it.

    Unfortunately a regular user would not have been able to recognize possible bootloader problems with a grub update under wubi. Unfortunately for end users, ubuntu attempts to update everything (which includes joe blows application3 that you installed and he didn’t test upgrade path before releasing a new version), where windows really only updates core services and leaves it up to the user to update their various software packages. Still, the only scenario which may leave you unable to boot to a GUI in a standard (ie: not wubi) ubuntu install is related to kernel upgrades making your video card drivers not work.

  2. Had 10.04 wubi running nicely on my relatives Vista pathetic HP laptop for a month.
    He had run Update Manager after a prompt, and as often is the case, broke GRUB.

    Your instructions got Wubi back, or we would have abandoned both, and gone to XP.

    Thanks.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>