5

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)?

8

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.

| improve this answer | |
  • 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 get error: 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 Jan 26 '19 at 18:22
  • @0fnt Take a look at: wiki.gentoo.org/wiki/GRUB2/… Try adding insmod chain and replace the last line with chainloader (loop)+1 – Arch Linux Tux Jan 27 '19 at 15:34
  • 1
    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 Jan 28 '19 at 6:16
  • this won't work in UEFI, it throws not avalid root device – Wang Oct 25 '19 at 20:59
  • Both methods didn't work for me. I get either it can't find the file or isn't a valid device. I'm using UEFI. insmod part_gpt (table is GPT), exfat (I'm trying to load it from a exFat partition), search_fs_uuid, I've tried /bootmgr.efi, /efi/bootx64.efi, /efi/microsoft/boot/cdboot.efi. I'm using Grub2 v2.02. – Nova Apr 27 at 12:19
2

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.