Fixing a broken Wubi Grub

Its happened so many times; I make a fresh wubi install and update it, and then on reboot I find myself dropped to a grub shell. I could never figure out why it broke, or how to fix it. Luckily, I don’t have to! Someone else has finally found a solution!

Turns out, its dead simple. To boot back into ubuntu just takes three lines on the grub shell:

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

Then once you’re back in, simply reinstall the package “grub-pc”. No more reinstalls and losing whole configurations! I much prefer being able to fix a problem than simple admit defeat with a reinstall, and my hope in wubi was fading. Maybe this bug will be fixed properly soon, but in the meantime, at least i can work around it when it happens.

    • Anonymous
    • December 20th, 2009

    Excellent!

    I had just reinstalled the OS and the problem persisted even after a complete uninstall / install of Ubuntu.

    This worked like a charm.

    Only snag was Synaptic had the re-install greyed out, so I had to go look up how to apt-get reinstall.

    sudo apt-get –reinstall install grub-pc

    Thanks,

  1. hi, what I have to write in ‘Your version of the kernel’? I installed version 2.6.31.16.29, but I really dont know how to write…

    Thanks a lot
    g4b0

    • Actually, if you press tab once you’ve gotten that far, the autocomplete should actually fill in your kernel version automatically. If not, then before you execute that command, try ” ls /boot” first to list which kernel version you have.

  2. Hi, I found it! It’s /boot/vmlinuz-2.6.31-16-generic (the same for the initrd).

    Now I don’t know how to put as root. I’ve got an acer aspire one 531h with just a sata disk, two partition. Windows is on the second partition.

    Tryed:

    /dev/hda
    /dev/hda1
    /dev/hda2
    /dev/sda
    /dev/sda1
    /dev/sda2
    (hd0,1)
    (hd0,2)

    No one works. Please help me!!!

    • Maybe try “/dev/sdb1”?
      I can’t promise it’ll work, there’s not much I can suggest here except to just keep trying different ones until you find the right one. Maybe try “find /boot/vmlinuz” to see if it tells you which partition number and then “/dev/sda[number]”.

    • jgalaxy
    • January 19th, 2010

    This worked for me. Took a while to find a kernel that was not corrupt, but it worked. I had to re-install ‘grub-pc’. I tried re-installing from Synaptic Manager to no avail. I finally went to the command line and “sudo grub-install”. Now if I can only find a way to refresh my 4 other kernals that appear corrupt …

    • jgalaxy
    • January 19th, 2010

    I should also add that I needed to “sudo update-grub” as well.

    • Paul Braham
    • February 14th, 2010

    I want to have your babies! – This worked a treat and recovered a system I would have cried if I lost!!

    • Ryan
    • March 5th, 2010

    I screwed up the grub file from my wubi install. I followed these directions but after “boot” my System gives up waiting for a root device and drops to an initramfs shell. Not sure what to do from here.

    • Sounds to me like you specified the wrong device under /dev.
      If you’re not sure, a bit of trial and error will usually find the correct one (depends on your partitioning and such). For me, its /dev/sda3 usually.

    • Bips
    • March 5th, 2010

    hi,

    when i issue ls /boot it does not show anything ?

    • why are you trying “ls /boot”?
      The tab autocomplete should be good enough.

    • Anonymous
    • March 7th, 2010

    My /dev/ folder doesn’t have any sda’s in it… I know though that my windows installation is the second partition on the only hard-drive I have installed. Any idea what I should put for root=”…” in the first command? I’ve tried (loop0), (hd0), (hd0,2), and (hd0,1) (these are all the partitions I find from the “ls” command), which all fail, ending in a “Kernel Panic”.

      • anonymous
      • March 10th, 2010

      it seems you are using windows 7 with wubi ubuntu🙂 you should use

      root=/dev/sda2

      tried and it works.

    • ky
    • March 10th, 2010

    hi calamari🙂

    we have very common knowledge, computer science, japanese, linux but country difference🙂 anyway, thx for posting this solution, it helped me much.

    other solution is replacing wubildr file (c:\wubildr) with stable one. there is a file in launchpad but I cannot find the link now, I try to add here asap.

    my idea is after applying this solution, re-installing grub would be better, but I’m not sure if the problem occurs again. linux, there always fun exists!🙂

    take care!

    • James
    • March 31st, 2010

    This saved me a lot of work — thank you very much.

    • Chris
    • April 10th, 2010

    Thank you! This is exactly what I was looking for!

    • John
    • April 15th, 2010

    How do you figure out your kernel version from the grub menu?

      • John
      • April 15th, 2010

      Oops my bad, I read that you have to press TAB at /boot/vmlinuz- BUT I type it in exactly like this:

      linux /boot/vmlinuz-THEN I SPAM TAB but it doesn’t do anything at all. Please help.

      • If tab isn’t working… then I dunno. Sounds like it could be a different problem if it can’t even find your /boot.

        • Niels
        • August 4th, 2010

        I’m know suffering the same problem mentioned here. My config was booting fine last night and now I drop to GRUB (consistent).

        So tried to apply the solution. However, when doing “ls /boot” I get “boot bootmgr” as output. No trace of vmlinuz. Also when doing “linux /boot/vmlinuz-” and hitting TAB there is nothing showing.

        Anything else I should be doing? Anywhere else I should be looking? (Running Ubuntu 9.04 with Wubi on Vista)

  3. Thanks for the info, it was very helpful.

    I am using WindowsXP and the correct partition for me is root=/dev/sda1

    • electron
    • July 1st, 2010

    thanks alot for the info . worked perfectly.

    • Uriel Juliatti Valle
    • April 1st, 2011

    I’m trying to complete with TAB after vmlinuz- but NOTHING happens.

    I don’t know what to do. I’m completely lost with this and almost reinstalling the Ubuntu 10.10 64 bits System again….

  4. Hey,

    Thanks a lot for your post man. It saves my life. Initially, I had problem in finding the correct windows drive due to which it drops to an initramfs shell.

    But after a while, I found the correct Partition number little above from initramfs on screen mentioned as ‘sad: sda1 sda2’.

    This was the quick hint for the windows drive.

    ~keep clicking🙂

  5. Thanks for this information! Should come in handy in the future.

    • ashwin
    • November 3rd, 2011

    I just install the new ubuntu 11.10 version on my pc
    but its not showing while booting ,i have windows xp and windows 7 on my pc
    can u write me the details steps to solve this problem .
    i am new to ubuntu

    • XBoy
    • January 14th, 2012

    Okay, this is what you do when you somehow face “no such device” during your wubi grub booting..

    In the menu before when you can pick your kernels, you click e for edit for the usually most current kernel version the menu is counting down on you to be loading automatically in a few seconds..

    As shown above you replace for once the UUID part with the real /dev/sda1,2,3,4,5 Look up a few lines in the grub lines where it says (hd0,5) or alike, that is the one😉 so it then is /dev/sda5

    Remove in all other lines the UUID stuff.

    Then hit CRTL X to boot your changes. If it works, you did all fine. Else, play around till you changed it how I have explained you here..

    The no such device error means the UUID given is no longer valid. So, we kick it out and replace the boot partition by root=/dev/sdaX (x being the partition number)

    DON’T forget. Grub has not changed yet! So, if you can boot into your system all the way run sudo update-grub and a new UUID is put to where the old one once was.. Bingo!!

    If you want to backup your data b4 playing around with the above get ext2explorer for windows, then you can read out your ubuntu root.disk!!
    http://www.hashincludetechnology.com/access-linux-partition-on-windows/

      • julianvb
      • March 24th, 2012

      Hi, Everyone,

      I have not been able to see my Wubi boot-up screen since
      two days ago after I attempted to create a Windows XP
      restoration point. Tonight I added a line to c:\wubildr
      file as advised by some website. Now my computer shows
      WIndows XP and Unbuntu at boot-up. But when I select
      Ubuntu, only GNU Grub shows up.

      The advice here sounds great. Since I cannot get into
      Ubuntu, how can I find out my Linux kernel version and
      Windows partition?

      Thank you very much.

      Julianvb

    • julianvb
    • March 24th, 2012

    Hi, Everyone,

    I have not been able to see my Wubi boot-up screen since
    two days ago after I attempted to create a Windows XP
    restoration point. Tonight I added a line to c:\wubildr
    file as advised by some website. Now my computer shows
    WIndows XP and Unbuntu at boot-up. But when I select
    Ubuntu, only GNU Grub shows up.

    The advice here sounds great. Since I cannot get into
    Ubuntu, how can I find out my Linux kernel version and
    Windows partition?

    Thank you very much.

    Julianvb

    • julianvb
    • March 25th, 2012

    2012-03-25

    When I enter the following Grub command
    >linux /boot/vmlinuz-2.6.38-8.gemeric root=/dev/sda1
    loop=/ubuntu/disks/root.disk ro
    Grub returns the fiollowing error message:
    error: no such file

    2.6.38-8-generic is the version of my Linux and my Windows
    partition is sda1.

  6. Thanks sooo much for the trick!!!
    Had almost planned to rebuild kernel image and all the stuff!

    for people who are still stuck, you can mount wubi image by yourself :
    http://sathyasays.com/2009/11/29/mounting-file-system-created-by-wubi-in-other-linux-distros/

    +

  7. With havin so much written content do you ever run into any problems of plagorism or
    copyright infringement? My website has a lot of exclusive content I’ve either authored
    myself or outsourced but it seems a lot of it is popping
    it up all over the internet without my agreement. Do you know
    any solutions to help stop content from being ripped off?

    I’d definitely appreciate it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: