Boot Win10 from an ISO-Image on a certain partition using GRUB2

3

3

I have bought a laptop (Lenovo ThinkPad T520) with a locked BIOS. So I can't change the boot order of the laptop. The upmost device in the boot order is the internal HDD. Fortunately there is a working Linux with Grub2 installed, which I have access to.

I also want to install Windows 10 now. How do I have to change the Grub2-configuration in order to be able to boot the Windows-installation from a Win10-Boot-Medium (ISO)?

Arch Linux Tux

Posted 2018-09-05T19:48:12.717

Reputation: 275

Answers

7

To boot the Win10-Image from your HDD:

  1. Add the below code to /etc/grub.d/40_custom
  2. Back up /boot/grub/grub.cfg with sudo cp /boot/grub/grub.cfg.bak. (Or add a number, if there already is a grub.cfg.bak.)
  3. Then run sudo grub-mkconfig -o /boot/grub/grub.cfg.

Grub2-configuration:

menuentry "Windows 10" --class windows --class os {
    # Insert modules needed in order to access the iso-file
    insmod part_gpt
    #insmod part_msdos

    insmod ntfs
    #insmod ext2

    # Insert module needed in order to find partition
    insmod search_fs_uuid


    # Set UUID of partition with the iso-image
    # and let grub2 find the partition
    # (save it's identifier to the variable $root)
    set uuid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    search --no-floppy --set=root --fs-uuid $uuid

    # Mount the iso image by addressing it with (partition)/path
    set iso=/images/Win10_English_x64.iso
    loopback loop ($root)$iso


    # boot (chain-load) the image using the cdboot.efi file located
    # on the win10-image
    chainloader (loop)/efi/microsoft/boot/cdboot.efi
}

Instructions:

Replace XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with the UUID of the partition, that holds the Windows 10 image.


insmod part_gpt: This module is needed, if the Win10-ISO-Image lies on a drive with a GPT-partitiontable.

insmod part_msdos: Choose this one over insmod part_gpt, if the image lies on a drive with DOS-partitiontable.


insmod ntfs: This module is needed, if the Win10-ISO-Image lies a NTFS-partition.

insmod ext2: Replace insmod ntfs with insmod ext2, when the image lies on a ext2/ext3 or ext4 partition.

Arch Linux Tux

Posted 2018-09-05T19:48:12.717

Reputation: 275

I have a system that boots in Legacy BIOS mode. I have an iso on an ntfs partition so I chose insmod ntfs and chose insmod part_msdos (and in a separate attempt insmod part_gpt1) but I geterror: invalid signature` which my research shows has something to do with UEFI. WHich seems to relate to cdboot.efi. What should I use for legacy bios mode? – 0fnt – 2019-01-26T18:22:20.920

@0fnt Take a look at: https://wiki.gentoo.org/wiki/GRUB2/Chainloading#Windows_.28MSDOS_based_boot_loaders.29 Try adding insmod chain and replace the last line with chainloader (loop)+1

– Arch Linux Tux – 2019-01-27T15:34:32.123

1https://superuser.com/users/352691/arch-linux-tux @arch-linux-tux Thanks- I tried it but I had the same error: invalid signature. I even had secure boot disabled. For now I copied ISO contents to a partition and used ntldr /bootmgr but if you do come across a solution- please do mention. Thanks – 0fnt – 2019-01-28T06:16:01.480

this won't work in UEFI, it throws not avalid root device – Wang – 2019-10-25T20:59:37.757

0

If you're using UEFI and only looking for a temporary solution (to run the installer), extract the Windows installer contents to a data partition (so it doesn't have a system on it). Make sure to have it at the top level, not in a folder, otherwise the installer fails to load. Then in GRUB enter the command line (c) and find the hard drive using ls, then enter chainloader (hdX,X)/efi/bootx64.efi and boot. This should boot into the Windows installer. After it finishes installing, you can delete the installer's files and folders:

autorun.inf boot bootmgr bootmgr.efi efi setup.exe sources support

NorbiPeti

Posted 2018-09-05T19:48:12.717

Reputation: 1