Categories
ISO Linux Microsoft Virtualization Windows

Unattended Windows ISO

For one or another reason even Linux enthusiasts need a Windows installation from time to time. But with every new version Microsoft adds more and bloatware or privacy violating settings that you need to decline during installation in order to get a halfway usable system.

The same is true for forced requirements of TPM or CPU specs: Often your system is totally fine to run Windows 11, but it does not meet the criteria of Microsoft and is therefore unusable.

Unattended installation

So what can we do? Microsoft allows to store some predefined settings in a XML file that are evaluated during installation and may spare you some unnecessary questions during installation or software packages afterwards.

The obvious question is: Where do I get this XML file from?

The good news is: If you don’t want to write this XML file yourself you can use web portals like this to generate it for you.

Integrating XML into ISO

While you could put the XML file on an extra USB stick, I think it’s more straightforward to integrate it into the Windows ISO file itself. And to do so I don’t want to run an extra Windows machine and install some interactive tools: That’s something a simple script should be able to achieve.

Fortunately I’m not the first to think so and so I tried the following simple mkisofs command on my system (as usual: on Ubuntu 24.04 LTS). First of all I needed to install it of course:

linux # mkisofs
Command 'mkisofs' not found, but can be installed with:
sudo apt install genisoimage
linux # apt install genisoimage

Having done so I of course needed to download a Windows ISO image. I also needed two directories: one to mount the ISO to and one to contain the autounattended.xml file:

linux # mkdir win11 addons
linux # mount -o loop Win11_24H2_EnglishInternational_x64.iso win11/
mount: /home/user1/Downloads/win/win11: WARNING: source write-protected, mounted read-only.
linux # cp ~/Downloads/autounattend.xml addons/

All it should take now is to build a new ISO with an additional XML file:

linux # mkisofs \
  -iso-level 4 \	 
  -rock \	 
  -disable-deep-relocation \	 
  -untranslated-filenames \	 
  -b boot/etfsboot.com \	 
  -no-emul-boot \	 
  -boot-load-size 8 \	 
  -eltorito-alt-boot \	 
  -eltorito-platform efi \	 
  -b efi/microsoft/boot/efisys_noprompt.bin \	 
  -o Win11_24H2_English.iso \	 
  win11_iso win11_addons

However when trying this all I got was:

<...>
genisoimage: No such file or directory. Invalid node - 'efi'.

So I started digging around and found this:

Some quarrels with the GNU/Linux community caused a fork of cdrtools, named cdrkit. The corresponding fork of mkisofs is named genisoimage. You will find it installed as “mkisofs” on many popular GNU/Linux distributions.

Ok, so there was a fork and the version shipped with Debian/Ubuntu distributions is “a little bit different”. Fortunately just a few lines later a simple solution is mentioned: In order to behave like the original mkisofs we need to use this instead:

linux # xorriso -as mkisofs

After replacing it things worked instantly:

linux # xorriso -as mkisofs \
    -iso-level 4 \
    -rock \
    -disable-deep-relocation \
    -untranslated-filenames \
    -b boot/etfsboot.com \
    -no-emul-boot \
    -boot-load-size 8 \
    -eltorito-alt-boot \
    -eltorito-platform efi \
    -b efi/microsoft/boot/efisys_noprompt.bin \
    -o Win11_24H2_English_mod.iso \
    win11 addons
xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.

Drive current: -outdev 'stdio:Win11_24H2_English_mod.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data,  510g free
Added to ISO image: directory '/'='/home/marcel/Downloads/win/win11'
xorriso : UPDATE :    1159 files added in 1 seconds
Added to ISO image: directory '/'='/home/marcel/Downloads/win/addons'
xorriso : UPDATE :    1160 files added in 1 seconds
xorriso : UPDATE :  0.18% done
xorriso : UPDATE :  14.46% done
xorriso : UPDATE :  32.63% done
xorriso : UPDATE :  52.22% done, estimate finish Thu Jan 02 15:33:35 2025
xorriso : UPDATE :  70.47% done, estimate finish Thu Jan 02 15:33:35 2025
xorriso : UPDATE :  87.90% done
ISO image produced: 2080466 sectors
Written to medium : 2080466 sectors at LBA 0
Writing to 'stdio:Win11_24H2_Pro_tiny_English_x64_modified.iso' completed successfully.

Using (and improving) the modified ISO

My aim was to get a Windows test VM up and running in virt-manager as fast as possible (and without manual interaction). So I added all required options to my autounattend.xml file – including the generation of some test accounts.

So when adding the ISO to my newly created VM all I had to do was specify “Windows 11” as the operating system and start the VM. A few minutes later I could log into the VM using the provided credentials.

However specifying the operating system is done automatically by virt-manager with the original ISO. So where does that come from?

Let’s compare the original ISO and the newly created one using isoinfo:

linux # isoinfo -i ../Win11_24H2_EnglishInternational_x64.iso -d | head -n 10
CD-ROM is in ISO 9660 format
System id: 
Volume id: CCCOMA_X64FRE_EN-GB_DV9
Volume set id: CCCOMA_X64FRE_EN-GB_DV9
Publisher id: MICROSOFT CORPORATION
Data preparer id: MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (425) 882-8080
Application id: CDIMAGE 2.56 (01/01/2005 TM)
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
linux # isoinfo -i Win11_24H2_English_mod.iso  -d | head -n 10
CD-ROM is in ISO 9660 format
System id: 
Volume id: ISOIMAGE
Volume set id: 
Publisher id: 
Data preparer id: XORRISO-1.5.6 2023.06.07.180001, LIBISOBURN-1.5.6, LIBISOFS-1.5.6, LIBBURN-1.5.6
Application id: 
Copyright File id: 
Abstract File id: 
Bibliographic File id: 

Ok, obviously a lot of metadata got lost while creating the new ISO. So I guess we need to set every single value and hope that virt-manager uses this data to identify the OS.

linux # mkisofs \
    -iso-level 4 \
    -rock \
    -disable-deep-relocation \
    -untranslated-filenames \
    -b boot/etfsboot.com \
    -no-emul-boot \
    -boot-load-size 8 \
    -eltorito-alt-boot \
    -eltorito-platform efi \
    -b efi/microsoft/boot/efisys_noprompt.bin \
    -V "CCCOMA_X64FRE_EN-GB_DV9" \
    -volset "CCCOMA_X64FRE_EN-GB_DV9" \
    -publisher "MICROSOFT CORPORATION" \
    -p "MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (425) 882-8080" \
    -A "CDIMAGE 2.56 (01/01/2005 TM)" \
    -o Win11_24H2_English_mod.iso \
    win11_iso win11_addons

The created ISO now contains all the metadata and virt-manager automatically recognizes the OS as “Windows 11” – another manual step saved :-).

Guess now I want to have something like that for Linux installations too … 😉

Leave a Reply

Your email address will not be published. Required fields are marked *