diff --git a/man/systemd.special.xml b/man/systemd.special.xml index e43d765c9f..1434ead7d5 100644 --- a/man/systemd.special.xml +++ b/man/systemd.special.xml @@ -32,6 +32,7 @@ emergency.target, exit.target, final.target, + first-boot-complete.target, getty.target, getty-pre.target, graphical.target, @@ -878,6 +879,17 @@ stopped. + + first-boot-complete.target + + This passive target is intended as a synchronization point for units that need to run once + during the first boot. Only after all units ordered before this target have finished, will the + machine-id5 + be committed to disk, marking the first boot as completed. If the boot is aborted at any time + before that, the next boot will re-run any units with ConditionFirstBoot=yes. + + + getty-pre.target diff --git a/units/first-boot-complete.target b/units/first-boot-complete.target new file mode 100644 index 0000000000..98b236e9ff --- /dev/null +++ b/units/first-boot-complete.target @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=First Boot Complete +Documentation=man:systemd.special(7) +RefuseManualStart=yes +ConditionFirstBoot=yes diff --git a/units/meson.build b/units/meson.build index e94e7f7efd..40ffca5058 100644 --- a/units/meson.build +++ b/units/meson.build @@ -17,6 +17,7 @@ units = [ ['emergency.target', ''], ['exit.target', ''], ['final.target', ''], + ['first-boot-complete.target', ''], ['getty.target', '', 'multi-user.target.wants/'], ['getty-pre.target', ''], diff --git a/units/systemd-machine-id-commit.service b/units/systemd-machine-id-commit.service index e3acb0f326..5616a35701 100644 --- a/units/systemd-machine-id-commit.service +++ b/units/systemd-machine-id-commit.service @@ -12,8 +12,8 @@ Description=Commit a transient machine-id on disk Documentation=man:systemd-machine-id-commit.service(8) DefaultDependencies=no Conflicts=shutdown.target -Before=sysinit.target shutdown.target -After=local-fs.target +Before=shutdown.target +After=local-fs.target first-boot-complete.target ConditionPathIsReadWrite=/etc ConditionPathIsMountPoint=/etc/machine-id