+++ This bug was initially created as a clone of Bug #1554546 +++ Description of problem: Alex Schultz writes: virt-sysprep by default runs customize which reintroduces the /etc/machine-id after running the machine-id operation. $ virt-sysprep -a /builddir/build/BUILD/overcloud-full.x86_64.tar-extract/overcloud-full.qcow2 [ 0.0] Examining the guest ... [ 61.3] Performing "abrt-data" ... [ 61.3] Performing "backup-files" ... [ 96.2] Performing "bash-history" ... [ 96.2] Performing "blkid-tab" ... [ 96.2] Performing "crash-data" ... [ 96.3] Performing "cron-spool" ... [ 96.4] Performing "dhcp-client-state" ... [ 96.4] Performing "dhcp-server-state" ... [ 96.5] Performing "dovecot-data" ... [ 96.5] Performing "logfiles" ... [ 96.6] Performing "machine-id" ... [ 96.7] Performing "mail-spool" ... [ 96.7] Performing "net-hostname" ... [ 96.7] Performing "net-hwaddr" ... [ 96.7] Performing "pacct-log" ... [ 96.7] Performing "package-manager-cache" ... [ 97.0] Performing "pam-data" ... [ 97.0] Performing "passwd-backups" ... [ 97.0] Performing "puppet-data-log" ... [ 97.0] Performing "rh-subscription-manager" ... [ 97.0] Performing "rhn-systemid" ... [ 97.0] Performing "rpm-db" ... [ 97.0] Performing "samba-db-log" ... [ 97.1] Performing "script" ... [ 97.1] Performing "smolt-uuid" ... [ 97.1] Performing "ssh-hostkeys" ... [ 97.1] Performing "ssh-userdir" ... [ 97.1] Performing "sssd-db-log" ... [ 97.1] Performing "tmp-files" ... [ 97.1] Performing "udev-persistent-net" ... [ 97.2] Performing "utmp" ... [ 97.2] Performing "yum-uuid" ... [ 97.2] Performing "customize" ... [ 97.2] Setting a random seed [ 97.2] Setting the machine ID in /etc/machine-id [ 98.6] Performing "lvm-uuids" ...
Huh, this bug has really nasty consequences... I was building a custom Ubuntu 18.04 Vagrant libvirt box from an existing box (https://app.vagrantup.com/generic/boxes/ubuntu1804). The Vagrant libvirt provider calls virt-sysprep when the 'vagrant package' command is called (https://github.com/vagrant-libvirt/vagrant-libvirt#package-box-from-vm). So far so good. But when I tried to create a Vagrant environment with multiple machines sharing this custom libvirt Vagrant box, the libvirtd's dnsmasq-dhcp server would assign all the machines the same IP!? It turns out this is because they have the same /etc/macine-id: https://everythingshouldbevirtual.com/virtualization/Ubuntu-18.04-Templates-Duplicate-IPs/. A simple 'truncate -s 0 /etc/machine-id' fixes the problem, however, it is really, really hard to get to this root cause. I hope my story helps increasing the importance of this issue.
@rjones, any update on this?
Nothing has happened on this, but patches are welcome upstream. It's likely a very simple fix if you want to have a go.