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 '16 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 '16 at 2:31
  • sorry for misunderstanding. – Serge May 17 '16 at 2:34
  • take a look at this blog: rwmj.wordpress.com/2010/11/04/… – Serge May 17 '16 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 '16 at 8:12

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 '18 at 12:04
  • 1
    any explanation what is the relative boot-img path ? – dafnahaktana May 13 '19 at 11:47
  • 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 1 hour ago

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.