</para>
<para>Note that this setting is only taken into account when <option>--generate-crypttab=</option>
- is specified on the <command>systemd-repart</command> command line.</para>
+ is specified on the <command>systemd-repart</command> command line. As the crypttab with the expected
+ hashes can only be generated after LUKS volumes are formatted, the crypttab itself cannot be put to
+ the generated volume.</para>
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
return false;
}
-static int context_crypttab(Context *context) {
+static int context_crypttab(Context *context, bool late) {
_cleanup_(unlink_and_freep) char *t = NULL;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *path = NULL;
strempty(p->encrypted_volume->options));
}
- r = flink_tmpfile(f, t, path, 0);
+ r = flink_tmpfile(f, t, path, late ? LINK_TMPFILE_REPLACE : 0);
if (r < 0)
return log_error_errno(r, "Failed to link temporary file to %s: %m", path);
if (r < 0)
return r;
+ r = context_fstab(context);
+ if (r < 0)
+ return r;
+
+ r = context_crypttab(context, /* late= */ false);
+ if (r < 0)
+ return r;
+
r = context_update_verity_size(context);
if (r < 0)
return r;
if (r < 0)
return r;
- r = context_fstab(context);
- if (r < 0)
- return r;
-
- r = context_crypttab(context);
+ r = context_crypttab(context, /* late= */ true);
if (r < 0)
return r;