cloudbase / windows-imaging-tools

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.
Apache License 2.0
685 stars 230 forks source link

Cloudbase-init.msi fails with non-ASCII groups names #392

Open al-indigo opened 8 months ago

al-indigo commented 8 months ago

It seems that Cloudbase-init.msi silent install fails on writing file cloudbase-init.conf. It's not empty, but if fails exactly before the option "groups" is set and in automatic mode it is set in ru-locale to "Администраторы". I've double-checked: without any automation, the installer does the same. If I change "Администраторы" to "Administators", the installation succeeds.

There is a missing option for this automated deploy in $msiexecArgumentList for this to change, so there is no automatic way to overwhelm this problem.

Ways for solution:

  1. Fix the writing behaviour for non-ascii symbols into configuration
  2. Or at least make it possible to override it during msi silent installation

image image

al-indigo commented 8 months ago

Writing down "dumb" way to fix it until developers from Cloudbase find a right way. If you face the same problem, you can make the following:

  1. Avoid an error mentioned in https://github.com/cloudbase/windows-imaging-tools/issues/391 , I have provided a way to do it inside the description
  2. Comment out the part related to cloudbase-init MSI installation
  3. Instead of this part insert this to make the script wait for file "C:\UnattendResources\done.txt" creation to proceed:
    $signalFile = "$resourcesDir\done.txt"
    Write-Host "Please install Cloudbase-Init manually. Create the file $signalFile when done."
    # Wait for the signal file to be created
    while (-not (Test-Path $signalFile)) {
        Start-Sleep -Seconds 10
    }
    Remove-Item $signalFile -ErrorAction SilentlyContinue
  4. When the script pauses and tells you to install cloudbase-init manually, do it. In the field "groups" write anything in english (Administrators for example).
  5. After cloudbase-init installation, replace the value in "C:\Program Files\Cloudbase-init\conf\cloudbase-init.conf" at third line to correspond your groups. I have put a ready init.conf file in the folder which is copied to C:\UnattendResources folder and than replaced the file inside "C:\Program Files\Cloudbase-init..." but you do it as you wish
  6. After that create a text file C:\UnattendResources\done.txt
  7. After all powershell windows close, manually turn off the VM
ader1990 commented 8 months ago

Hello, a quick workaround is to use the config options cloudbase_init_config_path and cloudbase_init_unattended_config_path to set custom cloudbase-init config files https://github.com/cloudbase/windows-imaging-tools/blob/master/Config.psm1#L158