a1ive / grub2-filemanager

GRUB2-based file manager
https://a1ive.github.io/grub2-filemanager/
GNU General Public License v3.0
524 stars 106 forks source link

Cannot install Windows from USB boot to agFM #121

Closed steve6375 closed 4 years ago

steve6375 commented 4 years ago

image

Test on real system (not VM)

  1. UEFI64 Boot from agFM on a normal Legacy partitions USB drive
  2. Select Win10 ISO - 'Boot Windows from ISO'
  3. Proceed with install - at final stage (just before reboot) it stops with error.

I think the problem is caused by Windows trying to modify BCD etc. on USB MBR drive 0 instead of the internal GPT hard disk. Partitions on internal hard disk are GPT and look OK.

Also, a similar issue occurs with MBR boot to ISO

  1. MBR\Legacy boot from USB drive to agFM on normal Legacy USB drive
  2. Select Win10 ISO - 'Boot Windows from ISO'
  3. Proceed with install - all OK except on reboot, it is booting from the USB drive. The MBR has been updated with standard MBR and \bootmgr has been added to USB drive.

I think adding drivemap -s hd0 hd1 may fix MBR install issue.

Is there a similar command for UEFI ?

a1ive commented 4 years ago

No. UEFI firmware uses "Device Path", no drive numbers.

steve6375 commented 4 years ago

P.S. I am booting from a USB hard disk (not sure if that is significant yet).

a1ive commented 4 years ago

Does it work if you add drivemap -s hd0 hd1 here https://github.com/a1ive/grub2-filemanager/blob/df29f9fe139af7bfa7c327bf2d28865b97d5041e/boot/grubfm/distro/win.sh#L16

steve6375 commented 4 years ago

distro/win.sh seems to fix issue (tested in VM) image

a1ive commented 4 years ago

P.S. I am booting from a USB hard disk (not sure if that is significant yet).

"USB hard disk" -> do you mean 'external hard disk connected to USB port'?

steve6375 commented 4 years ago

Actually it is a Silverstone USB 3 adapter with an M.2 SATA PCB inside - but it is treated as an external USB hard disk. image

steve6375 commented 4 years ago

tested 'drivemap -s hd0 hd1' on IdeaPad 300 and VM. Seems to work fine.

Now how to solve UEFI issue ??? MS must do something when they install from USB drive??

steve6375 commented 4 years ago

It works OK booting from a Removable USB drive, Windows Setup does not see the USB drive as a valid installation drive.

steve6375 commented 4 years ago

I think I have found a solution!

I used map -u in distro\win.sh image

The loopback command seems to be required because map -u breaks the connection to loopback and also the connection to the XML file on the drive, but using the loopback command seems to fix both the boot.wim and the XML file issues.

I assume that using map -u is re-enumerating the drives but the USB drive is no longer flagged as the 'boot' drive and so Windows defaults to internal drive 0?

Can you test and confirm please? I will continue to test.

steve6375 commented 4 years ago

Seems to work so far... :-)

a1ive commented 4 years ago

Why do you use map -u?

steve6375 commented 4 years ago

To avoid the error in the first post.

a1ive commented 4 years ago

It doesn't change drive order in firmware.

steve6375 commented 4 years ago

My theory was that the USB drive would no longer be flagged as the 'boot device' and so Windows will not try to install boot files to the USB drive. However, I now cannot reproduce the original problem!

steve6375 commented 4 years ago

I still cannot reproduce the original problem now, either in the VM which repeatedly failed before, or on the IdeaPad 300 which also repeatedly failed! Since the VM won't have changed, I can only conclude that there was something on the MBR partitions of the boot USB drive which Setup did not like. I did notice that when I install Windows, the date of the \EFI\Microsoft\boot\bcd file which I have on the 2nd FAT32 partition of my USB drive for booting to WinPE is getting changed (but the contents has not been changed). I will close this issue as I cannot now reproduce it.