Bug 2042809 - sysprep disk requires autounattend.xml if an unattend.xml exists
Summary: sysprep disk requires autounattend.xml if an unattend.xml exists
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: SSP
Version: 4.9.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Lee Yarwood
QA Contact: Roni Kishner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-20 07:59 UTC by Dominik Holler
Modified: 2022-09-14 19:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-14 19:28:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt kubevirt pull 7241 0 None open sysprep: Allow only unattend.xml to be provided 2022-02-23 12:52:16 UTC
Red Hat Bugzilla 2041093 1 medium CLOSED autounattend.xml missing 2022-03-10 16:39:56 UTC
Red Hat Issue Tracker CNV-15925 0 None None None 2022-03-02 16:06:56 UTC
Red Hat Product Errata RHSA-2022:6526 0 None None None 2022-09-14 19:28:56 UTC

Description Dominik Holler 2022-01-20 07:59:15 UTC
Description of problem:
Even if an unattend.xml file is requested for the sysprep disk, cnv requires the file autounattend.xml to exist.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Create VM with sysprep disk containing unattend.xml, but not autounattend.xml


Actual results:
VM fails to boot


Expected results:
VM boots if at least unattend.xml or autounattend.xml exists.

Additional info:

Comment 1 Dominik Holler 2022-01-20 08:00:40 UTC
The workaround is to create an empty autounattend.xml.

Comment 2 Lee Yarwood 2022-02-10 18:21:29 UTC
I can reproduce this with the following:

$ oc get -n kubevirt-hyperconverged vms lyarwood-windows10-nasty-donkey -o json | jq '.spec.template.spec.volumes'
[
  {
    "dataVolume": {
      "name": "lyarwood-windows10-nasty-donkey-rootdisk-zz9rz"
    },
    "name": "rootdisk"
  },
  {
    "name": "sysprep",
    "sysprep": {
      "configMap": {
        "name": "sysprep-config-lyarwood-windows10-nasty-donkey"
      }
    }
  }
]

$ oc get -n kubevirt-hyperconverged configmap sysprep-config-lyarwood-windows10-nasty-donkey -o json | jq -r .data | sed 's/\\n/\n/g'
{
  "Unattend.xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<unattend xmlns=\"urn:schemas-microsoft-com:unattend\">
  <settings pass=\"oobeSystem\">
    <component xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"Microsoft-Windows-Shell-Setup\" processorArchitecture=\"amd64\" publicKeyToken=\"31bf3856ad364e35\" language=\"neutral\" versionScope=\"nonSxS\">
      <OOBE>
        <HideEULAPage>true</HideEULAPage>
        <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
        <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
        <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
        <NetworkLocation>Work</NetworkLocation>
        <SkipUserOOBE>true</SkipUserOOBE>
        <SkipMachineOOBE>true</SkipMachineOOBE>
        <ProtectYourPC>3</ProtectYourPC>
      </OOBE>
      <AutoLogon>
        <Password>
        <Value>123456</Value>
          <PlainText>true</PlainText>
        </Password>
        <Enabled>true</Enabled>
    <Username>Administrator</Username>
</AutoLogon>
<UserAccounts>
     <AdministratorPassword>
            <Value>123456</Value>
            <PlainText>true</PlainText>
    </AdministratorPassword>
      </UserAccounts>
      <RegisteredOrganization/>
      <RegisteredOwner/>
      <TimeZone>Eastern Standard Time</TimeZone>
    </component>
  </settings>
</unattend>"
}

$ oc logs -n kubevirt-hyperconverged virt-launcher-lyarwood-windows10-nasty-donkey-rvhxl | tail -n1 | jq .
{
  "component": "virt-launcher",
  "kind": "",
  "level": "error",
  "msg": "Failed to sync vmi",
  "name": "lyarwood-windows10-nasty-donkey",
  "namespace": "kubevirt-hyperconverged",
  "pos": "server.go:184",
  "reason": "creating sysprep disks failed: Sysprep drive should contain autounattend.xml, but it was not found",
  "timestamp": "2022-02-10T17:00:11.354899Z",
  "uid": "be21af5c-4ade-4513-bf15-031c4d3ebe43"
}

The failure is coming from the following code checking for autounattend.xml:

https://github.com/kubevirt/kubevirt/blob/8a07d2dc92fb0908455b833a1fbcb6ffdb965570/pkg/config/sysprep.go#L49-L64

I'll change this to check for either and test to ensure that if only unattend.xml is provided that it sysprep actually works. Reading the docs suggests that only autounattend.xml is picked up from removable media etc:

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-automation-overview?view=windows-11#implicit-answer-file-search-order

Comment 3 Roni Kishner 2022-04-05 18:46:18 UTC
Verified on ssp-operator v4.11.0-16

Comment 6 errata-xmlrpc 2022-09-14 19:28:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.11.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:6526


Note You need to log in before you can comment on or make changes to this bug.