Skip to content

Commit a0dd209

Browse files
committed
units: replace remote-cryptsetup-pre.target with remote-fs-pre.target
remote-cryptsetup-pre.target was designed as an active unit (that pulls in network-online.target), the opposite of remote-fs-pre.target (a passive unit, with individual provider services ordering itself before it and pulling it in, for example iscsi.service and nfs-client.target). To make remote-cryptsetup-pre.target really work, those services should be ordered before it too. But this would require updates to all those services, not just changes from systemd side. But the requirements for remote-fs-pre.target and remote-cryptset-pre.target are fairly similar (e.g. iscsi devices can certainly be used for both), so let's reuse remote-fs-pre.target also for remote cryptsetup units. This loses a bit of flexibility, but does away with the requirement for various provider services to know about remote-cryptsetup-pre.target.
1 parent 8f462b0 commit a0dd209

File tree

6 files changed

+7
-35
lines changed

6 files changed

+7
-35
lines changed

man/crypttab.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
started after the network is available, similarly to
199199
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
200200
units marked with <option>_netdev</option>. The service unit to set up this device
201-
will be ordered between <filename>remote-cryptsetup-pre.target</filename> and
201+
will be ordered between <filename>remote-fs-pre.target</filename> and
202202
<filename>remote-cryptsetup.target</filename>, instead of
203203
<filename>cryptsetup-pre.target</filename> and
204204
<filename>cryptsetup.target</filename>.</para></listitem>

man/systemd.special.xml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
<filename>poweroff.target</filename>,
8282
<filename>printer.target</filename>,
8383
<filename>reboot.target</filename>,
84-
<filename>remote-cryptsetup-pre.target</filename>,
8584
<filename>remote-cryptsetup.target</filename>,
8685
<filename>remote-fs-pre.target</filename>,
8786
<filename>remote-fs.target</filename>,
@@ -494,18 +493,6 @@
494493
this target unit, for compatibility with SysV.</para>
495494
</listitem>
496495
</varlistentry>
497-
<varlistentry>
498-
<term><filename>remote-cryptsetup-pre.target</filename></term>
499-
<listitem>
500-
<para>This target unit is automatically ordered before all cryptsetup devices
501-
marked with the <option>_netdev</option>. It can be used to execute additional
502-
units before such devices are set up.</para>
503-
504-
<para>It is ordered after <filename>network.target</filename> and
505-
<filename>network-online.target</filename>, and also pulls the latter in as a
506-
<varname>Wants=</varname> dependency.</para>
507-
</listitem>
508-
</varlistentry>
509496
<varlistentry>
510497
<term><filename>remote-cryptsetup.target</filename></term>
511498
<listitem>
@@ -906,9 +893,10 @@
906893
<term><filename>remote-fs-pre.target</filename></term>
907894
<listitem>
908895
<para>This target unit is automatically ordered before all
909-
remote mount point units (see above). It can be used to run
910-
certain units before the remote mounts are established. Note
911-
that this unit is generally not part of the initial
896+
mount point units (see above) and cryptsetup devices
897+
marked with the <option>_netdev</option>. It can be used to run
898+
certain units before remote encrypted devices and mounts are established.
899+
Note that this unit is generally not part of the initial
912900
transaction, unless the unit that wants to be ordered before
913901
all remote mounts pulls it in via a
914902
<varname>Wants=</varname> type dependency. If the unit wants

src/cryptsetup/cryptsetup-generator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int create_disk(
113113
"Conflicts=umount.target\n"
114114
"IgnoreOnIsolate=true\n"
115115
"After=%s\n",
116-
netdev ? "remote-cryptsetup-pre.target" : "cryptsetup-pre.target");
116+
netdev ? "remote-fs-pre.target" : "cryptsetup-pre.target");
117117

118118
if (!nofail)
119119
fprintf(f,

units/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ units = [
4848
['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
4949
['reboot.target', '',
5050
'runlevel6.target ctrl-alt-del.target'],
51-
['remote-cryptsetup-pre.target', 'HAVE_LIBCRYPTSETUP'],
5251
['remote-cryptsetup.target', 'HAVE_LIBCRYPTSETUP',
5352
join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')],
5453
['remote-fs-pre.target', ''],

units/remote-cryptsetup-pre.target

Lines changed: 0 additions & 15 deletions
This file was deleted.

units/remote-cryptsetup.target

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[Unit]
99
Description=Remote Encrypted Volumes
1010
Documentation=man:systemd.special(7)
11-
After=remote-cryptsetup-pre.target
11+
After=remote-fs-pre.target
1212
DefaultDependencies=no
1313
Conflicts=shutdown.target
1414

0 commit comments

Comments
 (0)