<entry><constant>4d21b016-b534-45c2-a9fb-5c16e091fd2d</constant></entry>
<entry>Variable Data Partition</entry>
<entry><filename>/var/</filename></entry>
- <entry>The first partition with this type UUID on the same disk as the root partition is mounted to <filename>/var/</filename> — under the condition its partition UUID matches the first 128 bit of the HMAC-SHA256 of the GPT type uuid of this partition keyed by the machine ID of the installation stored in <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</entry>
+ <entry>The first partition with this type UUID on the same disk as the root partition is mounted
+ to <filename>/var/</filename> — under the condition its partition UUID matches the first 128 bit
+ of the HMAC-SHA256 of the GPT type uuid of this partition keyed by the machine ID of the
+ installation stored in
+ <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+ This can be generated using <citerefentry><refentrytitle>systemd-id128</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</entry>
</row>
<row>
<entry><constant>SD_GPT_TMP</constant></entry>
<arg choice="plain">invocation-id</arg>
</cmdsynopsis>
+ <cmdsynopsis>
+ <command>systemd-id128</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">var-partition-uuid</arg>
+ </cmdsynopsis>
+
<cmdsynopsis>
<command>systemd-id128</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for the discussion when this is useful. Support for <command>show --app-specific=</command> was added in
version 255.</para>
+
+ <para><command>var-partition-uuid</command> prints a UUID which, following the <ulink
+ url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable
+ Partitions Specification</ulink>, should be used as the GPT partition UUID for
+ <filename>/var/</filename>, being derived from the GPT partition type, keyed by the local
+ <filename>/etc/machine-id</filename>. Added in version 257.</para>
</refsect1>
<refsect1>
return id128_pretty_print(id, arg_mode);
}
+static int verb_var_uuid(int argc, char **argv, void *userdata) {
+ sd_id128_t id;
+ int r;
+
+ if (!sd_id128_is_null(arg_app))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Verb \"var-partition-uuid\" cannot be combined with --app-specific=.");
+
+ /* The DPS says that the UUID for /var/ should be keyed with machine-id. */
+ r = sd_id128_get_machine_app_specific(SD_GPT_VAR, &id);
+ if (r < 0)
+ return log_error_errno(r, "Failed to generate machine-specific /var/ UUID: %m");
+
+ return id128_pretty_print(id, arg_mode);
+}
+
static int show_one(Table **table, const char *name, sd_id128_t uuid, bool first) {
int r;
" machine-id Print the ID of current machine\n"
" boot-id Print the ID of current boot\n"
" invocation-id Print the ID of current invocation\n"
+ " var-partition-uuid Print the UUID for the /var/ partition\n"
" show [NAME|UUID] Print one or more UUIDs\n"
" help Show this help\n"
"\nOptions:\n"
static int id128_main(int argc, char *argv[]) {
static const Verb verbs[] = {
- { "new", VERB_ANY, 1, 0, verb_new },
- { "machine-id", VERB_ANY, 1, 0, verb_machine_id },
- { "boot-id", VERB_ANY, 1, 0, verb_boot_id },
- { "invocation-id", VERB_ANY, 1, 0, verb_invocation_id },
- { "show", VERB_ANY, VERB_ANY, 0, verb_show },
- { "help", VERB_ANY, VERB_ANY, 0, verb_help },
+ { "new", VERB_ANY, 1, 0, verb_new },
+ { "machine-id", VERB_ANY, 1, 0, verb_machine_id },
+ { "boot-id", VERB_ANY, 1, 0, verb_boot_id },
+ { "invocation-id", VERB_ANY, 1, 0, verb_invocation_id },
+ { "var-partition-uuid", VERB_ANY, 1, 0, verb_var_uuid },
+ { "show", VERB_ANY, VERB_ANY, 0, verb_show },
+ { "help", VERB_ANY, VERB_ANY, 0, verb_help },
{}
};