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
Attachment:
build.sh
Description: Bourne shell script
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:ms="urn:schemas-microsoft-com:asm.v3" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" publicKeyToken="31bf3856ad364e35" language="en-US" versionScope="nonSxS" processorArchitecture="amd64"> <UserData> <AcceptEula>true</AcceptEula> <ProductKey> <Key>PUT PRODUCT KEY HERE</Key> <WillShowUI>OnError</WillShowUI> </ProductKey> </UserData> <DiskConfiguration> <Disk wcm:action="add"> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <CreatePartitions> <!-- System partition --> <CreatePartition wcm:action="add"> <Order>1</Order> <Type>Primary</Type> <Size>300</Size> </CreatePartition> <!-- Windows partition --> <CreatePartition wcm:action="add"> <Order>2</Order> <Type>Primary</Type> <Extend>true</Extend> </CreatePartition> </CreatePartitions> <ModifyPartitions> <!-- System partition --> <ModifyPartition wcm:action="add"> <Order>1</Order> <PartitionID>1</PartitionID> <Label>System</Label> <Format>NTFS</Format> <Active>true</Active> </ModifyPartition> <!-- Windows partition --> <ModifyPartition wcm:action="add"> <Order>2</Order> <PartitionID>2</PartitionID> <Label>Windows</Label> <Letter>C</Letter> <Format>NTFS</Format> </ModifyPartition> </ModifyPartitions> </Disk> <WillShowUI>OnError</WillShowUI> </DiskConfiguration> <ImageInstall> <OSImage> <WillShowUI>Never</WillShowUI> <InstallFrom> <MetaData> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>2</PartitionID> </InstallTo> </OSImage> </ImageInstall> </component> </settings> </unattend>
_______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list