layer: export every layer with an empty machine-id #15
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/buildtasks!15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/empty-machine-id"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Every Keel image ships the same
/etc/machine-id,f0e97605ab594989b4d78f4a126b5b37(templateB2: mode 0444, plus/var/lib/dbus/machine-idas a regular file with the same id). It comes from the fab bootstrap (/turnkey/fab-keel/bootstraps/trixie-amd64/etc/machine-id, dated 2026-09-22). systemd keeps a populated file, and systemd's postinst runssystemd-machine-id-setupon every configure, so a child layer that upgrades systemd writes one of its own. Every LXC or VM made from one image then shares its DHCP DUID/IAID, journal and networkd identity, and keel's MariaDBserver_id: a replica test found two containers with the same one. This is the defect in docs/traps.md, "Every appliance built from core has the same machine-id".Fix
bt-layerruns the newlayer_reset_machine_idonroot.patchedafterlayer_check_build. That is before the rootfs copy that children start from and before the tarball, so every layer gets it, whatever its build did:/etc/machine-idbecomes an empty file (0444). Debian's cloud images ship it this way (config_space/scripts/LAST/10-cleanup), and machine-id(5) recommends it. The file is not left missing or set touninitialized, because either one makes the first boot a systemd first boot, and that presets every unit./var/lib/dbus/machine-idexists, it becomes a link to/etc/machine-id, which is whattmpfiles.d/dbus.confmakes. When/etc/machine-idis empty, systemd falls back to the D-Bus file, so a regular D-Bus file would bring the old id back.TurnKey does the same in neither buildtasks (
patches/containerorbt-container) nor bootstrap, and its tracker has no issue about it.Evidence
tests/layer: tests were written first and failed before the fix. They cover each case of the function, thecoretarball and rootfs of a build that wrote an id, and abt-layerrun whose id cannot be reset. Each of five mutations turns the suite red. Coverage: layer-lib 383/384, bt-layer 111/112, the same one uncovered line each as on 19.x.f0e976.... Reset with this function and booted from scratch twice in LXC, it came up with0308a979...and then0bbc049e.... Each id was kept across a reboot, the D-Bus link followed it, no first boot was detected, and the same 41 units were enabled as in the published image.Deploying
Merging deploys nothing.
/turnkey/buildtasks-keelon the build host has to be updated by hand before the next build. Images and machines that already exist keep the shared id. To fix a machine, runrm -f /etc/machine-id /var/lib/dbus/machine-id && systemd-machine-id-setup && ln -s /etc/machine-id /var/lib/dbus/machine-id, then reboot and runkeel applyagain. This changes that node'sserver_id.