Open RussellAult opened 1 month ago
This isn't a valid bug report.
Thanks, @RussellAult, for reporting this.
cloud-init clean
runs under the assumption of the system running. As a workaround, one can manually modify the machine-id with:
virt-customize -a $IMG \
--run-command 'cp /etc/machine-id /etc/machine-id.bak' \
--run-command 'echo "undefined" > /etc/machine-id'
Doing a quick search, it looks like it is quite difficult to detect if a system is configured with systemd as the init system without the systemd running and for any distro and version.
Bug report
https://github.com/canonical/cloud-init/blob/e0e6a427fdc6826bf7b11d52157a1c5f9b3dde4d/cloudinit/distros/__init__.py#L1608-L1613 returns a "false
False
" if the the target VM is being edited using offline tools (e.g. libguestfs), since/run
is only populated on a running systemSteps to reproduce the problem
virt-customize -a <debian_cloud_image>.qcow2 --run-command 'cloud-init clean --machine-id'
should produce an/etc/machine-id
ofundefined
; instead it deletes the file entirely (the non-systemd result)Environment details
virt-customize