Creating a Windows 7 USB on Fedora 25

Turns out Fedora 25 didn’t like my Samsung Series 9 (NP900X4C) much. Among other things, the WiFi was intermittent (weird, as it’s an Intel NIC), suspend didn’t work (the laptop is always dead when I come to it), and the keyboard backlight turned off immediately after turning it on. I figured installing Windows again might be a good move (I also miss Office), but that turned out a little more difficult that anticipated. Below is the steps I ended up taking, should anyone else encounter the same issue.

Get an ISO

First up: finding a valid Windows 7 Home Premium x64 ISO. Given that I still had my OEM key, this should not have been as difficult as it was. I finally found a workaround, thanks to this excellent guide on Raymond.cc (follow the “Download Windows 78.1 From The Windows 10 Download Page” section). With that “hack”, you should be able to pull in an ISO for the required version (Win7_HomePrem_SP1_English_x64.iso in my case).

Connect USB Drive

We’re going to install to a USB drive, so ensure it’s plugged in now. Record the device name - /dev/sdb in my case - for use later.

Prepare Your USB

This was another exercise in frustration. I followed many, many guides, all of which invariably ended in a failure. I suspect this is because the guides all recommended formatting my drive with NTFS when UEFI, as found on this laptop, requires FAT32. Thankfully, I stumbled upon a guide that suggested as much. This guide used GParted but unfortunately there’s a known issue with gparted on Wayland. A workaround for this issue is to allow “non-network local connections” by running the following command:

$ xhost +local:
non-network local connections being added to access control list

Then we can start GParted:

$ sudo gparted

Execute the following operations:

Once completed, Apply all operations, exit GParted, and disallow non-network local connections:

$ xhost -local:

Copy Files

You can now proceed to mount both the USB drive and the ISO:

$ sudo mkdir /mnt/usb
$ sudo mkdir /mnt/iso
$ sudo mount /dev/sdb1 /mnt/usb/
$ sudo mount -o loop ~/Downloads/Win7_HomePrem_SP1_English_x64.iso /mnt/iso/

updating paths where necessary.

Copy the contents of the ISO to the USB drive:

$ sudo cp -av /mnt/iso/* /mnt/usb/

Install Bootloader

We’re going to use grub2 as the bootloader. Run the following to install the bootloader on the USB drive:

$ sudo grub2-install --boot-directory=/mnt/usb/boot /dev/sdb

once again, updating paths where necessary.

Once completed, you should see the following message:

Installing for i386-pc platform.
Installation finished. No error reported.

If so, save the following to boot/grub2/grub.cfg on the USB drive:

default=1
timeout=15
color_normal=light-cyan/dark-gray
menu_color_normal=black/light-cyan
menu_color_highlight=white/black

menuentry "Start Windows Installation" {
    insmod ntfs
    insmod search_label
    search --no-floppy --set=root --label <USB_drive_label> --hint hd0,msdos1
    ntldr /bootmgr
    boot
}

menuentry "Boot from the first hard drive" {
    insmod ntfs
    insmod chain
    insmod part_msdos
    insmod part_gpt
    set root=(hd1)
    chainloader +1
    boot
}

replacing <USB_drive_label> with the label you used earlier - WIN7_HP_X64 for me.

Profit

Unmount the drive, insert it into the laptop and install Windows 7.

$ sync  # to ensure all file transfers are complete.
$ sudo umount
comments powered by Disqus