hakuna-m / wubiuefi

fork of Wubi (https://launchpad.net/wubi) for UEFI support and for support of recent Ubuntu releases
GNU General Public License v2.0
1.04k stars 149 forks source link

Ubuntu boots to Grub menu after Wubi Ubuntu wubi16041r311 #49

Open wildtouch75 opened 7 years ago

wildtouch75 commented 7 years ago

I installed Wubi from your wubi16041r311 file. I rebooted liked it asked. It loaded into Ubuntu to finish the install. I was even able to open Firefox and browse the internet while it finished installing files. Then It restarted and added Ubuntu to the boot options. When I select Ubuntu to load it says "tryntfs5(hd0.0) tryntsf5(hd0.1)

No Wubi ldr"

after it shows this, it then boots into a program called "Grub".

What do I do to get it to load the installed wubi16041r311 ? Is there anything I can do to fix this ? I am using windows 7.

hakuna-m commented 7 years ago

When I select Ubuntu to load it says "tryntfs5(hd0.0) tryntsf5(hd0.1)

No Wubi ldr"

These messages are only for information. The loader tries the first partition. If Ubuntu is not on the first partition (probably C: on Windows), it tries the second partition (probably D: on Windows) and so on.

But the last message should be a "try"-message without "no wubildr found".

after it shows this, it then boots into a program called "Grub".

It is intended that it boots into "Grub" and then into Ubuntu. But if there is only a GRUB prompt (grub> _) a GRUB configuration file is missing.

For a missing GRUB configuration file, you can try the second possibilty from here:

  • Reboot to Windows
  • Copy the attached file wubildr-disk.cfg.txt to folder ubuntu/install
  • Rename it from wubildr-disk.cfg.txt to wubildr-disk.cfg
  • Reboot to Ubuntu
wildtouch75 commented 7 years ago

I tried the solution unfortunately it did not work. I copied wubildr-disk.cfg.txt and renamed it to wubildr-disk.cfg and placed it into the folder ubuntu/install. I restarted the computer and loaded Ubuntu and it went back to the grub menu. So I loaded windows 7 and renamed the file to wubildr-disk.cfg.txt, saved it and rebooted back into Ubuntu and it still brought me back to Grub. I typed in boot on the grub command prompt and it said "you have to load the kernel first". Is there anything else I can do ?

hakuna-m commented 7 years ago

So I loaded windows 7 and renamed the file to wubildr-disk.cfg.txt, saved it and rebooted back into Ubuntu and it still brought me back to Grub.

Only the file name wubildr-disk.cfg within ubuntu/install is supported by the existing Wubi loader configuration. If it doesn't work, you can also type the commands of the configuration file at grub command prompt.

loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
search --set=diskroot -f -n /ubuntu/disks/root.disk
probe --set=diskuuid -u $diskroot
linux /vmlinuz root=UUID=$diskuuid loop=/ubuntu/disks/root.disk ro quiet splash
initrd /initrd.img
boot

The advantage is that if a command fails, an error message appears. The drawback is that is more difficult to type all commands manually, especially with keyboards without US layout.

wildtouch75 commented 7 years ago

After I entered the command at grub a message stating " Unknown Argument --set=diskroot " appeared and it did not boot into ubuntu.

hakuna-m commented 7 years ago

Hmmm. In my previous posts, I assumed a prompt of GRUB2 which is not in rescue mode. But there are different possibilities for grub prompts, especially if you need the Wubi boot loader for a non-UEFI system. That boot loader uses GRUB4DOS and then GRUB2.

wildtouch75 commented 7 years ago

When I select Ubuntu to load it goes into Grub and displays the following "GNU Grub Version 2.02beta2-36ubuntu3.8 Minimal bash liked editing supported"

I installed the Ubuntu ISO.

hakuna-m commented 7 years ago

"GNU Grub Version 2.02beta2-36ubuntu3.8 Minimal bash liked editing supported"

It is GRUB2. If we assume that your root disk is on the second partition of the first hard disk because of the two tries:

When I select Ubuntu to load it says "tryntfs5(hd0.0) tryntsf5(hd0.1)

...(hd0,1) for GRUB4DOS should be (hd0,2) for GRUB2 and /dev/sda2 as device name. So we can try the following commands:

insmod ntfs
set root=(hd0,2)
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /vmlinuz root=/dev/sda2 loop=/ubuntu/disks/root.disk ro
initrd /initrd.img
boot

If an error occurs or just for infomation, you can try set to list all settings and ls to list devices, folders and files

wildtouch75 commented 7 years ago

I entered in the command and got no response. I got a list of options when I entered the command set but when I tried to use the commands it listed I got no response. I also got no response from entering in the command 1s.

hakuna-m commented 7 years ago

I entered in the command and got no response.

No response means that the command was successful by default. e.g. if you type set root=(hd0,2) there is no response, but if you list the settings with set there should be a line: root=(hd0,2) and if you type loopback loop0 /ubuntu/disks/root.disk no response means that the path /ubuntu/disks/root.disk exists. e.g. if you type a non existing path there should be an error message.

But I try to explain what the commands should do: insmod ntfs loads the module for NTFS file system that GRUB can read Windows partitions with that file system. set root=(hd0,2) sets a partition for the following commands loopback loop0 /ubuntu/disks/root.disk assigns the file /ubuntu/disks/root.disk to loop0. The root setting in the previous command is important that GRUB knows the partition which contains that file. set root=(loop0) For the next command we set root to loop0 which is assigned to the file /ubuntu/disks/root.disk on (hd0,2) linux /vmlinuz root=/dev/sda2 loop=/ubuntu/disks/root.disk ro assigns /vmlinuz within (hd0,2)/ubuntu/disks/root.disk as vmlinuz and additionally the Wubi disk /ubuntu/disks/root.disk on /dev/sda2 initrd /initrd.img assigns /initrd.img within (hd0,2)/ubuntu/disks/root.disk as initrd boot boots with the previous defined options

wildtouch75 commented 7 years ago

Everything enters fine but when I get to the command " linux /vmlinuz root=/dev/sda2 loop=/ubuntu/disks/root.disk ro" it says "Unknown Filesystem".

hakuna-m commented 7 years ago

That means that the filesystem within /ubuntu/disks/root.disk is unknown. Maybe, it has been corrupted during first reboot after successful installation.

Can you list the folder contents of /ubuntu/disks at grub prompt?

ls -l (hd0,2)/ubuntu/disks

Note: l within -l is the letter L in lower case.

That should be print a size in bytes and a timestamp of all files within /ubuntu/disks. If root.disk has a size of zero bytes, I assume that Windows program CHKDSK thought it was corrupted and set the size to zero bytes.

If it is a fresh install, it is too much effort to recover the content of the file. Just repeat the installation.

edit: If the file size is OK, you can try to correct it with a live system.

wildtouch75 commented 7 years ago

I typed in the command "ls -l (hd0,2)/ubuntu/disks" and it responded with " Unknown Command "l".

wildtouch75 commented 7 years ago

I uninstalled and reinstalled wubi16042r319 and it is still booting to Grub.

wildtouch75 commented 7 years ago

I also tried installing wubi14045r310. It would install alright and everything seemed fine but once it did it's final restart to finish the installation it would load back to Grub when selecting Ubuntu in the boot options. I also tried installing Lubuntu to see if that help but it did the same thing and loaded back to Grub once the installation restarted the computer.

hakuna-m commented 7 years ago

but once it did it's final restart to finish the installation

To be sure that we mean the same restart: The final restart is the second one. There is the first part of the installation on Windows. Then there is a restart. After that restart a message appears:

Completing the Ubuntu installation."
For more installation boot options, press `ESC' now...

Then there is the Ubuntu part of installation. After that there is the final restart.

If you mean the first reboot after the Windows part of installation, it is not possible to use root.disk for booting because it is empty.

Is there a second folder ubuntu on another Windows drive ? GRUB uses the first matching folder ubuntu. It doesn't matter if you select another drive in the Windows part of installation. Maybe, it is not the folder of your current installation.

wildtouch75 commented 7 years ago

That is correct it is the second restart, it first restarts from windows and loads ubuntu. After it installs the needed files it then restarts a second time and that is when it loads into Grub. I installed Wubi-Ubuntu on C: drive. There is no second drive only the C: drive.

hakuna-m commented 7 years ago

There is no second drive only the C: drive.

But IMHO there is at least one hidden drive. Maybe, it is the Windows boot partition, a recovery partition or a backup partition. The Wubi disk (/ubuntu/disks/root.disk) is on the 2nd partition (hd0,2) but there is also a 1st partition (hd0,1).

So you can try, if other partitons with a Wubi disk exist at grub prompt:

For the first partition:

set root=(hd0,1)
loopback loop0 /ubuntu/disks/root.disk

For a possible 3rd partition:

set root=(hd0,3)
loopback loop0 /ubuntu/disks/root.disk

For a possible 2nd device with a its first partition:

set root=(hd1,1)
loopback loop0 /ubuntu/disks/root.disk

On Windows, you can check, if the root.disk within C:\ubuntu\disks has a zero byte size.

I was even able to open Firefox and browse the internet while it finished installing files

It is possible to check internal files with Firefox during second part of installation.

file:///host displays the Windows partition with the root.disk. It should be C:\ on Windows. But, maybe it displays the files of a hidden drive.

file:///target displays the content of the Wubi disk.

Maybe, it is also helpful to check some log files, if you "try verbose" mode (*) during installation: file:///var/log

Helpful log files are:

e.g. file:///var/log/installer/debug should contain the used disk and Windows partition:

debconf (developer): <-- GET partman-auto/disk
debconf (developer): --> 1 /dev/sda
debconf (filter): <-- GET partman-auto-loop/partition
debconf (developer): <-- GET partman-auto-loop/partition
debconf (developer): --> 1 2

means that the disk is /dev/sda and the partition is no 2

(*) Verbose mode: To do so, press "ESC" if the following message appears:

Completing the Ubuntu installation."
For more installation boot options, press `ESC' now...

After that an option menu appears where you can select "Verbose mode".

wildtouch75 commented 7 years ago

When I entered in the command "set root=(hd1,1) loopback loop0 /ubuntu/disks/root.disk" it stated "Cannot get C/H/S values. I also checked the windows C:\ubuntu\disks there is one file root with 29.0GB and another for swap that has 256mb.

hakuna-m commented 7 years ago

...and the other partitions ? e.g.:

set root=(hd0,1)
loopback loop0 /ubuntu/disks/root.disk

file not found ?

mhamzas commented 7 years ago

I was facing the same issue. The solution was using NTFS partition instead of exFAT. Choose ntfs partition in Wubi setup and try again.

Pasupathi-Rajamanickam commented 7 years ago

Just curious, I installed ubuntu into a external Micro SD card. Is there a way to boot from that? I'm getting the same error.

hakuna-m commented 7 years ago

@popkutty

I'm getting the same error.

Same error means that

Is that correct in your case ?

In that case, a workaround for non UEFI systems should be to replace the file wubildr within root directory of the Windows drive(s). e.g. C:\wubildr with that one within ubuntu\winboot folder e.g. D:\ubuntu\winboot\wubildr

ubuntu\winboot contains a wubildr from wubi.exe. The first part on Windows copies the wubildr to the root directory of the Windows drive(s). The second part of installation (after ESC message) generates a new wubildr with less GRUB modules to the root directory of the Windows drive(s).

In most cases, it is not necessary to add all modules because

But if installed Ubuntu is not found because of a missing module, it is not possible to load that missing module from installed Ubuntu.

So if you replace the new generated wubildr with the old one from wubi.exe, boot into Ubuntu should work again.

Pasupathi-Rajamanickam commented 7 years ago

@hakuna-m First of all sorry for the delay reply. Install on Windows works - Done. Reboot after ESC message works - I didn't see such thing. I'm using Windows 10 and with that stupid UEFI boot manager. I disabled secure boot. I could see Ubuntu in boot menu. When I select that, I'm getting this error. minimal bash-like line editing is supported

I installed ubuntu to new SD card sitting at e: as per Windows. I did copy d:\winboot\wubildr to c: still same error. I also copied wubildr.mbr

hakuna-m commented 6 years ago

@popkutty Sorry for my late reply.

I'm using Windows 10 and with that stupid UEFI boot manager.

In UEFI mode, it is another issue.

I did copy d:\winboot\wubildr to c: still same error. I also copied wubildr.mbr

That workaround cannot work in UEFI mode because wubildr and wubildr.mbr are for Legacy BIOS mode only.

But good news. We reproduced also your issue on some computers.

The issue is that GRUB2 does not get all device information from standard firmware/BIOS interface. So GRUB2 does not see all devices. A possible workaround is to add GRUB2 modules for native disk support.

I'll create a new branch for testing because I expect side effects for users who don't need native disk support.

Pasupathi-Rajamanickam commented 6 years ago

@hakuna-m any update on the new build for UEFI?

hakuna-m commented 6 years ago

@popkutty

I still haven't merged native disk support from 1704r324n to 1704r325 because of drawbacks, especially the missing chainloader support.

IMHO, we should only enable native disk support if GRUB fails without native disk support. But currently, there are still GRUB issues.

Of course, it would be possible to copy the changes of 1704r325 to nativedisk branch.

But does that really help ?

The main fix of r325 is to avoid Secure Boot issues. But Secure Boot issues are already solved if someone notices that native disk support is needed.

e.g. Someone tries 1704r325 -> manages Secure Boot issues with that release -> notices that native disk support is needed -> tries 1704r324n -> r324n works as intended without Secure Boot issues because uninstalling of r325 didn't reset Secure Boot settings.

Pasupathi-Rajamanickam commented 6 years ago

@hakuna-m Sorry too technical to feed into my brain. So if I use 1704r325 it will work fine but I can't use my native disk meaning, I may not see my existing SSD drive but I can only use SD card where ubuntu is installed. I can boot back to Windows to use my SSD. Am I correct?

hakuna-m commented 6 years ago

@popkutty

So if I use 1704r325 it will work fine

Probably, it still does not work if you have not changed the drive where Ubuntu is installed since you wrote:

When I select that, I'm getting this error. minimal bash-like line editing is supported

So for that issue, 1704r324n is still the best version.

I only meant in my last post that it makes no sense to create a new version 1704r325n with the Secure Boot fix of 1704r325. Because if you get

minimal bash-like line editing is supported

you already passed the possible Secure Boot issue.