I have to insert the Autounattend.xml file into a Windows 8 iso image to make the iso install automatically. My system need to run on Linux and only could use Linux shell command, so ISO tools on Winodws such as UltraISO can not be used.

I have tried several methods, but all the created iso could not be booted, just printed

CDBOOT: Cannot boot from CD - Code: 5

A. The first method I tried is: tuto

  1. Mount iso to a folder
  2. Copy the mounted iso content into a new folder
  3. Add my files into the new folder
  4. Use mkisofs command to create a new iso image

    mkisofs -o windows2008_new.iso -b boot/etfsboot.com -no-emul-boot   -boot-load-size 8 -boot-info-table  -V -J -l -D -N -UDF  -relaxed-filenames -V "WINSP"

B. The second method I tried:

MS cmd tool named "oscdimg" on Windows to create new Windows iso, it works. So I copy the oscdimg into Linux and use Wine to run it, it can not be run normally.

Does any one know how to make bootable Windows iso image in Linux using pure shell command?

  • wine is not for 'running' iso images. Try qemu-kvm, xen or virtualbox
    – Serge
    May 17, 2016 at 2:22
  • the 'oscdimg' is a cmd tool from Microsoft, runing in windows, but can not run in linux use wine(wine oscdimg). msdn.microsoft.com/zh-cn/windows/hardware/commercialize/…
    – user170602
    May 17, 2016 at 2:31
  • sorry for misunderstanding.
    – Serge
    May 17, 2016 at 2:34
  • take a look at this blog: rwmj.wordpress.com/2010/11/04/…
    – Serge
    May 17, 2016 at 2:44
  • 1
    Thanks for your help, I resolve the problem finally. In the blog, use 'dd' method to get the boot.img, and use this boot.img as the boot file to create new image. Actually, the boot.img is same as the file in boot/etfsboot.com file in the iso. So, both two command below could create correct window bootable iso. "mkisofs -o ../windows2008_test.iso -b boot.img -no-emul-boot -boot-load-size 8 -iso-level 2 -udf -J -l -D -N -relaxed-filenames ." and "mkisofs -o ../windows2008_hw.iso -b boot/etfsboot.img -no-emul-boot -boot-load-size 8 -iso-level 2 -udf -J -l -D -N -relaxed-filenames ."
    – user170602
    May 17, 2016 at 8:12

3 Answers 3


I managed to successfully use genisoimage (a debian fork of mkisofs).


  1. loopback mount the iso

    mount -o loop <image>.iso /mnt/iso
  2. copy to secondary folder for r/w access

    cp -R /mnt/iso/ /mnt/iso2
  3. make changes

  4. genisoimage -b <relative boot-img path> -no-emul-boot -boot-load-size 8 -iso-level 2 -udf -joliet -D -N -relaxed-filenames -o <new-image>.iso /mnt/iso2.`
  • genisoimage is not a fork from mkisofs, since a fork would require active development and own features. genisoimage however just added plenty of bugs and is not recommended. The command line you propose works perfectly with the original software and even avoids to cause structural defects in the resulting filesystem image. While genisoimage is still in the state from 2004, mkisofs nearly doubled it's features.
    – schily
    Jul 9, 2018 at 12:04
  • 1
    any explanation what is the relative boot-img path ? May 13, 2019 at 11:47
  • 1
    the rel boot-img path is boot\etfsboot.com also add -boot-load-seg 0x07C0 option. sadly the resulting iso does not work with uefi (like qemu ovmf)
    – bernstein
    Jan 21, 2020 at 23:01

Proposed method for Windows 7 but it does not work with Windows 10 iso file

# https://rwmj.wordpress.com/2010/11/04/customizing-a-windows-7-install-iso/
$ 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 .

Output unsuccessful in the first step

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

Please, let me know if you find any newer method for the task.

OS: Debian 8.5 64 bit
Hardware: Asus Zenbook UX303UA
Targeting hardware: Asus PC


I wanted to do the same thing but with ei.cfg; here's how I did it:

First create a mountpoint:

mkdir -p /mnt/image

Mount the official Windows image to /mnt/image:

sudo mount -o loop Win10_2004_English_x64.iso /mnt/image

Create a separate directory /tmp/bootableWin for your modifications, respecting the ISO folder structure, as you can't edit the loop mount.

In my case:

mkdir -p /tmp/bootableWin/sources
sudo tee /tmp/bootableWin/sources/ei.cfg <<EOF

And finally package it:

mkisofs \
    -iso-level 4 \
    -l \
    -R \
    -UDF \
    -D \
    -b boot/etfsboot.com \
    -no-emul-boot \
    -boot-load-size 8 \
    -hide boot.catalog \
    -eltorito-alt-boot \
    -eltorito-platform efi \
    -no-emul-boot \
    -b efi/microsoft/boot/efisys.bin \
    -o /home/username/win10-outputimage.iso \
    /mnt/image /tmp/bootableWin/

Now you should have both a BIOS and a UEFI bootable image with your added file in it.

  • 1
    I did a quick Google search yesterday, and it looked like > 75% of the resources say you should use -udf. Can you justify your insistence on -UDF? Dec 7, 2020 at 19:51
  • Can you justify your requested change? This is what I tested with, this is what I confirmed works.
    – C0rn3j
    Dec 8, 2020 at 22:34
  • 1
    Well, strictly speaking, I didn’t request a change; I just questioned your choice. As you know, two days ago, somebody suggested changing -UDF to -udf, and two high-reputation users approved that edit. What you can’t see is that I was presented with the opportunity to vote on xiota’s edit, and I abstained after my independent research showed support for both forms (but, as I said, mostly -udf), and as I said, I was asking why you overrode so many other voices.  … (Cont’d) Dec 8, 2020 at 23:56
  • 1
    (Cont’d) … (1) If you have used this successfully, it might help to mention that in your answer, ideally specifying the environment (OS and mkisofs version). (2) Have you tried -udf? If it works on your system, why not go along with the crowd? (3) Apparently a lot of people believe that -UDF is wrong. If there are systems where it doesn’t work, then your answer will be useless for people with such systems. (4) Based on the above, in order to make your answer helpful to the most people, I encourage you to (at least) add a note telling users to try -udf if -UDF doesn’t work for them. Dec 8, 2020 at 23:56
  • (1) Pointless in this case as the current cdrtools version is from 3 years ago (2) I did not try, hence why I overrode the suggested edit which had no justification attached to it. (3-4) Good enough that it's in the comments now.
    – C0rn3j
    Dec 9, 2020 at 8:50

You must log in to answer this question.

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