[virt-tools-list] How to: Unattended Windows installs in virt-install

Richard W.M. Jones rjones at redhat.com
Wed Sep 12 14:37:27 UTC 2018


I have worked out how to do (almost) unattended installs of Windows
guests using virt-install.  This reveals some issues with
virt-install, although maybe they are not bugs.

The virt-install command and autounattend.xml file are attached.  You
will need to:

(1) Put build.sh into a directory.

(2) Create config/ subdirectory.

(3) Put autounattend.xml into the config/ subdirectory.  Edit the file
    to add your product key.

(4) Download Windows ISO somewhere (modify the path in build.sh).

(5) Run ./build.sh

The result is very large.  Windows Server 2012R2 takes 5.3 GB!

	- - -

The first problem with virt-install I had was that when you use
multiple CD-ROMs virt-install doesn't choose a sensible boot order.
That's the reason for the ,boot_order=XX attributes.  It seems like
this used to work in some old version of virt-install, see:

  https://serverfault.com/questions/644437/unattended-installation-of-windows-server-2012-on-kvm

The second problem is that --transient can't be used.  This is because
the guest reboots at least once during installation (and after the
first reboot the guest is in a half-installed state which looks
sufficiently like the install worked as far as virt-install is
concerned).

	- - -

There are also several problems with the current autounattend file or
Windows itself.

I couldn't get Windows to install virtio drivers even though I
supplied the virtio ISO.  I guess some change is needed to the XML
(perhaps: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-device-drivers-to-windows-during-windows-setup ).

Windows still asks for the installation language.  Apparently using
language='en-US' is incorrect or insufficient to suppress this.

You must supply a valid ProductKey.  I couldn't work out how to defer
activation until after installation.

I'm using these as virt-builder templates.  However really they need
to be sysprepped (using the Windows tool), so they are not really
templates.  For my purposes where I'm not distributing them this is
sort of fine.

Windows is extremely unhelpful if there's a problem with the XML.
However I found you can debug it like so:

(a) On the failure screen, press [Shift] + F10.

(b) cd X:\Windows\Panther\

(c) type setupact.log

(d) Examine the log file to see the real error.


Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.sh
Type: application/x-sh
Size: 564 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20180912/fa273e21/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autounattend.xml
Type: text/xml
Size: 2448 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20180912/fa273e21/attachment.xml>


More information about the virt-tools-list mailing list