cloud-init clean truncate machine-id instead of deleting

Bug #2002784 reported by eblock@nde.ag
This bug report is a duplicate of:  Bug #1999680: Fix remove machine-id. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
New
Undecided
Unassigned

Bug Description

I don't know how to re-open a bug [1] so I create a new one. The fix mentioned in [1] is not ideal. If you just remove the file /etc/machine-id (e. g. 'cloud-init clean --machine-id') it won't be regenerated during startup but error messages are displayed (here in Ubuntu 20.04):

---snip---
Jan 9 14:49:48 control-4 kernel: [ 3.482774] systemd[1]: System cannot boot: Missing /etc/machine-id and /etc is mounted read-only.
Jan 9 14:49:48 control-4 kernel: [ 3.484066] systemd[1]: Booting up is supported only when:
Jan 9 14:49:48 control-4 kernel: [ 3.485226] systemd[1]: 1) /etc/machine-id exists and is populated.
Jan 9 14:49:48 control-4 kernel: [ 3.485861] systemd[1]: 2) /etc/machine-id exists and is empty.
Jan 9 14:49:48 control-4 kernel: [ 3.486569] systemd[1]: 3) /etc/machine-id is missing and /etc is writable.
Jan 9 14:49:48 control-4 kernel: [ 4.247850] systemd[1]: Failed to populate /etc with preset unit settings, ignoring: Read-only file system
---snip---

If you just truncate the files (I truncated both /etc/machine-id and /var/lib/dbus/machine-id) to size 0 the boot works fine:

root@control-4:~# truncate -s0 /etc/machine-id /var/lib/dbus/machine-id

I haven't tested many scenarios (maybe it's sufficient to truncate only one file /etc/machine-id) but this change might help a bit when creating VM images.

[1] https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1563951

Revision history for this message
James Falcon (falcojr) wrote :

Discussions are already happening for this. Please see LP: #1999680

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.