7

I use Debian Wheezy on EFI motherboard and need ntldr module in GRUB2 to load bootmgr of Windows 7 installer, because the way it starts on its own (apparently, using the boot sector of the USB flash drive the installer is on) it only installs Windows on MBR-formatted disk. When I install GRUB using grub-install it won't add ntldr.mod to the GRUB modules folder and can't insmod it.

  1. Why? When I only download GRUB package without installation (apt-get download...), the module can be found there. If I add the .mod file from the downloaded package to the installed GRUB's modules folder and then "insmod ntldr" from the GRUB command line, it says something about wrong "ELF magic" (?).
  2. How to do it forcibly?
  3. Is there another way to boot the Windows installer in the "GPT-mode", as I don't want to format the whole disk into MBR.
3

You downloaded the grub-pc package, which is for bios booting machines, so the module will not load in the efi version of grub. That module does not exist in the EFI version of grub because it relies on the bios.

If you want to boot the windows installer from a usb stick, then you shouldn't be doing anything with grub; just tell your firmware to boot that drive instead of your hd with grub on it.

0

Alexey, this issue is frequently seen in grub2. I came across this one, while browsing through the ubuntu forums, where it is marked as solved. Have a look at there : http://ubuntuforums.org/showthread.php?t=1343362 . Hopefully this will help you .

  • 2
    as I understood, they talk about the Windows ntldr, which is the OS losder itself; I talk about ntldr.mod of GRUB, which is used to load the ntldr of Windows from GRUB – alexey Sep 28 '12 at 10:55
0

I figured out the correct bootloader of Windows is hidden somewhere in the large packed files that come on the installation image. It can be unpacked, put into right boot directory and then loaded with GRUB2 chainloader as usually. I don't get why despite having right loader Microsoft hides it somewhere deep and places the strange one into default boot dir. It worked for me (though, I downloaded the file provided on the instructions page I found because it was quite some pain to unpack it). Unfortunately, I don't remember details, I found manual somewhere on the web, but the general idea is described.

  • Where? Where is this file? – HumbleWebDev May 28 '18 at 18:44
  • 1
    @HumbleWebDev try searching windows archives in the installation image for ntldr or efi or boot files/folders (e g with "find" utility), I think that time I went this way – alexey May 30 '18 at 12:40
  • I did find it. A youtube tutorial explaining how to create a bootable win7 USB medium gave me the answer. – HumbleWebDev Jun 11 '18 at 19:05
  • Is this what you were referring to/searching for? For booting from a Win7 iso it‘s: chainloader (loop)/EFI/MICROSOFT/BOOT/bootmgfw.efi Or for Windows 7 on a partition: chainloader ($root)/EFI/MICROSOFT/BOOT/bootmgfw.efi You may have to combine this and this. – Arch Linux Tux Sep 3 '18 at 21:02
0

The Mode (Legacy BIOS or UEFI) is determined by the bootloader that is installed on the USB-Stick and BIOS settings.

The Windows 7 installation medium should support both (Legacy BIOS and UEFI). For the latter, it depends on your settings. But since you can boot from your UEFI-HDD and your Win7-USB-Stick boots into Legacy BIOS mode, it should be set to "both" meaning that your BIOS supports UEFI and as a fallback can boot into Legacy BIOS mode.

In order to solve the problem I would advice you to install using a Win7-Image with UEFI-support (I don't even know, if there is one without) and also you should set your BIOS to UEFI mode explicitly (no combined mode).

But if this doesn't work and in order to answer your question: This should work:

Place the Win7-Image on your HDD or USB-Drive and choose the right modules (follow the comments):

menuentry "Windows 7" --class windows --class os {
    # Insert modules needed in order to access the iso-file
    # choose the right module for the partition-table-scheme the image lies on
    insmod part_gpt
    insmod part_msdos

    # choose the right module for the filesystem the image lies on
    insmod ntfs
    insmod fat
    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/Win7_English_x64.iso
    loopback loop ($root)$iso


    # boot (chain-load) the windows7-image using the bootmgfw.efi file located
    # on the Win7-ISO-Image
    chainloader (loop)/efi/microsoft/boot/bootmgfw.efi
}

If you want to dump the image directly to the usb-stick then you should leave away the set iso=- and loopback loop ($root)$iso-parts, that are needed in order to mount the iso. Your chainloader is then chainloader ($root)/efi/microsoft/boot/bootmgfw.efi

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.