12

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

1

11 Answers 11

16

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

4
  • Awesome. It helped me Commented Apr 17, 2019 at 17:51
  • This truly works, it should be the accepted answer.
    – MoonSweep
    Commented Apr 23, 2019 at 22:34
  • 2
    I had to use --target-filesystem NTFS like this: sudo woeusb --target-filesystem NTFS --device /path/to/image.iso /dev/sd? to avoid an error regarding file size larger than 4GB in FAT32 file system.
    – Megidd
    Commented Jul 16, 2020 at 8:23
  • woeusb from github did not work for me... but I found my own solution and posted it
    – louigi600
    Commented Sep 23, 2022 at 5:21
4

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.

4
  • No, genisoimage is a defective and dead variant of mkisofs. In case you only have a symlink, it is recommended to fetch a recent original that includes all the bug fixes and enhancements from the last 14 years.
    – schily
    Commented Jul 9, 2018 at 11:50
  • @schily In Ubuntu 16.04, mkisofs is just a symlink to genisoimage. I've just tried to describe the situation at the system I've used for this as best as I could. But thank you for the information! So now we know that building the image even works with the 14 year old and buggy genisoimage used in Ubuntu 16.04. BTW, invoking genisoimage -version on Ubuntu 16.04 results in genisoimage 1.1.11 (Linux)
    – bluefire81
    Commented Jul 10, 2018 at 18:57
  • 14 years ago, there have been many small bugs in the resulting filesystem image. Whether you notice them depends on what you do. Important: genisoimage has absoutely no UTF-8 support. This may be important unless you only use filenames with 7 bit ASCII. If you compare genisoimage with xorriso, genisoimage may be a win since it implements rudimentary UDF support. The new mkisofs on the other side supports user/group, permissions, symlinks, device files hardlinks and even chinese characters in filenames and better timestamps. Decide whether you are OK with a draft or like a mature program.
    – schily
    Commented Jul 10, 2018 at 21:28
  • this works, but not with uefi (like qemu ovmf)
    – bernstein
    Commented Jan 21, 2020 at 23:00
4

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

5
  • As I wrote already, I don't know where exactly syslinux files are on Debian. You can find the file with find / -name "mbr.bin" 2> /dev/null
    – user645644
    Commented Sep 28, 2016 at 11:16
  • 1
    Any of those are ok. Debian puts the *.c32 files at /usr/lib/syslinux/modules/bios/
    – user645644
    Commented Sep 28, 2016 at 21:00
  • 1
    To copy all the *.c32 files to the syslinux directory on your drive. Theoretically you only need chain.c32... but I like to have all on the images; they can be useful.
    – user645644
    Commented Sep 29, 2016 at 12:12
  • How to make sure it is UDF formatted ISO? Commented Oct 3, 2016 at 20:09
  • 6
    This may have worked in the past but not anymore, Windows images (.wim files) in recent Windows 10 builds exceed the file size limit of FAT32.
    – MoonSweep
    Commented Apr 23, 2019 at 22:36
4

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.

3

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

2
  • Fine if you don't obtain the 0x80080005 error which I did. Microsoft help completely useless for resolving the issue so I've presented my Linux Debian solution below. Commented Aug 9, 2018 at 9:13
  • The question was about doing it in Debian ... not windows. I may have found a way. I will post as soon as I get a chance to test it
    – louigi600
    Commented Sep 22, 2022 at 7:01
1

Update

This approach works fine for @TroyFolger. But I couldn't boot with the USB for some reason. Maybe my laptop's BIOS settings are messed up. Restoring BIOS to factory defaults didn't help.

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 single 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/sd?1 conv=fdatasync status=progress command to transfer content to the partition you just created. I mean the created partition on the 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 =)

7
  • 1
    mkusb can create a Windows installer in a USB drive, and it works in Ubuntu and Debian.
    – sudodus
    Commented Jul 16, 2020 at 8:43
  • 1
    Good luck with your detailed description :-)
    – sudodus
    Commented Jul 16, 2020 at 9:14
  • 1
    @sudodus I posted the approach which worked fine :)
    – Megidd
    Commented Jul 16, 2020 at 9:51
  • 2
    when you show the command for using dd to write the iso file ... you don't indicate the partition you just created, you show /dev/sdc as the target. Did you instead mean /dev/sd?1 ?? Commented Oct 25, 2022 at 21:57
  • 1
    I followed your steps and wrote the ISO to the created partition ... and it worked. Thank you. Commented Oct 25, 2022 at 22:05
1

Update

The next generation of WoeUSB might work for you: https://github.com/WoeUSB/WoeUSB-ng


Approach

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

Windows 10 USB finally boots!

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 ...

0

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!

0

I didn't want to install Windows, I just wanted to run the installer so I could get into recovery mode, open a Command Prompt, and then run a program, in my case a Dell firmware update.

In this case you can still follow the above instructions where you copy the files inside the downloaded .iso file onto a FAT32 partition, you just omit the large install.wim file. Obviously you won't be able to install Windows using that USB stick, but you can still boot to recovery mode and run your firmware update .exe files.

You don't need to run syslinux or anything, as UEFI searches FAT32 partitions for bootable files so it finds it automatically.

0

There are some issues with doing it from Linux generally:

  1. The official Microsoft ISO image is not a true dual mode (USB/CD) bootable ISO image, so you can't simply dd it to a USB stick.
  2. The Windows 10 sources/install.wim is larger than the FAT32 filesystem allows, so you can't just copy the contents of the ISO image into a FAT32 formatted USB stick

There is, however, a Linux workaround – just like the Windows dism tool, there is a Linux alternative: wimlib-imagex.

  • So mount the official ISO image – on /mnt, for example.  Prepare a file for the USB image (it will not fit on a 4 GB stick, so go for an 8 GB image).

    $ sudo mount -o loop  Win10_21H2_English_x64.iso /mnt 
    $ dd if=/dev/zero of=win10_inst.usb bs=4M count=1900
    
  • Format the image with FAT32.

    $ sudo mkdosfs -F 32 ./win10_inst.usb
    
  • Copy everything into a temporary folder and remove the install.wim.

    $ mkdir win10_inst   
    $ cp -apr /mnt/* ./win10_inst 
    $ chown -R $(id -un):$(id -un) ./win10_inst
    $ chmod u+w win10_inst
    $ chmod u+w win10_inst/sources
    $ rm ./win10_inst/sources/install.wim
    
  • Now use wimlib-imagex to split the install.wim.

    $ wimlib-imagex split /mnt/sources/install.wim  ./win10_inst/sources/install.swm 3800
    
  • Change the permissions on the newly created install*.swm.

    $ chown $(id -un):$(id -un) install*.swm   
    $ chmod a+rx   install*.swm
    
  • Umount the ISO image and mount the USB image.

    $ sudo umount /mnt   
    $ sudo mount -o loop win10_inst.usb /mnt
    
  • Copy the content of the temporary folder into the USB image.

    $ sudo cp -apr win10_inst/* /mnt/   
    $ sync   
    $ sudo umount /mnt
    

Now you have a valid USB image that will only boot in UEFI mode.  You can now dd or cat the image onto a physical USB stick the old way and it will work.

3
  • NOTE: man usb sticks are not exactly 8Gib but 8 commercial GB (8000000000 bytes) That is why the count is only 1900 ... so the image will fit hopefully any 8Gb USB stick
    – louigi600
    Commented Sep 22, 2022 at 9:00
  • You probably don't need the ./ in the ./win10_inst commands. Commented Oct 2, 2022 at 1:30
  • @G-ManSays'ReinstateMonica': probably but it surely won't harm
    – louigi600
    Commented Mar 9, 2023 at 12:17
0

The most recent reliable approach for me has been:

  1. On Linux, set up and launch a virtual machine running Windows.
  2. Then run Rufus on VW to create the bootable USB: https://rufus.ie/en/
  3. Make sure to check the check box: List USB Hard Drives on Rufus UI.
  4. I had to plug and unplug my USB multiple times before VM and Rufus could detect it.

I have tested it on openSUSE Leap 15.5.

VM runs Windows

VM screenshot

Use VM to run Rufus

Rufus screenshot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .