Bug 1557042 - virt-sysprep 'customize' operation creates /etc/machine-id even if the machine-id operation just removed it
Summary: virt-sysprep 'customize' operation creates /etc/machine-id even if the machin...
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-15 20:40 UTC by Richard W.M. Jones
Modified: 2022-02-05 08:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1554546
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2018-03-15 20:40:23 UTC
+++ 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" ...

Comment 1 Tadej Janež 2019-08-12 12:03:58 UTC
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.

Comment 2 Tadej Janež 2020-12-16 13:21:37 UTC
@rjones, any update on this?

Comment 3 Richard W.M. Jones 2020-12-16 14:49:15 UTC
Nothing has happened on this, but patches are welcome upstream.  It's likely a very
simple fix if you want to have a go.


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