How to Create Bootable Windows 10 image in Debian?

Pseudocode but originally developed for Windows 7 iso file but applied for Windows 8 in the thread How to create bootable Windows 8 iso image in Linux? but it does not work with Windows 10 iso

# https://rwmj.wordpress.com/2010/11/04/customizing-a-windows-7-install-iso/
# https://unix.stackexchange.com/a/312477/16920
$ dd if=../en_windows_10_x64_dvd.iso 
    of=boot.img bs=2048 count=8 skip=734

$ mkisofs -o ../new-win.iso -b boot.img -no-emul-boot -c BOOT.CAT 
    -iso-level 2 -udf 
    -J -l -D -N -joliet-long -relaxed-filenames .

Unsuccessful output when run on Windows 10 image
dd if=/home/masi/Downloads/en_windows_10_multiple_editions_version_1511_x64_dvd.iso of=/home/masi/Downloads/boot.img bs=2048 count=8 skip=734
8+0 records in
8+0 records out
16384 bytes (16 kB) copied, 0.000392973 s, 41.7 MB/s

Some of the following fields have changed for the iso file used in dd
  • bs=2048
  • count=8
  • skip=734

How can you study which field values you can use for Windows 10 iso?

OS: Debian 8.5 64 bit
Hardware: Asus Zenbook UX303UA
Linux kernel: 4.6 of backports
Related threads: How to create bootable Windows 7 iso image in Linux?, Customizing a Windows 7 install ISO
Motivation: I need Windows 10 to use Canon P-150 duplex scanner, but when I started my Windows, I got Error 0xC0000428 because Windows update has again broken things there and I use Windows otherwise so rarely; and I have no spare Windows left to make bootable media

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I tried the Win7 solution described by Microsoft on a Windows machine:

https://www.microsoft.com/en-us/download/windows-usb-dvd-download-tool

and obtained the

0x80080005 error

so went to Debian Stretch 9 to try to build the Windows 10 bootable USB using a e5.onthehub.com college/school ISO.

Using dd absolutely doesn’t work for Windows 10. This only works for Linux OSes. Use:

dd if=my-linux-os.iso of=/dev/sdX bs=4M

Note: Never try write to /dev/sdX1 where X={a,b,c or d} and always check you are not overwriting your hard disk which is usually /dev/sda or /dev/sdb!

For Windows 10 you can use WoeUSB but not from the apt/yum repos. These ones are obsolete, at least for Debian 9. So instead use:

git clone https://github.com/slacka/WoeUSB.git

Then follow the instructions at the end of:

https://github.com/slacka/WoeUSB

You must have all the prerequisites such as gparted and so forth installed first.

I also found at the end of the process that I must run woeusb with sudo. So you just use:

sudo woeusb --device local/of/my/windows-10-image.iso /dev/sdX

and hey presto it just works brilliantly. In my case my harddisk was /dev/sda and my USB drive was /dev/sdb so I wrote the ISO to /dev/sdb (again be careful, you don’t want to overwrite your OS by accident). I then installed it on a military class MSI motherboard with 2TB hard disk attached with no fast boot options inside the BIOS and it just works. I turned on absolutely every UEFI option first to get it into the right state.

I also had problems at install time, with the system hanging forever when using a Gmail email account for login and when the internet cable was connected at the second restart of the machine (during the install process). If you have this issue, disconnect internet, restart machine, let generic account be built, login, restart with internet cable

Method 2

This worked for me even with legacy/CSM boot (Ubuntu 16.04, Windows 10 Version 1511 32bit; you can use genisoimage instead of mkisofs as well, mkisofs is just a symlink):

mkisofs 
  -no-emul-boot 
  -b boot/etfsboot.com 
  -boot-load-seg 0x07C0 
  -boot-load-size 8 
  -iso-level 2 
  -udf 
  -joliet 
  -D 
  -N 
  -relaxed-filenames 
  -o win10-1511-32bit-mod1.iso 
  files/

(one long line, in bash with backslashes at the end for line continuation)

where files/ is the subdirectory which contains the extracted contents of the Windows 10 ISO.

The key point seems to be the etfsboot.com from the boot/ subdirectory of the Windows 10 ISO.

I can boot the burned disc with legacy/CSM without any problems.

I did only try out with the 1511 version of win10. If you try with other versions, please leave a comment.

Method 3

FAT32 is just working for a hard to find 2018 MS-image, and exfat is hassle. After trying a lot of complex how to’s that did not work, this 2 step solution succeeded:

  1. Make an ntfs-partion on the USB device.
  2. Execute
    woeusb --partition Win10_1909_Norwegian_x64.iso /dev/sdX1

To get woeusb working, I installed woeusb and grub2. Grub2 is a workaround for this:

grub2-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify `--target` or `--directory`.

I think Woeusb should be rewritten to find correct directory. My system had the file /usr/lib/grub/x86_64-efi/modinfo.sh from the grub2-efi package.

Method 4

The only reliable solution which I found for the case.
Create bootable Windows in Windows.

Method 5

If you are going to boot a UEFI-based computer, just mount the Windows ISO (take care that it is a UDF formatted ISO) and copy all files to the USB drive. As long as the drive is in FAT32 format, a UEFI computer will recognize it and it will offer the option to boot from it.

On the other hand, for a BIOS-based machine, the best option is to manually configure syslinux to chainload the Windows boot. I tried this on Windows 8, but not yet on 10. /dev/sdf is your USB drive.

  • Format the USB to FAT32
  • Make sure the USB has only one partition, and it is boot active (GParted will help with this)
  • Copy all files from the ISO to the USB drive
  • Install syslinux on your Linux system
  • Run syslinux -i /dev/sdf1 (the first partition on the USB drive, you can check on lsblk)
  • Run dd if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sdf bs=4M
  • Mount the USB drive and create the directory boot/syslinux
  • Copy all *.c32 files from /usr/lib/syslinux/bios to the boot/syslinux directory on the USB
  • Create a syslinux.cfg text file on boot/syslinux, with the text
    LABEL win10
    MENU LABEL Boot Windows 10 install
    COM32 /boot/syslinux/chain.c32
    APPEND label=win7fs ntldr=/bootmgr

Edit: I’m not sure where Debian puts the syslinux files; you can find them with find / -name "mbr.bin" 2> /dev/null

Method 6

Following @EamonnKenny approach, I could finally boot into the Windows 10 USB:

How to Create Bootable Windows 10 image in Debian?

I tried on an openSUSE machine, but ran into some errors. Finally tried on an Ubuntu machine and it worked. Here are all the commands which I ran:

$ git clone https://github.com/WoeUSB/WoeUSB.git
$ cd WoeUSB/
$ ./setup-development-environment.bash 
$ sudo apt-get install devscripts equivs gdebi-core
$ mk-build-deps 
$ sudo gdebi woeusb-build-deps_3.3.1-1-g7171bff_all.deb
$ dpkg-buildpackage -uc -b
$ sudo gdebi ../woeusb_3.3.1-1-g7171bff_i386.deb
$ sudo umount /dev/sd?
$ sudo woeusb --target-filesystem NTFS --device /path/to/Win10_2004_English_x64.iso /dev/sd?
$ sudo eject /dev/sd?

Note

--target-filesystem NTFS options of woeusb was necessary due to:

… source image has exceed the FAT32 Filesystem 4GiB Single File Size Limitation …

Method 7

UPDATE

Eventually, this approach did not work for me. Maybe I missed something, not sure!

Approach

This approach might be helpful:

https://linuxhint.com/create_windows_10_installer_usb_linux/

Note

In the above approach, when using cfdisk command, mark the partition as Bootable to have an Attribute: 80.

Method 8

Update

This approach did not work. BIOS detects the USB device as bootable, but when selecting the USB on boot menu, a blank screen is displayed before jumping to BIOS options again.

Approach

Combining this post and that one, I tried this approach, replace /dev/sd? with your device node:

  1. Optional: run sudo dd bs=4M if=/dev/zero of=/dev/sd? conv=fdatasync status=progress command to clean up the USB device
  2. Run sudo cfdisk /dev/sd? command and create a partition of b W95 FAT 32 type. Make it bootable i.e. it should be tagged with attribute 80
  3. Run sudo mkfs.ntfs /dev/sd?1 command to create a NTFS filesystem for the signle partition created in last step. If you want it to be faster, use it with -Q option
  4. Note: First I tried creating FAT32 filesystem, but ran into errors, due to FAT32 inability to handle files larger than 4 GB!
  5. Run sudo dd bs=4M if=/path/to/Win10_*.iso of=/dev/sdc conv=fdatasync status=progresscommand to transfer content to bootable USB device
  6. Run sudo sync command, just in case

Note

At some point, my 30GB USB device stopped working. It looked like broken! However, after letting it cool down, and zeroing out all the data inside it with commands like sudo dd if=/dev/zero of=/dev/sd?, it worked again =)

Method 9

I followed @user645644 approach up to bullet point 3

There was one error message during the copying process, install.wim in the sources folder is 5.3 GB which is too large for fat32.

I skipped that error message and there were no further errors.
I looked at the woeusb source code, and split a copy of the original install.wim into two install.swm files, install.swm and install2.swm using wimsplit install.wim install.swm 4095

wimsplit is from the wimlib.utils package on Fedora

I then deleted the faulty copy of install.wim and replaced it with the 2 install.swm files

It worked!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x