From 9e5f0f92915b777308797294c6e103e430957b5d Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 14 Mar 2013 13:12:10 +0100 Subject: Make initrd.target the default target in the initrd First, rename root-fs.target to initrd-root-fs.target to clarify its usage. Mount units with "x-initrd-rootfs.mount" are now ordered before initrd-root-fs.target. As we sometimes construct /sysroot mounts in /etc/fstab in the initrd, we want these to be mounted before the initrd-root-fs.target is active. initrd.target can be the default target in the initrd. (normal startup) : : v basic.target | ______________________/| / | | sysroot.mount | | | v | initrd-root-fs.target | | | v | initrd-parse-etc.service (custom initrd services) | | v | (sysroot-usr.mount and | various mounts marked | with fstab option | x-initrd.mount) | | | v | initrd-fs.target | | \______________________ | \| v initrd.target | v initrd-cleanup.service isolates to initrd-switch-root.target | v ______________________/| / | | initrd-udevadm-cleanup-db.service | | (custom initrd services) | | | \______________________ | \| v initrd-switch-root.target | v initrd-switch-root.service | v switch-root --- units/initrd-cleanup.service.in | 3 +-- units/initrd-fs.target | 1 + units/initrd-parse-etc.service.in | 7 ++++--- units/initrd-root-fs.target | 13 +++++++++++++ units/initrd-switch-root.target | 4 ++-- units/initrd.target | 17 +++++++++++++++++ units/root-fs.target | 11 ----------- 7 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 units/initrd-root-fs.target create mode 100644 units/initrd.target delete mode 100644 units/root-fs.target (limited to 'units') diff --git a/units/initrd-cleanup.service.in b/units/initrd-cleanup.service.in index 5bef090e08..218ec807ff 100644 --- a/units/initrd-cleanup.service.in +++ b/units/initrd-cleanup.service.in @@ -10,8 +10,7 @@ Description=Cleaning Up and Shutting Down Daemons DefaultDependencies=no ConditionPathExists=/etc/initrd-release OnFailure=emergency.target -Wants=root-fs.target initrd-fs.target -After=root-fs.target initrd-fs.target +After=initrd-root-fs.target initrd-fs.target initrd.target [Service] Type=oneshot diff --git a/units/initrd-fs.target b/units/initrd-fs.target index 6ba1758e45..7578b8824b 100644 --- a/units/initrd-fs.target +++ b/units/initrd-fs.target @@ -11,3 +11,4 @@ Documentation=man:systemd.special(7) OnFailure=emergency.target OnFailureIsolate=yes ConditionPathExists=/etc/initrd-release +After=initrd-parse-etc.service diff --git a/units/initrd-parse-etc.service.in b/units/initrd-parse-etc.service.in index 44fee7bd34..07728e200f 100644 --- a/units/initrd-parse-etc.service.in +++ b/units/initrd-parse-etc.service.in @@ -8,13 +8,14 @@ [Unit] Description=Reload Configuration from the Real Root DefaultDependencies=no -Requires=root-fs.target -After=root-fs.target +Requires=initrd-root-fs.target +After=initrd-root-fs.target OnFailure=emergency.target ConditionPathExists=/etc/initrd-release [Service] Type=oneshot ExecStartPre=@rootbindir@/systemctl daemon-reload -ExecStart=@rootbindir@/systemctl start initrd-fs.target +# we have to retrigger initrd-fs.target after daemon-reload +ExecStart=-@rootbindir@/systemctl --no-block start initrd-fs.target ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service diff --git a/units/initrd-root-fs.target b/units/initrd-root-fs.target new file mode 100644 index 0000000000..cd189f0296 --- /dev/null +++ b/units/initrd-root-fs.target @@ -0,0 +1,13 @@ +# 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=Initrd Root File System +Documentation=man:systemd.special(7) +ConditionPathExists=/etc/initrd-release +OnFailure=emergency.target +OnFailureIsolate=yes diff --git a/units/initrd-switch-root.target b/units/initrd-switch-root.target index cf646c4ef9..f34768790b 100644 --- a/units/initrd-switch-root.target +++ b/units/initrd-switch-root.target @@ -12,5 +12,5 @@ DefaultDependencies=no Requires=initrd-switch-root.service Before=initrd-switch-root.service AllowIsolate=yes -Wants=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target systemd-journald.service -After=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target emergency.service emergency.target +Wants=initrd-udevadm-cleanup-db.service initrd-root-fs.target initrd-fs.target systemd-journald.service +After=initrd-udevadm-cleanup-db.service initrd-root-fs.target initrd-fs.target emergency.service emergency.target diff --git a/units/initrd.target b/units/initrd.target new file mode 100644 index 0000000000..5622de477a --- /dev/null +++ b/units/initrd.target @@ -0,0 +1,17 @@ +# 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=Initrd Target +Documentation=man:systemd.special(7) +OnFailure=emergency.target +OnFailureIsolate=yes +ConditionPathExists=/etc/initrd-release +Requires=basic.target +Wants=initrd-root-fs.target initrd-fs.target initrd-parse-etc.service +After=initrd-root-fs.target initrd-fs.target basic.target rescue.service rescue.target +AllowIsolate=yes diff --git a/units/root-fs.target b/units/root-fs.target deleted file mode 100644 index 13515341eb..0000000000 --- a/units/root-fs.target +++ /dev/null @@ -1,11 +0,0 @@ -# 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=Initrd Root File System -Documentation=man:systemd.special(7) -ConditionPathExists=/etc/initrd-release -- cgit v1.2.3-54-g00ecf