You are not logged in.

#1 2025-09-21 15:53:44

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,227
Website

[SOLVED] virt-install not executing the --cloud-init parameter

Have been messing with virt-install the entire weekend to achieve a bit of simple customization (password, ssh-key, locale/keyboard), and I still haven't succeeded. I'm starting to believe it's not me.
(TBH most of my time lost due to trying to do this with ansible, but since a few hours I have simply stepped down into using the virt-install command directly).

I want to build a Debian Bookworm image, and have tried the 'generic' and 'genericcloud' variants, both for Bookworm (backports) and Trixie.

Ansible will always error out when using the 'community.libvirt.virt-install' module, complaining that none of the user-data keys are valid keys. Even a simple 'user-data.packages=[]' gives the error.
The virt-install command completes successfully, but none of the user-data or network-config or root-ssh-key options are set. I cannot login to the vm to search the guest's log files.

I have tried various ways of invoking the '--disk' parameter:
* once with a simple path followed by an --import (having copied the debian qcow2 file to /var/lib/libvirt/images/)
* now without the preliminary copying using the more advanced (I think) --disk=3,backing_store=<qcow2 src>,path=<image path>

This is the entire command:

sudo virt-install \
--name="d12-lab01" \
--boot="uefi" \
--machine="q35" \
--memory="2048" \
--vcpus="2" \
--disk=size=3,backing_store="/home/xxx/Virtual Machines/debian-13-generic-amd64-20250911-2232.qcow2",path="/var/lib/libvirt/images/d12-lab01.qcow2" \
--os-variant="debian13" \
--network="network=default,model=virtio,driver.iommu=on,mac=52:54:00:12:34:57" \
--virt-type="kvm" \
--cloud-init=user-data="/tmp/ansible_cloudinit_userdata.config",disable="on",network-config="/tmp/ansible_cloudinit_network.config" --qemu-commandline="-smbios type=1,serial=h=d12-lab01.example.com" \
--noautoconsole

On this archlinux host, I do see errors in my journal:

sep 21 16:47:44 ltx124 libvirtd[2982]: internal error: child reported (status=125): Unable to get XATTR trusted.libvirt.security.ref_dac on /var/lib/libvirt/boot/virtinst-zmr4hdu5-cloudinit.iso: No such file or directory
sep 21 16:47:44 ltx124 libvirtd[2982]: Unable to get XATTR trusted.libvirt.security.ref_dac on /var/lib/libvirt/boot/virtinst-zmr4hdu5-cloudinit.iso: No such file or directory
sep 21 16:47:44 ltx124 libvirtd[2982]: Unable to remove disk metadata on vm d12-lab01 from /var/lib/libvirt/boot/virtinst-zmr4hdu5-cloudinit.iso (disk target sda)
sep 21 16:53:29 ltx124 libvirtd[2982]: Domain id=24 name='d12-lab01' uuid=d3be21bc-a25a-4c9a-b7e8-7ab33a5ccc7a is tainted: custom-argv

... which is why I think either there is a bug in the virt-install package or there is something wrong on my system... Any help?

Last edited by zenlord (2025-09-22 06:14:01)

Offline

#2 2025-09-21 16:20:56

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,227
Website

Re: [SOLVED] virt-install not executing the --cloud-init parameter

Looking for the XATTR error message on the interwebs, I found a reddit post where it was advised to set user=root and group=root in /etc/libvirt/qemu.conf. Doing that and rebooting the host has made the error messages go away. I now only see:

sep 21 18:10:44 ltx124 libvirtd[2969]: Domain id=2 name='d12-lab01' uuid=7a16f4f3-3180-4ed0-85c1-0d40bb435f5d is tainted: high-privileges
sep 21 18:10:44 ltx124 libvirtd[2969]: Domain id=2 name='d12-lab01' uuid=7a16f4f3-3180-4ed0-85c1-0d40bb435f5d is tainted: custom-argv

... which seems rather harmless.

I now also see in virt-manager that a cloudinit.iso is attached to the vm when I create the vm using virt-install. Still, however, the keyboard and locale are not set correctly and I cannot log in (neither via ssh). I also notice that the cloudinit.iso is not present in the folder it is supposed to be in... I wonder if the creation of this iso now silently fails and therefore cloudinit is never executed.

Using the ansible module "community.libvirt.virt-install" still renders the same error message.

Offline

#3 2025-09-21 16:42:02

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,227
Website

Re: [SOLVED] virt-install not executing the --cloud-init parameter

I have read that it is expected behaviour that the cloudinit.iso is no longer present, as it is removed immediately after booting. The debug logs confirm that this is also happening on my system:

zo, 21 sep 2025 18:37:36 virt-install 8040 DEBUG (installer:423) Removing /var/lib/libvirt/boot/virtinst-1f9w4y1e-ansible_cloudinit_userdata
zo, 21 sep 2025 18:37:36 virt-install 8040 DEBUG (installer:423) Removing /var/lib/libvirt/boot/virtinst-anch_zeu-ansible_cloudinit_network
zo, 21 sep 2025 18:37:36 virt-install 8040 DEBUG (installer:423) Removing /var/lib/libvirt/boot/virtinst-9rukqaqh-cloudinit.iso
zo, 21 sep 2025 18:37:36 virt-install 8040 DEBUG (cli:272)

So, no more errors and still the problems persist... Has anyone else seen similar behaviour?

Last edited by zenlord (2025-09-21 16:42:18)

Offline

#4 2025-09-22 06:13:10

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,227
Website

Re: [SOLVED] virt-install not executing the --cloud-init parameter

Solved. What are the odds to bump into two different bugs in two different applications?

virt-install:
In version 5.1.0, the --cloud-init parameter is not executed if the "meta-data" component is not present...
Bug report: https://github.com/virt-manager/virt-manager/issues/975

Ansible's module "community.libvirt.virt-install":
Known issue - will be resolved in future version
Bug report: https://github.com/ansible-collections/ … issues/218

*sigh*

For future reference, this command is working in v. 5.1.0 (mind the additional instruction):

sudo virt-install \
--name="d12-lab01" \
--boot="uefi" \
--machine="q35" \
--memory="2048" \
--vcpus="2" \
--disk=size=3,backing_store="/home/xxx/Virtual Machines/debian-13-generic-amd64-20250911-2232.qcow2",path="/var/lib/libvirt/images/d12-lab01.qcow2" \
--os-variant="debian13" \
--network="network=default,model=virtio,driver.iommu=on,mac=52:54:00:12:34:57" \
--virt-type="kvm" \
--cloud-init=meta-data="/tmp/ansible_cloudinit_metadata",user-data="/tmp/ansible_cloudinit_userdata",disable="on",network-config="/tmp/ansible_cloudinit_network" \
--qemu-commandline="-smbios type=1,serial=h=d12-lab01.example.com" \
--noautoconsole

Last edited by zenlord (2025-09-22 06:24:57)

Offline

#5 2025-09-22 08:37:11

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,315

Re: [SOLVED] virt-install not executing the --cloud-init parameter

Moderator Note

Moving to Applications & Desktop Environments as requested


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB