When you can’t get into Wubi Ubuntu…
With this short procedure you can try to repair the Ubuntu Linux installed by Wubi when it doesn't work and screen displays just "sh:grub>". The error occurs for example system update or when some changes are made in Grub (Ubuntu's loader). In most cases you'll be able to resolve the problem.
IMPORTANT UPDATE: There is much simpler and permanent solution to this problem available already. Thanks Nanina for tip.
If you have installed Ubuntu using procedure described in “Installing Ubuntu (almost) like a Windows application” article, it’s highly probable you have already stumbled upon a problem when you were stuck just with command line instead of booting up to Ubuntu Linux. This problem occurs mostly after updating the system, when it affects also Grub. The changes to Grub are not applied directly, so it doesn’t know what to do and defaults to command line. There the most of users (like me) get stuck wondering what has happened to their Ubuntu.
Before you start crying you’ve lost all the data, customization and everything you’ve kept in this Linux distribution, try following procedure. It should help you resolving the issue and restoring Ubuntu’s functionality or at least you should be able to get into Ubuntu and save your date before its reinstallation or complete uninstallation. This major problem is connected probably just with Wubi Ubuntu as I’ve never had such problem on standard system installation. To resolve, follow these 5 steps:
STEP 1.
First you have to find out the names of partitions on your disk and determine, where you put your Wubi Ubuntu installation. So into command line “sh:grub>” type in the command “ls -l” and press [ENTER] on your keyboard.
sh:grub> ls -l
The list of disk partitions will be displayed. Partitions are named like hd(0,1), hd(0,2), hd(1,1) or similarly. I believe “hd” stands for “harddrive”, first digit determines physical harddrive number (starting from 0) and second digit stands for partition number on that specific physical drive. You need to find out the partition name where Wubi stores Ubuntu folder. Unfortunately, I can’t see into your computer and can’t offer a good advice, but if you use disk labels like me, you should be able to determine the partition pretty quickly, because labels are also being displayed in the list.
When you have the name of the partition, lets take hd(0,1), you need to convert it into Grub terminology. Grub uses “sd” (SATA drive) instead of “hd”, “a, b, c…” instead of first “0, 1, 2…” digit and last digit remains the same and is just repeated in the name, brackets and comma are not being included. So our hd(0,1) example would become sda1. Write down this name of Wubi installation partition, you will need it in next step.
STEP 2.
Start typing in the command bellow. After typing in the “linux /boot/vmlinuz-“, press [TAB] on your keyboard to display available Linux kernel versions list. Choose the most current one (with the highest number) and type it in. (Note: if the procedure fails to run Ubuntu with current kernel version, try older one…) Continue typing the command ” root=/dev/” and input the name of Wubi installation partition you’ve got from previous step (in our case it was “sda1“). Finish the command with ” loop=/ubuntu/disks/root.disk ro” and press [ENTER].
sh:grub> linux /boot/vmlinuz-(kernel version – press [TAB]) root=/dev/(Wubi installation partition) loop=/ubuntu/disks/root.disk ro
STEP 3.
Continue with new command “initrd /boot/initrd.img-” and again use the same kernel version as in step 2. Then press [ENTER].
sh:grub> initrd /boot/initrd.img-(kernel version)
STEP 4.
If everything worked fine, after inputting the command “boot” and pressing [ENTER], the Ubuntu should start. In case that nothing is happening, try to repeat the procedure with older Linux kernel. If nothing helps even then, unfortunately I think you better try Google or reinstall Wubi Ubuntu completely…
sh:grub> boot
STEP 5.
We are not finished yet! When you get finally into Ubuntu, open the Terminal (Applications → Accessories → Terminal). In Terminal type the command “sudo update-grub” and press [ENTER] (you will also need to type in your password confirmed with [ENTER] key). Now the Grub should be updated completely and shouldn’t cause any trouble.
So, after this procedure just try to restart the computer and see on your own whether Ubuntu works how it should (at least until next major system update ;)).
Any question? Use comments…
thank you so much. it works perfectly
Sorry, I forgot to mention that I’m using ubuntu 9.10 and installed it through wubi on my windows 7. thanks :)
Hi, After crashing my ubuntu, I tried to shutdown the system by just pressing ON/OFF button on my laptop. the next time when I wanted to reboot ubuntu 9.10 at Grub, it was landed in sh:grub. ls command shows only (hd,0)(hd,1)(hd,3) with NO loop0. I cannot even find kernel (vlmlinuz-…). Is there any solution?
thank you sooo much! I already lost my files but when i tried again by reinstalling it, it didn’t worked! I couldn’t find the solution until now! Thank you again! I will try it ASAP
@Lian Hi there! It doesn’t really matter how many kernels there are installed. Just use the most current one that works.
Anyway, Nanina (see bellow) have found a better and permanent solution for this whole problem (and the update of article was made – can be seen in its beginning). Check the link in Nanina’s comment. I’ve tried it myself and works flawlessly!
Good luck!
Thank you very much for giving such a helpful tip! But how to do that when there are more than one kernel? I have two kernels. Every time I boot ubuntu, I have to type the above scripts again and again. It’s very troublesome. I mean, when there are 2 or more kernels, it seems that the above method doesn’t work
@Nanina Thanks very much for the tip! Works fine for me and is much much easier than the procedure above. Great advice!
There’s an easier way to fix this here: easier fix of Wubi booting problem
Props to Richard Carter for directing me to this solution — Richard Carter blog