meta data for this page
This is an old revision of the document!
machine-id
Read only root FS:
- with preinit script (before real /sbin/init)
- tmpfs overlay on
/etcmounted - bind mount persistent
/mnt/state/machine-idon/etc/machine-id.
- first boot works well
- after reboot systemd complains:
systemd[1]: Starting Commit a transient machine-id on disk... systemd-machine-id-setup[611]: /etc/machine-id is not on a temporary file system. systemd-machine-id-commit.service: Main process exited, code=exited, status=1/FAILURE systemd-machine-id-commit.service: Failed with result 'exit-code'. systemd[1]: Failed to start Commit a transient machine-id on disk.
It runs because of conditions defined in unit file:
- systemd-machine-id-commit.service
[Unit] DefaultDependencies=no Conflicts=shutdown.target Before=shutdown.target After=local-fs.target first-boot-complete.target ConditionPathIsReadWrite=/etc ConditionPathIsMountPoint=/etc/machine-id [Service] Type=oneshot RemainAfterExit=yes ExecStart=systemd-machine-id-setup --commit
This unit is designed to be run when /etc/machine-id is in transient state (e.g. bind mounted to tmpfs by systemd),
so ConditionPathIsMountPoint=/etc/machine-id is fulfilled in our case.
- /etc/systemd/system/systemd-machine-id-commit.service.d/bind-mount-fix.conf
[Unit] ConditionPathIsReadWrite=|/etc ConditionPathIsReadWrite=|/mnt/state/machine-id ConditionFirstBott=yes ConditionPathIsMountPoint=/etc/machine-id