The virt-sysprep command should clean the content of /etc/machine-id as the machine-id step is marked (with *) as enabled by default. At least the man page is quite clear. However that does not happen and after the command run, the content of the file is still present and the file is deleted neither.

The command:

# virt-sysprep --format qcow2 -a <qcow2 image>
  • Would be great if you filed a bug report if it's indeed a bug worth addressing. Mar 28 at 10:49
  • Yes, I already created the RH support case so they are aware of it. I asked RH to extend the man page with description of the behavior. Mar 28 at 11:49

1 Answer 1


In fact it behaves differently. The machine-id step is really enabled by default, but it deletes the original content and generates new. It is intended for 1 to 1 image deployments.

However if you want the content of the /etc/machine-id to be cleared for 1 to many scenario, you have to run the command with --enable machine-id option specified explicitly:

# virt-sysprep --format qcow2 --enable machine-id -a <qcow2 image>

It ignores other steps then and does just the machine-id step, which makes /etc/machine-id empty so it is generated during the first boot. You can run it as additional command to the original with all other defaults. Or you can add additional required steps to the line.

EDIT: In fact the culprit is the operation customize, which generates the new machine-id, despite the operation machine-id removed it. The operation customize is by default enabled too.

The RH knows about this and possibly RH will fix the man page in the future.

It is also possible that the command behaves like this on RHEL9 or other distributions, I haven't tried.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .