summaryrefslogtreecommitdiff
path: root/units
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-26 22:40:40 +0100
committerLennart Poettering <lennart@poettering.net>2021-04-20 18:26:17 +0200
commit29a24ab28e9790680348b1ffab653a321fa49a67 (patch)
tree6bf35850f80c21a86728106ed767e88a72bc4658 /units
parentee7561d014d073944779e155271d7042d7ea5572 (diff)
downloadsystemd-29a24ab28e9790680348b1ffab653a321fa49a67.tar.gz
fstab-generator: if usr= is specified, mount it to /sysusr/usr/ first
This changes the fstab-generator to handle mounting of /usr/ a bit differently than before. Instead of immediately mounting the fs to /sysroot/usr/ we'll first mount it to /sysusr/usr/ and then add a separate bind mount that mounts it from /sysusr/usr/ to /sysroot/usr/. This way we can access /usr independently of the root fs, without for waiting to be mounted via the /sysusr/ hierarchy. This is useful for invoking systemd-repart while a root fs doesn't exist yet and for creating it, with partition data read from the /usr/ hierarchy. This introduces a new generic target initrd-usr-fs.target that may be used to generically order services against /sysusr/ to become available.
Diffstat (limited to 'units')
-rw-r--r--units/initrd-usr-fs.target17
-rw-r--r--units/initrd.target4
-rw-r--r--units/meson.build1
-rw-r--r--units/systemd-repart.service.in2
-rw-r--r--units/systemd-volatile-root.service.in2
5 files changed, 22 insertions, 4 deletions
diff --git a/units/initrd-usr-fs.target b/units/initrd-usr-fs.target
new file mode 100644
index 0000000000..7219655c9c
--- /dev/null
+++ b/units/initrd-usr-fs.target
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# 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 /usr File System
+Documentation=man:systemd.special(7)
+AssertPathExists=/etc/initrd-release
+OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
+DefaultDependencies=no
+Conflicts=shutdown.target
diff --git a/units/initrd.target b/units/initrd.target
index 655158a58b..fc8fbff4bd 100644
--- a/units/initrd.target
+++ b/units/initrd.target
@@ -14,6 +14,6 @@ OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
AssertPathExists=/etc/initrd-release
Requires=basic.target
-Wants=initrd-root-fs.target initrd-root-device.target initrd-fs.target initrd-parse-etc.service
-After=initrd-root-fs.target initrd-root-device.target initrd-fs.target basic.target rescue.service rescue.target
+Wants=initrd-root-fs.target initrd-root-device.target initrd-fs.target initrd-usr-fs.target initrd-parse-etc.service
+After=initrd-root-fs.target initrd-root-device.target initrd-fs.target initrd-usr-fs.target basic.target rescue.service rescue.target
AllowIsolate=yes
diff --git a/units/meson.build b/units/meson.build
index 15463760c6..fe8e95ff91 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -38,6 +38,7 @@ units = [
['initrd-switch-root.service', 'ENABLE_INITRD'],
['initrd-switch-root.target', 'ENABLE_INITRD'],
['initrd-udevadm-cleanup-db.service', 'ENABLE_INITRD'],
+ ['initrd-usr-fs.target', 'ENABLE_INITRD'],
['initrd.target', 'ENABLE_INITRD'],
['kexec.target', ''],
['ldconfig.service', 'ENABLE_LDCONFIG',
diff --git a/units/systemd-repart.service.in b/units/systemd-repart.service.in
index a5565834eb..60dc7783b3 100644
--- a/units/systemd-repart.service.in
+++ b/units/systemd-repart.service.in
@@ -12,7 +12,7 @@ Description=Repartition Root Disk
Documentation=man:systemd-repart.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
-After=sysroot.mount
+After=initrd-usr-fs.target
Before=initrd-root-fs.target shutdown.target
ConditionVirtualization=!container
ConditionDirectoryNotEmpty=|/usr/lib/repart.d
diff --git a/units/systemd-volatile-root.service.in b/units/systemd-volatile-root.service.in
index 5ecc702b6d..468d85f968 100644
--- a/units/systemd-volatile-root.service.in
+++ b/units/systemd-volatile-root.service.in
@@ -12,7 +12,7 @@ Description=Enforce Volatile Root File Systems
Documentation=man:systemd-volatile-root.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
-After=sysroot.mount systemd-repart.service
+After=sysroot.mount sysroot-usr.mount systemd-repart.service
Before=initrd-root-fs.target shutdown.target
AssertPathExists=/etc/initrd-release