<div dir="auto">Don't do it with multiple CD-ROM drives, use a floppy with the virtio drivers and the autounattend. I use mtools to build this from a source floppy image. More when I'm near a real keyboard and a git repo!<div dir="auto"><br></div><div dir="auto">Peter </div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 12 Sep 2018, 15:37 Richard W.M. Jones, <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have worked out how to do (almost) unattended installs of Windows<br>
guests using virt-install.  This reveals some issues with<br>
virt-install, although maybe they are not bugs.<br>
<br>
The virt-install command and autounattend.xml file are attached.  You<br>
will need to:<br>
<br>
(1) Put build.sh into a directory.<br>
<br>
(2) Create config/ subdirectory.<br>
<br>
(3) Put autounattend.xml into the config/ subdirectory.  Edit the file<br>
    to add your product key.<br>
<br>
(4) Download Windows ISO somewhere (modify the path in build.sh).<br>
<br>
(5) Run ./build.sh<br>
<br>
The result is very large.  Windows Server 2012R2 takes 5.3 GB!<br>
<br>
        - - -<br>
<br>
The first problem with virt-install I had was that when you use<br>
multiple CD-ROMs virt-install doesn't choose a sensible boot order.<br>
That's the reason for the ,boot_order=XX attributes.  It seems like<br>
this used to work in some old version of virt-install, see:<br>
<br>
  <a href="https://serverfault.com/questions/644437/unattended-installation-of-windows-server-2012-on-kvm" rel="noreferrer noreferrer" target="_blank">https://serverfault.com/questions/644437/unattended-installation-of-windows-server-2012-on-kvm</a><br>
<br>
The second problem is that --transient can't be used.  This is because<br>
the guest reboots at least once during installation (and after the<br>
first reboot the guest is in a half-installed state which looks<br>
sufficiently like the install worked as far as virt-install is<br>
concerned).<br>
<br>
        - - -<br>
<br>
There are also several problems with the current autounattend file or<br>
Windows itself.<br>
<br>
I couldn't get Windows to install virtio drivers even though I<br>
supplied the virtio ISO.  I guess some change is needed to the XML<br>
(perhaps: <a href="https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-device-drivers-to-windows-during-windows-setup" rel="noreferrer noreferrer" target="_blank">https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-device-drivers-to-windows-during-windows-setup</a> ).<br>
<br>
Windows still asks for the installation language.  Apparently using<br>
language='en-US' is incorrect or insufficient to suppress this.<br>
<br>
You must supply a valid ProductKey.  I couldn't work out how to defer<br>
activation until after installation.<br>
<br>
I'm using these as virt-builder templates.  However really they need<br>
to be sysprepped (using the Windows tool), so they are not really<br>
templates.  For my purposes where I'm not distributing them this is<br>
sort of fine.<br>
<br>
Windows is extremely unhelpful if there's a problem with the XML.<br>
However I found you can debug it like so:<br>
<br>
(a) On the failure screen, press [Shift] + F10.<br>
<br>
(b) cd X:\Windows\Panther\<br>
<br>
(c) type setupact.log<br>
<br>
(d) Examine the log file to see the real error.<br>
<br>
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
Fedora Windows cross-compiler. Compile Windows programs, test, and<br>
build Windows installers. Over 100 libraries supported.<br>
<a href="http://fedoraproject.org/wiki/MinGW" rel="noreferrer noreferrer" target="_blank">http://fedoraproject.org/wiki/MinGW</a><br>
_______________________________________________<br>
virt-tools-list mailing list<br>
<a href="mailto:virt-tools-list@redhat.com" target="_blank" rel="noreferrer">virt-tools-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/virt-tools-list" rel="noreferrer noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/virt-tools-list</a></blockquote></div>