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…
I have two Wubi systems running Windows XP and Ubuntu 11.04. Both are now having a loader problem. When I select Ubuntu instead of Windows XP at
startup, grub shows up instead of Linux. According to Ubuntu, my Linux kernel is 2.6.38-8-generic. I have obtained the following grub data in response to "ls -l"
as indicated below, in an attempt to obtain the partition number per your excellent article's suggestion.
grub> ls -l
Device memdisk: Filesystem type tarfs – Total size 20 sectors
Device hd0: Not a known filesystem – Total size 78148168 sectors
Partition hd0,msdos1: filesystem type ntfs. UUID D2A0C8EBA0C8D75F – Partition starts at 63 – Total size 78140097 sectors
Device fd0: Not a known filesystem – Total szie= 2880 sectors
Can you tell me how to translate this data into a meaningful partition number to grub? Without it I won't be able to issue the next >grub command.,
namely >grub linux ….
I hope you can understand my writing. Thank you very much.
Julian Loui
Virginia Beach, VA
Hi Julian,
Sorry for my late answer, it might be possible that you've resolved the issue already…
Anyway, I am not a Linux specialist, just enthusiast but I will try to help you.
First of all, have you tried the solution Nanina suggested below? I've tried it 2 years ago and never had a problem since.
From what you wrote I would try "sda1" partition, although this is just wild guess a I presume you keep Wubi Ubuntu install on hd0,msdos1 partition. Maybe this helps too to determine the partition name:
http://www.gnu.org/software/grub/manual/html_node/Naming-convention.html
http://www.google.com/search?q=grub+partition+naming
I hope you resolve the issue.
Oliver
By the way, do you have SATA disk inside? As from what I know, grub's "sd" stands for SATA drive. And maybe there is some other command for older PATA (or other) drives?
Andre, thanks a lot for your post very ufsuel.I think you should submit it to the ubuntu wiki.Your solution is way better than booting GRUB, then NTLDR or vice versa.For some people NTLDR menu could be a better option than GRUB.
When I issue the "ls -l" grub command, grub indicates the partition as "hd0,msdos1". Since I cannot obtain the kernel number by using your suggestion of hitting thr Tab key, I just enter the actual keenel, which happens to be 2.6.38-8-genric, in my case. When I issue the completed Step-1 grub command, I see a "File not found" error. Can you tell me how to correct this error. Thanks very much.
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