WoeUSB and Windows Installation Media

22 October 2021

Every now and then I needed to make a Windows installation USB from Linux and forget how to actually do it. Some notes:

Download page screenshot for Windows 10 ISO

Install WoeUSB

Github: WoeUSB

On Arch Linux, it can be installed via this AUR package: woeusb; for example with yay:

$ yay -S woeusb

Download Windows ISO

It used to be some time in the past a nightmare to accuire an official Windows installation ISO. Looks like it has been improved. This Windows 10 ISO can be downloaded from Microsoft download page without log in.

Make a bootable USB

To create a bootable USB using WoeUSB:

$ woeusb --tgt-fs NTFS --device ./Win10_21H1_English_x64.iso /dev/sdX

It takes a while for WoeUSB to copy the ISO content over and perform various tasks, including intalling a bootloader on the USB. Execution output for future reference:

WoeUSB v3.3.1
Mounting source filesystem...
Wiping all existing partition table and filesystem signatures in /dev/sda...
/dev/sda: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sda: calling ioctl to re-read partition table: Success
Ensure that /dev/sda is really wiped...
Creating new partition table on /dev/sda...
Creating target partition...
Making system realize that partition table has changed...
Wait 3 seconds for block device nodes to populate...
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
--2021-10-22 12:59:11--  https://github.com/pbatard/rufus/raw/master/res/uefi/uefi-ntfs.img
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving github.com (github.com)...
Connecting to github.com (github.com)||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img [following]
--2021-10-22 12:59:11--  https://raw.githubusercontent.com/pbatard/rufus/master/res/uefi/uefi-ntfs.img
Resolving raw.githubusercontent.com (raw.githubusercontent.com)...,,, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288 (512K) [application/octet-stream]
Saving to: ‘/tmp/WoeUSB.rGzZNG.tempdir/uefi-ntfs.img’

uefi-ntfs.img                                                             100%[====================================================================================================================================================================================>] 512.00K  --.-KB/s    in 0.08s

2021-10-22 12:59:12 (6.31 MB/s) - ‘/tmp/WoeUSB.rGzZNG.tempdir/uefi-ntfs.img’ saved [524288/524288]

1024+0 records in
1024+0 records out
524288 bytes (524 kB, 512 KiB) copied, 0.264564 s, 2.0 MB/s
Mounting target filesystem...
Applying workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
Copying files from source media...

Installing GRUB bootloader for legacy PC booting support...
Installing for i386-pc platform.
Installation finished. No error reported.
Installing custom GRUB config for legacy PC booting...
Resetting workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.
/usr/bin/woeusb: line 1683: echo: write error: Invalid argument
Warning!: command "echo 0 > /proc/sys/vm/dirty_background_bytes" - returned code  $?
/usr/bin/woeusb: line 1684: echo: write error: Invalid argument
Warning: command "echo 0 > /proc/sys/vm/dirty_bytes" - returned code  $?
Unmounting and removing "/media/woeusb_source_1634867934_17450"...
Unmounting and removing "/media/woeusb_target_1634867934_17450"...
You may now safely detach the target device
Done :)
The target device should be bootable now