[virt-tools-list] How to: Unattended Windows installs in virt-install
tgolembi at redhat.com
Wed Sep 12 17:23:07 UTC 2018
we were experimenting with unattended Windows installation in RHV about
a year ago and failed terribly. But that is because our requirement was
to have one XML template and one source of drivers for all Windows
versions. So if you are willing to give up a dream of having one-for-all
solution then it is possible.
More comments below.
On Wed, 12 Sep 2018 15:37:27 +0100
"Richard W.M. Jones" <rjones at redhat.com> wrote:
> 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:
> 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
> - - -
> 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 ).
There is DriverPaths element for that. See the attached XML.
Specifying the path is tricky. Every Windows version has different bugs
You can either have a general path (like "A:\amd64") but then you need
to supply only drivers suitable for the Windows version you are
installing. And by suitable I mean not newer and not (too) older. That's
because some versions pick the wrong drivers and BSOD.
Maybe easier solution is to specify complete path (e.g.
"A:\amd64\w2008\"). But then you should make sure you have all the
necessary drivers there. I'm not sure about virtio-win ISO, but IIRC the
floppy image relies on the fact that some windows versions use same
driver to save space and not all drivers are in all directories. If you
now think "heck, how can this work" and that I'm contradicting the
previous paragraph then... surprise, surprise... the detection of
compatible drivers works when you do that in GUI.
Another complication here is drive letters in paths. You can either have
derivers on a floppy (and you know it is A). Or you can have drivers on
CD or (read-only!) USB but then you have to know number of your disks
and the expected drive letter it will get assigned. Specifying all paths
with all possible drive letters in the XML generally does not work.
Again, some version can deal with that, some versions don't.
> Windows still asks for the installation language. Apparently using
> language='en-US' is incorrect or insufficient to suppress this.
I don't recall if I ever needed this.
> You must supply a valid ProductKey. I couldn't work out how to defer
> activation until after installation.
You can use generic license keys  for that. They last for 30 days after
which you need to activate the OS. Although now that I think of it, it's
probably inconvenient for your use case. You will need to regenerate the
Hope this helps,
> 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.
> 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.
Tomáš Golembiovský <tgolembi at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4025 bytes
Desc: not available
More information about the virt-tools-list