Re: How to: Unattended Windows installs in virt-install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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@xxxxxxxxxx> 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:
> 
>   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 ).

There is DriverPaths element for that. See the attached XML.

Specifying the path is tricky. Every Windows version has different bugs
and behavior.

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 [1] 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
templates regularly.

Hope this helps,

    Tomas

[1] https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj612867(v=ws.11)


> 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


-- 
Tomáš Golembiovský <tgolembi@xxxxxxxxxx>

Attachment: autounattend.xml
Description: XML document

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux