Home > How-to, Ubuntu > sh:grub Fix Wubi after grub-pc update on Karmic Koala

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

November 18th, 2009 Leave a comment Go to comments

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.

  • Share/Bookmark
Categories: How-to, Ubuntu Tags:
  1. Phil M
    November 26th, 2009 at 07:15 | #1

    Hi,
    I followed the istruction above and I succeeded in booting correctly.
    However reinstalling grub-pc package didn’t work for me.

    Mainly for two reasons:

    1) I installed Ubuntu with Wubi under Windows, but when updating grub-pc the system updates grub.cfg in /boot but doesn’t update wubildr in the first partition.

    2) It seems that new version of wubi has a bug related to ext4 partitions. In fact, booting with grub, entering in command-line mode and doing a ‘cat some_text_file’ returns something like garbage.

    More infos about this bug can be found here:
    https://bugs.launchpad.net/ubuntu/+bug/477169
    in particular, thanks to Mark Abene and his comment:
    https://bugs.launchpad.net/ubuntu/+bug/477169/comments/84

    The solution consists in creating a separate boot partition in ext2 and configuring grub to mount it.
    Besides, in the link above there’s attached a patch for grub-mkimage in order to get grub-install correctly load the boot.disk and update the wubildr.

    I thought that all these informations may be helpful for all the readers of your post!

    (p.s. The only problem I still did not resolve is related to new kernel 2.6.31-15 that gives me some problems after booting. Meanwhile I’m running fine with previously 2.6.31-14 version.)

  2. November 26th, 2009 at 07:35 | #2

    Thank you so much for the added info. It seems the grub-pc re-installation works for only some of us. Thanks for adding all these useful links!

  3. Axel
    November 29th, 2009 at 18:36 | #3

    Omar, Hi.

    May I suggest that you fix the typo “/boot.vmlinux-” to “/boot.vmlinuz-” (with a ‘z’ rather than the ‘x’) where you have the command-line:

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

    I really appreciate your help,
    Axel

  4. November 30th, 2009 at 07:48 | #4

    Thank you for the great observation.. I’ll edit the post.

  5. Daniel
    November 30th, 2009 at 17:31 | #5

    AT LEAST !!! I DID IT, IT WORKED MAN !!

    i’m just so happy and i dont know how to thank you !

    i was looking hours on hours for that solution.. its just freaked me out !!

    THANK YOU !

  6. Heather
    December 9th, 2009 at 12:00 | #6

    Thank you sooooooooo much!!!!!
    CHEERS!

  7. Neil
    December 15th, 2009 at 22:43 | #7

    Oh emm gee I am amazed that worked! You rock! I owe you one.

  8. white
    December 23rd, 2009 at 11:23 | #8

    Wubi is/was a great solution since (for the last *many* years) whenever I have attempted to install grub on a multiboot, I have *inevitably* torpedoed my partitions (this has happened so many times that I won’t try it again).

    However, after this latest misadventure by Wubi with the sh grub crap, I am finally realizing that linux is not worth it. Nope. No way, Jose. Can you imagine if Microsoft forced its users to go through the fix you described here?? Any operating system that forces its users to jump through the hoops that linux requires at the command line is an operating system that is destined for the Propeller Heads ONLY. And that ain’t me.

    So long, Linux. I kind of liked you, but you shat upon me once too often. Don’t call me … I’ll call you. But don’t sit around waitin’ for the phone to ring.

    Now, if you’ll excuse me, I’ve got an uninstallation to attend to. REAL permanent-like.

  9. December 25th, 2009 at 09:39 | #9

    I can understand your frustration. And as I’ve said before, Linux isn’t for everyone. It’s great that there are so many options out there for everybody to use computers (Windows, MacOS, Linux, BSD, etc.)

    I wonder how many other people got put off from using linux by this latest grub trouble. Even though i know how to fix it now, I still find it very annoying when something as fundamental as the boot loader goes wonky. Or when something that works well breaks something else when the new version comes out.

    However, I’m sticking with Ubuntu because, to me, all these little bugs are a fun challenge to get the system to do what I want it to do… and when I finally have a system up and running just how I like it.. it feels incredibly good! I feel like an über geek!

  10. Holger
    January 2nd, 2010 at 07:04 | #10

    Now that the bug has been known for weeks, the wubi download pages, and wubi documentation still does not mention the problem at all. IMHO new wubi users should be warned that there is a problem that still has to be resolved. The way it is now, I can stil download wubi, install 09.10, update all packages and get an unbootable system without any warning at all. Add to that the slowness in fixing a bug that essentially is a showstopper for wubi/Karmic Koala. Wubi seems to be very low priority for Ubuntu. Just my 0.02.

  11. law
    January 8th, 2010 at 02:30 | #11

    WooHoo! Thanx man u saved me a reinstallation (and the associated loss of data) of Karmic Koala.. It took a few tries as I had options for different kernel versions (a result of updates) but in the end the least likely one worked.. Thanks Omar!

  12. Brian
    January 11th, 2010 at 23:43 | #12

    Frankly, this is why Linux is still a million miles away from being useful to the general computer user. I’ve been programing PCs since DOS3.0 and used a computer every day of the last 30-odd years; before the PC, in fact. I finally installed Ubuntu a couple of months ago and was very gratified to see that I wasn’t going to have to learn an entirely new level of gobbledy-gook just to get it running. How easy it all was. I did spend a few hours getting my wireless adapter working with WPA and learning a few of the more commonly-used utilities, but I have real work to do with my computers that means I no longer want to spend half my life stripping the engine just to get from A to B. I was even getting used to the idea of replacing a couple of home-based Windows PCs used for limited purposes with Linux machines. Then I clicked the Update Manager, and it all came crashing down. Thank goodness for my Windows installations, in that I was able to search the net for help, but imagine if those options were no longer open to me thanks to my dependence on a buggy system that releases barely tested updates that can bring my system to its knees in a few minutes! My computers would be useless heaps of electronic scrap. Say what you like about Windows, but it’s been many years since anything that serious happened on a minor update. Even SP3 (basically an entire replacement of 400Mb of operating system) went without a hitch. So, no more Linux for me. I’ll come back in another few years to see if some better system has been devised to keep all the developers in line. Have fun poking about with the gears and stuff like I used to do, but there’s more to computers than the challenge of just keeping them working. That should be taken as read. Meanwhile, I’m condemned to paying Microsoft a hundred bucks a year or so to make my life more productive, and have things tested out before they release them (mostly.)
    If Ubuntu think Wubi is a low priority, they’re about as wrong as you can get. It’s the only reason many people ever try Linux at all. Thanks to this mess, that’s going to be a lot fewer in the foreseeable future.

  13. sam
    January 14th, 2010 at 15:53 | #13

    This GRUB needs work. It’s extremeley annoying and frustrating. I ran the above using 2.6.31-14 kernel version, but realized I should have used new kernel 2.6.31-17. Grub works fine if I select the -14 but not the -17. haven’t been able to fix this menu item after hours of trolling the internet and trying different solutions. For and end user I find this unproductive.

  14. brad
    January 22nd, 2010 at 15:41 | #14

    Worked perfectly. Thank you so much!

  15. Sean McCann
    January 30th, 2010 at 09:39 | #15

    Omar

    Firstly thanks for posting this.It was the easiest set of instructions I found Although it didn’t help in the end. Too much got munged. I love Ubuntu but I’m getting worried that the sexy stuff is getting worked on and nones minding the basics like grub.I’m a bit of a geek but one of the things that attracted me to Linux was it stability and stuff most of the time just working.

    I was going to install wubi on a friends laptop but now I’ll go for repartitioning. I’m doing the same on my laptop that dual boots. I need windows 7 for work . They tolerate the dual boot :)

    Again thanks to you posting this up and Mark Aherne for getting a workaround . Poor Mark got a lot of grief on Launchpad. I felt for the guy.

  16. pj
    February 5th, 2010 at 10:44 | #16

    Thanks for this guide – my Wubi also messed up after an update last night and after a couple of false starts, these instructions helped perfectly!

  17. February 5th, 2010 at 11:36 | #17

    great work sir…..you beauty !!! 111some….marvelous…..so many hours of frustration finally ends…thank you so much mr. omar

  18. Lifeform
    February 6th, 2010 at 08:58 | #18

    hello Everyone,
    sorry but I seemto have the same problem only that I cant for the my life find my kernel version??
    when I try to use tab like the guide says nothing happens. no kernel version is suggested to me. does anyone have any suggestions? is there any command I can type in grub to tell me my kernel?

    I am tempted to just remove windows and do a fresh ubuntu installation only thing is that I honestly dont wanna give up that easy.
    please guys any help will be greatly appreciated.

  19. Lifeform
    February 6th, 2010 at 09:18 | #19

    ok my bad guys thx your a fucking genius (excuse my language)
    the problem was I didnt leave a space after the first word “linux” in the command thx alot guys
    :D you made a random dude on the interwebs very happy.
    would be awesome one day to actually understand what is it that did exactly by typid those comands anyway more than happy for now that again friend

  20. Lifeform
    February 6th, 2010 at 09:20 | #20

    sorry for bad language and numerous typos I am a bit excited right now :D
    thx again. keep up the good work!

  21. Péricles
    February 6th, 2010 at 12:06 | #21

    I try comands above but didn´t work. I didn´t find any partition when I use TAB to complete the path /dev, and when I try use the command with /dev/sda1, /dev/sda2, etc…. I receive the message “Wrong magic number”

    I have two partition: hd0,1 (where there is installed the ubuntu) and hd0,5 and when I use the command ls -l there is no indication of link in /dev

  22. omar
    February 6th, 2010 at 19:45 | #22

    @Sean McCann
    Hi… Yes, I’m also considering getting rid of Wubi and formatting the hard drive and remove Windows altogether!

  23. February 7th, 2010 at 01:35 | #23

    Thanks man. You saved my ass. Great tutorial. Shame on ubuntu dev’s.

  24. February 7th, 2010 at 02:09 | #24

    Yes it is a shame. I finally did bite the bullet and wiped Windows clean off the laptop, now I’m running only Ubuntu on a fully ext4 partition. I guess Wubi helped me to test Ubuntu out enough that I eventually decided I really never used or needed Windows at all.

  25. February 7th, 2010 at 11:44 | #25

    gracie, mucha gracie, esto funciona de maravilla,

    volvi a gnome de nuevo, cuanto busque para que volviera a funcionar y al fin men.

  26. lotif
    February 7th, 2010 at 11:44 | #26

    man…you saved my ubuntu installation! I’ve installed it on an acer aspire one with wubi because i can’t boot with a pen drive and make a default installation… thank you!

  27. JMW
    February 9th, 2010 at 12:42 | #27

    Great Workaround, man! I got my Wubi-Installation running again. Thanks a thousand times!

  28. driekus de lange
    February 10th, 2010 at 08:37 | #28

    IS IT SAFE?, IS IT SAFE, IS IT SAFE???
    I have a somewhat different installation, i boot with the windows bootloader, after i choose Unbuntu, the grub bootloader offers me the normal Ubuntu choices. The Karmic 13-17 upgrade resulted in a ‘ kernel panic, VFS not in sync’ error, so I went back to using the 14 upgrade which fortunately still worked. Then the 19 upgrade came and in my linux-innocence i thought that 19 would either improve over 17, or at worst i would have to keep using 14, but NO!!!!, the grubloader was ****up, and I had to use the above (neat!!) trick to get it started again. After that i tried to repair the problem by reinstalling the grub-pc package (in synaptics package mngr), which did not help. Because i did not want to type a lot of commands at every startup i was foolish enough to use the instructions from the Ubuntu site to repair grub. Becasue that resulted in a non-bootable system, the windows bootloader had been replaced by grub, which only showed a prompt. So now i had no more system!!!!!. My colleague had a ‘Knoppix’ live cd , which has a utility to restore the windows bootloader’s mbr. I was so grateful, I almost cried. It will take some time before I will have the courage to run grub-update or to install kernel upgrades. The reason i installed the 2 layered boot is that a while ago I had the standard 2 partition installation with ubuntu on one and windows on the other partition, with grub 1 the primary bootloader. But as you may have guessed already an upgrade also s*****d the grub settings and i had no system. That’s why i thought it would be safer to keep the primary bootloader windows. As i found out yesterday, that is not safe either. However with the knoppix cd by my side i will be a lot more comfortable. Imagine me asking Ubuntu fellow-travellers all the time: ‘IS IT SAFE?, IS IT SAFE, IS IT SAFE???’

  29. February 10th, 2010 at 11:27 | #29

    I gave up… I erased windows and installed Ubuntu natively. Now, whenever I need Windows, I run it inside a virtualbox vm. Works great, and no hassle. Maybe I’ll write a how-to… but I think most of my readers already know how to do it.

  30. Paul
    February 10th, 2010 at 22:55 | #30

    Same exerpience as Brian and White. Installed Ubuntu 9.1 with Wubi, installed NVidia drivers, installed Flash for Firefox, was amazed at the ease of installation of MP3 stuff for the media player, everything seemed to work great.

    So, decided to install the Andriod SDK and Eclipse and maybe do my Android development on Linux. Step one of this is to update the kernel. I do my apt-get update and apt-get upgrade, reboot, and ZING, I’m in something called Grub. Back to Windows. Google around a bit. Find this website. Try what it says, and it dumps me into another shell.

    Screw it. I’m going back to Windows 7, because I have WORK to do, not time to fool around with stuff I used to do for CP/M back in the late ’70s.

    Not ready for prime time. Microsoft has nothing to worry about.

  31. February 16th, 2010 at 11:52 | #31

    Thought I’d post up here. Had the exact same problem and your fix save my life. However, the last step: Updating grub-pc through the Synaptic Package Manager wasn’t working for me, so each time I needed to reboot I had to key in the solution. Finally, I found that doing ‘sudo update-grub’ through the terminal got me back on track.
    Thanks Again.

    Cameron

  32. Armin
    February 18th, 2010 at 06:57 | #32

    I’ve had same problem described here, with the commands here I could load my ubuntu (karmic). But after the ‘sudo update-grub’ grub didn’t find the boot config. (‘no wubildr’ was the shortly visible message before dropping to grub-shell).
    Searched long to find help in forums… the solution was to create the config into the ubuntu/install/boot/grub folder while running ubuntu, so following lines helped:
    $ sudo update-grub
    $ sudo grub-mkconfig -o /host/ubuntu/install/boot/grub/grub.cfg

    Got it from this posts: http://forum.ubuntuusers.de/topic/nach-update-streikt-grub/3/

  33. Chris
    March 4th, 2010 at 13:56 | #33

    Thanks, Omar! After struggling with grub I stumbled on your post and it did the trick. In my case, re-installation of grub-pc did seem to fix the problem. It’s true that these types of issues are hard on folks new to linux, and I think it’s a real shame that more care isn’t taken to make packages compatible with Wubi now that it’s officially supported by Ubuntu. That said, I’d *love* to see Windows get installed and run through a loopback device on a pure Linux box and actually work. It’s a testament to the inventiveness of linux folks that they keep making inroads towards coexistence with other OS’s.

  34. kc
    March 5th, 2010 at 08:48 | #34

    Hi all,

    I am new to this ubuntu.I am using windows and ubuntu linux together. I installed ubuntu in D drive directly from the net.Today iam getting some problem here.When iam start ubuntu i am getting sh:grub>
    I din’t understand how to solve it.please send me a list of coomand or solution for this problam.My e-mail id is kc_kartheek@yahoo.com

    Thanks,
    kartheek kc

  35. Prabhakar
    March 6th, 2010 at 10:16 | #35

    Thanx,
    sir 4 the solution u have given..
    I was facing this problem since when i’m updated…
    But now it works…
    yoho…………

  36. Ian
    March 6th, 2010 at 17:01 | #36

    @Péricles
    i didn’t any “sda…” listed in /dev either, but it didn’t matter. i did have to use vmlinuz.old and initrd.img.old to boot though otherwise worked for me….

  37. Ian
    March 13th, 2010 at 09:50 | #37

    The commands for starting still work for me, but now nothing will prevent it from happening again, even reinstalling or grub-update or grub-mkconfg. any other advice?

  38. Farshad
    March 14th, 2010 at 13:18 | #38

    Hi,

    Thanks for the very nice instructions Omar. I will try it now (one last time).

    Sad to say that I chose wubi thinking it would be the easiest way for a newbie to get on board with Linux and Ubuntu. Given this amount work and time that everybody has wasted on wubi (judging by the tons of blogs and requests from a lot of people) I am thinking about removing it altogether.

    WUBI was supposed to be easy!

  39. March 16th, 2010 at 10:51 | #39

    I just wrote a new post on how to FINALLY fix this problem. It’s a lot easier to fix it then I thought it would be. Basically all that’s required is a swap of the wubuildr file in the Windows c:\ drive (this is what wubi uses to trick Linux into thinking that it’s booting from a native linux partition). For a link to the new fixed file, go here: http://www.omaregan.com/?p=608

  40. Farshad
    March 17th, 2010 at 19:27 | #40

    I tried this and worked like a charm. thanks again Omar.

  41. March 18th, 2010 at 19:11 | #41

    I love you.

    For people using these instructions, if you get stuck at a second command-line starting with (initramfs), it means you chose the wrong partition. This happened to me when I tried sda1; using sda2 fixed it.

  42. mike
    March 28th, 2010 at 15:59 | #42

    Thank you, Thank you, Thank you. Worked great.

  43. Stovokhor
    April 1st, 2010 at 00:29 | #43

    Thanks man!!!! Great!!!

    But in spite of your great explanation, i had to struggle about an hour to get it running. The Problem was, after executing the statements above, my system performed a reset (so far so good) went to the boot screen and again i stranded in the grub shell.

    Reason was not the wrong partition number, but the wrong kernel version. When using the newest kernel it did not work, just after selecting the version before, it worked. I don’t really know why, because i am a ubuntu newbie too, but maybe you want to take this point into your article as little hint in the footer.

    Regarding the all-time fight between Windows and Linux users: I think times have changed.

    I really love ubuntu in combination with kde. But it is far too instable. Since 2 month i have ubuntu on my system and nearly every week i have to fix some magic crash which REALLY WAS NOT MY FAULT!!! *sigh*

    In the last few years, i think starting with win xp, Microsoft has done a great job in creating an easy to use and absolute stable operating system. Regarding usability ans stability, windows is on top of all right now. That was not always like this. In times of win95, 98 and ME system crashes and blue screens were nearly daily experiences and maybe in that times, linux was the better OS. But now the world has changed. I really can’t remember the last system crash, blue screen or something like this crazy “i-update-my-os-and-afterwards-nothing-works-anymore” issue.

    Hope, the ubuntu distro will someday catch up someday because i really, really like it and will never ever erase this os from my disks.

  44. April 2nd, 2010 at 10:31 | #44

    Hi all!
    It seems that at least I’ve found the place where the people understand my problems :) .

    But trying to follow the instructions I’ve realized that it seems that I don’t have kernel. Is it possible? I’ve no ‘vmlinuz-…’ like file at boot/
    What can I do?

    *I’ve already replaced wubildr at c:/

    Thnx!

  45. kaufi
    April 16th, 2010 at 16:54 | #45

    Guyz, I found out that there is a problem with Omar’s fist step of the solution:

    http://ubuntuforums.org/showthread.php?t=1339203

    The second step within the working Ubuntu works well!!

    So thanks to everyone for solving that!

  46. Armando Saldaña
    April 17th, 2010 at 10:52 | #46

    It work’s for me, i can access Ubuntu Karmik koala and rescue my data, thank you.

    I do this

    sh:grub> linux /boot/vmlinuz-2.6.31-14-generic root=/dev/sda2 loop=/ubuntu/disks/root.disk ro

    sh:grub> initrd /boot/initrd.img-2.6.31-14-generic

    sh:grub> boot

    And ubuntu runs

    i have installed Karmik Koala inside windows partition and, when i download and run the updates for the ubuntu, my ubuntu was killed…

    Thanks a lot.

  47. Bill Cassidy
    May 1st, 2010 at 19:10 | #47

    new fix at http://www.omaregan.com/?p=608 involves patching Wubildr with new version

  48. Jeremy
    July 9th, 2010 at 23:06 | #48

    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.

  49. divya kesharwani
    August 5th, 2010 at 19:58 | #49

    Thanks a lot man.. this worked pretty well.

    you are awesome.

  1. December 1st, 2009 at 07:45 | #1
  2. February 6th, 2010 at 01:10 | #2
  3. February 26th, 2010 at 18:52 | #3
  4. June 26th, 2010 at 20:14 | #4