summaryrefslogtreecommitdiffstats
path: root/units
diff options
context:
space:
mode:
authorJonathan Lebon <jonathan@jlebon.com>2020-10-20 22:30:20 +0200
committerLennart Poettering <lennart@poettering.net>2020-10-21 22:08:19 +0200
commit6c5496c492a8d74e54d22bf8824160cab1e63c10 (patch)
tree5dd28fa028c3d690e41449870037a24bac6a7152 /units
parentMerge pull request #17356 from yuwata/sd-xxx-stop (diff)
downloadsystemd-6c5496c492a8d74e54d22bf8824160cab1e63c10.tar.xz
systemd-6c5496c492a8d74e54d22bf8824160cab1e63c10.zip
units: add initrd-cryptsetup.target
For encrypted block devices that we need to unlock from the initramfs, we currently rely on dracut shipping `cryptsetup.target`. This works, but doesn't cover the case where the encrypted block device requires networking (i.e. the `remote-cryptsetup.target` version). That target however is traditionally dynamically enabled. Instead, let's rework things here by adding a `initrd-cryptsetup.target` specifically for initramfs encrypted block device setup. This plays the role of both `cryptsetup.target` and `remote-cryptsetup.target` in the initramfs. Then, adapt `systemd-cryptsetup-generator` to hook all generated services to this new unit when running from the initrd. This is analogous to `systemd-fstab-generator` hooking all mounts to `initrd-fs.target`, regardless of whether they're network-backed or not.
Diffstat (limited to 'units')
-rw-r--r--units/initrd-cryptsetup.target17
-rw-r--r--units/meson.build2
2 files changed, 19 insertions, 0 deletions
diff --git a/units/initrd-cryptsetup.target b/units/initrd-cryptsetup.target
new file mode 100644
index 0000000000..2a2938c895
--- /dev/null
+++ b/units/initrd-cryptsetup.target
@@ -0,0 +1,17 @@
+# 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=Initrd Encrypted Volumes
+Documentation=man:systemd.special(7)
+OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
+AssertPathExists=/etc/initrd-release
+DefaultDependencies=no
+Conflicts=shutdown.target
diff --git a/units/meson.build b/units/meson.build
index 40ffca5058..a55e717868 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -28,6 +28,8 @@ units = [
['hybrid-sleep.target', 'ENABLE_HIBERNATE'],
['suspend-then-hibernate.target', 'ENABLE_HIBERNATE'],
['initrd-cleanup.service', 'ENABLE_INITRD'],
+ ['initrd-cryptsetup.target', 'HAVE_LIBCRYPTSETUP ENABLE_INITRD',
+ 'sysinit.target.wants/'],
['initrd-fs.target', 'ENABLE_INITRD'],
['initrd-parse-etc.service', 'ENABLE_INITRD'],
['initrd-root-device.target', 'ENABLE_INITRD'],