Looks like the issue you're hitting relates to older Ubuntu releases.
bionic machine-id(5):
For operating system images which are created once and used on multiple machines, for example for containers
or in the cloud, /etc/machine-id should be an empty file in the generic file system image.
There is a problem, however, with simply making this file an empty file in all cases, since this would change first boot determination on newer systems:
jammy machine-id(5):
3. If /etc/machine-id exists and is empty, a boot is not considered
the first boot. systemd will still bind-mount a file containing
the actual machine-id over it and later try to commit it to disk
(if /etc/ is writable).
Looks like the issue you're hitting relates to older Ubuntu releases.
bionic machine-id(5):
For operating system images which are created once and used on multiple machines, for example for containers
or in the cloud, /etc/machine-id should be an empty file in the generic file system image.
There is a problem, however, with simply making this file an empty file in all cases, since this would change first boot determination on newer systems:
jammy machine-id(5):
3. If /etc/machine-id exists and is empty, a boot is not considered
the first boot. systemd will still bind-mount a file containing
the actual machine-id over it and later try to commit it to disk
(if /etc/ is writable).