2 This file is part of systemd.
4 Copyright 2016 Lennart Poettering
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 #ifdef HAVE_LIBCRYPTSETUP
21 #include <libcryptsetup.h>
23 #include <linux/dm-ioctl.h>
24 #include <sys/mount.h>
26 #include "architecture.h"
27 #include "ask-password-api.h"
28 #include "blkid-util.h"
29 #include "dissect-image.h"
32 #include "mount-util.h"
33 #include "path-util.h"
34 #include "stat-util.h"
35 #include "stdio-util.h"
36 #include "string-table.h"
37 #include "string-util.h"
38 #include "udev-util.h"
40 static int probe_filesystem(const char *node
, char **ret_fstype
) {
42 _cleanup_blkid_free_probe_ blkid_probe b
= NULL
;
46 b
= blkid_new_probe_from_filename(node
);
50 blkid_probe_enable_superblocks(b
, 1);
51 blkid_probe_set_superblocks_flags(b
, BLKID_SUBLKS_TYPE
);
54 r
= blkid_do_safeprobe(b
);
55 if (r
== -2 || r
== 1) {
56 log_debug("Failed to identify any partition type on partition %s", node
);
66 (void) blkid_probe_lookup_value(b
, "TYPE", &fstype
, NULL
);
87 int dissect_image(int fd
, const void *root_hash
, size_t root_hash_size
, DissectedImage
**ret
) {
90 sd_id128_t root_uuid
= SD_ID128_NULL
, verity_uuid
= SD_ID128_NULL
;
91 _cleanup_udev_enumerate_unref_
struct udev_enumerate
*e
= NULL
;
92 bool is_gpt
, is_mbr
, generic_rw
, multiple_generic
= false;
93 _cleanup_udev_device_unref_
struct udev_device
*d
= NULL
;
94 _cleanup_(dissected_image_unrefp
) DissectedImage
*m
= NULL
;
95 _cleanup_blkid_free_probe_ blkid_probe b
= NULL
;
96 _cleanup_udev_unref_
struct udev
*udev
= NULL
;
97 _cleanup_free_
char *generic_node
= NULL
;
98 const char *pttype
= NULL
, *usage
= NULL
;
99 struct udev_list_entry
*first
, *item
;
107 assert(root_hash
|| root_hash_size
== 0);
109 /* Probes a disk image, and returns information about what it found in *ret.
111 * Returns -ENOPKG if no suitable partition table or file system could be found.
112 * Returns -EADDRNOTAVAIL if a root hash was specified but no matching root/verity partitions found. */
115 /* If a root hash is supplied, then we use the root partition that has a UUID that match the first
116 * 128bit of the root hash. And we use the verity partition that has a UUID that match the final
119 if (root_hash_size
< sizeof(sd_id128_t
))
122 memcpy(&root_uuid
, root_hash
, sizeof(sd_id128_t
));
123 memcpy(&verity_uuid
, (const uint8_t*) root_hash
+ root_hash_size
- sizeof(sd_id128_t
), sizeof(sd_id128_t
));
125 if (sd_id128_is_null(root_uuid
))
127 if (sd_id128_is_null(verity_uuid
))
131 if (fstat(fd
, &st
) < 0)
134 if (!S_ISBLK(st
.st_mode
))
137 b
= blkid_new_probe();
142 r
= blkid_probe_set_device(b
, fd
, 0, 0);
150 blkid_probe_enable_superblocks(b
, 1);
151 blkid_probe_set_superblocks_flags(b
, BLKID_SUBLKS_TYPE
|BLKID_SUBLKS_USAGE
);
152 blkid_probe_enable_partitions(b
, 1);
153 blkid_probe_set_partitions_flags(b
, BLKID_PARTS_ENTRY_DETAILS
);
156 r
= blkid_do_safeprobe(b
);
157 if (r
== -2 || r
== 1) {
158 log_debug("Failed to identify any partition table.");
168 m
= new0(DissectedImage
, 1);
172 (void) blkid_probe_lookup_value(b
, "USAGE", &usage
, NULL
);
173 if (STRPTR_IN_SET(usage
, "filesystem", "crypto")) {
174 _cleanup_free_
char *t
= NULL
, *n
= NULL
;
175 const char *fstype
= NULL
;
177 /* OK, we have found a file system, that's our root partition then. */
178 (void) blkid_probe_lookup_value(b
, "TYPE", &fstype
, NULL
);
186 if (asprintf(&n
, "/dev/block/%u:%u", major(st
.st_rdev
), minor(st
.st_rdev
)) < 0)
189 m
->partitions
[PARTITION_ROOT
] = (DissectedPartition
) {
193 .architecture
= _ARCHITECTURE_INVALID
,
200 m
->encrypted
= streq(fstype
, "crypto_LUKS");
208 (void) blkid_probe_lookup_value(b
, "PTTYPE", &pttype
, NULL
);
212 is_gpt
= streq_ptr(pttype
, "gpt");
213 is_mbr
= streq_ptr(pttype
, "dos");
215 if (!is_gpt
&& !is_mbr
)
219 pl
= blkid_probe_get_partitions(b
);
231 d
= udev_device_new_from_devnum(udev
, 'b', st
.st_rdev
);
239 log_debug("Kernel partitions never appeared.");
243 e
= udev_enumerate_new(udev
);
247 r
= udev_enumerate_add_match_parent(e
, d
);
251 r
= udev_enumerate_scan_devices(e
);
255 /* Count the partitions enumerated by the kernel */
257 first
= udev_enumerate_get_list_entry(e
);
258 udev_list_entry_foreach(item
, first
)
261 /* Count the partitions enumerated by blkid */
262 z
= blkid_partlist_numof_partitions(pl
);
266 log_debug("blkid and kernel partition list do not match.");
272 /* The kernel has probed fewer partitions than blkid? Maybe the kernel prober is still running
273 * or it got EBUSY because udev already opened the device. Let's reprobe the device, which is a
274 * synchronous call that waits until probing is complete. */
276 for (j
= 0; j
< 20; j
++) {
278 r
= ioctl(fd
, BLKRRPART
, 0);
281 if (r
>= 0 || r
!= -EBUSY
)
284 /* If something else has the device open, such as an udev rule, the ioctl will return
285 * EBUSY. Since there's no way to wait until it isn't busy anymore, let's just wait a
286 * bit, and try again.
288 * This is really something they should fix in the kernel! */
290 usleep(50 * USEC_PER_MSEC
);
297 e
= udev_enumerate_unref(e
);
300 first
= udev_enumerate_get_list_entry(e
);
301 udev_list_entry_foreach(item
, first
) {
302 _cleanup_udev_device_unref_
struct udev_device
*q
;
303 unsigned long long flags
;
309 q
= udev_device_new_from_syspath(udev
, udev_list_entry_get_name(item
));
313 qn
= udev_device_get_devnum(q
);
317 if (st
.st_rdev
== qn
)
320 node
= udev_device_get_devnode(q
);
324 pp
= blkid_partlist_devno_to_partition(pl
, qn
);
328 flags
= blkid_partition_get_flags(pp
);
330 nr
= blkid_partition_get_partno(pp
);
335 int designator
= _PARTITION_DESIGNATOR_INVALID
, architecture
= _ARCHITECTURE_INVALID
;
336 const char *stype
, *sid
, *fstype
= NULL
;
337 sd_id128_t type_id
, id
;
340 if (flags
& GPT_FLAG_NO_AUTO
)
343 sid
= blkid_partition_get_uuid(pp
);
346 if (sd_id128_from_string(sid
, &id
) < 0)
349 stype
= blkid_partition_get_type_string(pp
);
352 if (sd_id128_from_string(stype
, &type_id
) < 0)
355 if (sd_id128_equal(type_id
, GPT_HOME
)) {
356 designator
= PARTITION_HOME
;
357 rw
= !(flags
& GPT_FLAG_READ_ONLY
);
358 } else if (sd_id128_equal(type_id
, GPT_SRV
)) {
359 designator
= PARTITION_SRV
;
360 rw
= !(flags
& GPT_FLAG_READ_ONLY
);
361 } else if (sd_id128_equal(type_id
, GPT_ESP
)) {
362 designator
= PARTITION_ESP
;
365 #ifdef GPT_ROOT_NATIVE
366 else if (sd_id128_equal(type_id
, GPT_ROOT_NATIVE
)) {
368 /* If a root ID is specified, ignore everything but the root id */
369 if (!sd_id128_is_null(root_uuid
) && !sd_id128_equal(root_uuid
, id
))
372 designator
= PARTITION_ROOT
;
373 architecture
= native_architecture();
374 rw
= !(flags
& GPT_FLAG_READ_ONLY
);
376 #ifdef GPT_ROOT_NATIVE_VERITY
377 else if (sd_id128_equal(type_id
, GPT_ROOT_NATIVE_VERITY
)) {
379 m
->can_verity
= true;
381 /* Ignore verity unless a root hash is specified */
382 if (sd_id128_is_null(verity_uuid
) || !sd_id128_equal(verity_uuid
, id
))
385 designator
= PARTITION_ROOT_VERITY
;
386 fstype
= "DM_verity_hash";
387 architecture
= native_architecture();
392 #ifdef GPT_ROOT_SECONDARY
393 else if (sd_id128_equal(type_id
, GPT_ROOT_SECONDARY
)) {
395 /* If a root ID is specified, ignore everything but the root id */
396 if (!sd_id128_is_null(root_uuid
) && !sd_id128_equal(root_uuid
, id
))
399 designator
= PARTITION_ROOT_SECONDARY
;
400 architecture
= SECONDARY_ARCHITECTURE
;
401 rw
= !(flags
& GPT_FLAG_READ_ONLY
);
403 #ifdef GPT_ROOT_SECONDARY_VERITY
404 else if (sd_id128_equal(type_id
, GPT_ROOT_SECONDARY_VERITY
)) {
406 m
->can_verity
= true;
408 /* Ignore verity unless root has is specified */
409 if (sd_id128_is_null(verity_uuid
) || !sd_id128_equal(verity_uuid
, id
))
412 designator
= PARTITION_ROOT_SECONDARY_VERITY
;
413 fstype
= "DM_verity_hash";
414 architecture
= SECONDARY_ARCHITECTURE
;
419 else if (sd_id128_equal(type_id
, GPT_SWAP
)) {
420 designator
= PARTITION_SWAP
;
422 } else if (sd_id128_equal(type_id
, GPT_LINUX_GENERIC
)) {
425 multiple_generic
= true;
428 generic_rw
= !(flags
& GPT_FLAG_READ_ONLY
);
429 generic_node
= strdup(node
);
435 if (designator
!= _PARTITION_DESIGNATOR_INVALID
) {
436 _cleanup_free_
char *t
= NULL
, *n
= NULL
;
439 if (m
->partitions
[designator
].found
)
452 m
->partitions
[designator
] = (DissectedPartition
) {
456 .architecture
= architecture
,
466 if (flags
!= 0x80) /* Bootable flag */
469 if (blkid_partition_get_type(pp
) != 0x83) /* Linux partition */
473 multiple_generic
= true;
477 generic_node
= strdup(node
);
484 if (!m
->partitions
[PARTITION_ROOT
].found
) {
485 /* No root partition found? Then let's see if ther's one for the secondary architecture. And if not
486 * either, then check if there's a single generic one, and use that. */
488 if (m
->partitions
[PARTITION_ROOT_VERITY
].found
)
491 if (m
->partitions
[PARTITION_ROOT_SECONDARY
].found
) {
492 m
->partitions
[PARTITION_ROOT
] = m
->partitions
[PARTITION_ROOT_SECONDARY
];
493 zero(m
->partitions
[PARTITION_ROOT_SECONDARY
]);
495 m
->partitions
[PARTITION_ROOT_VERITY
] = m
->partitions
[PARTITION_ROOT_SECONDARY_VERITY
];
496 zero(m
->partitions
[PARTITION_ROOT_SECONDARY_VERITY
]);
498 } else if (generic_node
&& !root_hash
) {
500 if (multiple_generic
)
503 m
->partitions
[PARTITION_ROOT
] = (DissectedPartition
) {
506 .partno
= generic_nr
,
507 .architecture
= _ARCHITECTURE_INVALID
,
508 .node
= generic_node
,
516 assert(m
->partitions
[PARTITION_ROOT
].found
);
519 if (!m
->partitions
[PARTITION_ROOT_VERITY
].found
)
520 return -EADDRNOTAVAIL
;
522 /* If we found the primary root with the hash, then we definitely want to suppress any secondary root
523 * (which would be weird, after all the root hash should only be assigned to one pair of
525 m
->partitions
[PARTITION_ROOT_SECONDARY
].found
= false;
526 m
->partitions
[PARTITION_ROOT_SECONDARY_VERITY
].found
= false;
528 /* If we found a verity setup, then the root partition is necessarily read-only. */
529 m
->partitions
[PARTITION_ROOT
].rw
= false;
537 /* Fill in file system types if we don't know them yet. */
538 for (i
= 0; i
< _PARTITION_DESIGNATOR_MAX
; i
++) {
539 DissectedPartition
*p
= m
->partitions
+ i
;
544 if (!p
->fstype
&& p
->node
) {
545 r
= probe_filesystem(p
->node
, &p
->fstype
);
550 if (streq_ptr(p
->fstype
, "crypto_LUKS"))
563 DissectedImage
* dissected_image_unref(DissectedImage
*m
) {
569 for (i
= 0; i
< _PARTITION_DESIGNATOR_MAX
; i
++) {
570 free(m
->partitions
[i
].fstype
);
571 free(m
->partitions
[i
].node
);
572 free(m
->partitions
[i
].decrypted_fstype
);
573 free(m
->partitions
[i
].decrypted_node
);
580 static int is_loop_device(const char *path
) {
581 char s
[strlen("/sys/dev/block/") + DECIMAL_STR_MAX(dev_t
) + 1 + DECIMAL_STR_MAX(dev_t
) + strlen("/../loop/")];
586 if (stat(path
, &st
) < 0)
589 if (!S_ISBLK(st
.st_mode
))
592 xsprintf(s
, "/sys/dev/block/%u:%u/loop/", major(st
.st_rdev
), minor(st
.st_rdev
));
593 if (access(s
, F_OK
) < 0) {
597 /* The device itself isn't a loop device, but maybe it's a partition and its parent is? */
598 xsprintf(s
, "/sys/dev/block/%u:%u/../loop/", major(st
.st_rdev
), minor(st
.st_rdev
));
599 if (access(s
, F_OK
) < 0)
600 return errno
== ENOENT
? false : -errno
;
606 static int mount_partition(
607 DissectedPartition
*m
,
609 const char *directory
,
610 DissectImageFlags flags
) {
612 const char *p
, *options
= NULL
, *node
, *fstype
;
618 node
= m
->decrypted_node
?: m
->node
;
619 fstype
= m
->decrypted_fstype
?: m
->fstype
;
621 if (!m
->found
|| !node
|| !fstype
)
624 /* Stacked encryption? Yuck */
625 if (streq_ptr(fstype
, "crypto_LUKS"))
628 rw
= m
->rw
&& !(flags
& DISSECT_IMAGE_READ_ONLY
);
631 p
= strjoina(where
, directory
);
635 /* If requested, turn on discard support. */
636 if (STR_IN_SET(fstype
, "btrfs", "ext4", "vfat", "xfs") &&
637 ((flags
& DISSECT_IMAGE_DISCARD
) ||
638 ((flags
& DISSECT_IMAGE_DISCARD_ON_LOOP
) && is_loop_device(m
->node
))))
641 return mount_verbose(LOG_DEBUG
, node
, p
, fstype
, MS_NODEV
|(rw
? 0 : MS_RDONLY
), options
);
644 int dissected_image_mount(DissectedImage
*m
, const char *where
, DissectImageFlags flags
) {
650 if (!m
->partitions
[PARTITION_ROOT
].found
)
653 r
= mount_partition(m
->partitions
+ PARTITION_ROOT
, where
, NULL
, flags
);
657 r
= mount_partition(m
->partitions
+ PARTITION_HOME
, where
, "/home", flags
);
661 r
= mount_partition(m
->partitions
+ PARTITION_SRV
, where
, "/srv", flags
);
665 if (m
->partitions
[PARTITION_ESP
].found
) {
668 /* Mount the ESP to /efi if it exists and is empty. If it doesn't exist, use /boot instead. */
671 x
= strjoina(where
, mp
);
675 x
= strjoina(where
, mp
);
679 r
= mount_partition(m
->partitions
+ PARTITION_ESP
, where
, mp
, flags
);
688 #ifdef HAVE_LIBCRYPTSETUP
689 typedef struct DecryptedPartition
{
690 struct crypt_device
*device
;
693 } DecryptedPartition
;
695 struct DecryptedImage
{
696 DecryptedPartition
*decrypted
;
702 DecryptedImage
* decrypted_image_unref(DecryptedImage
* d
) {
703 #ifdef HAVE_LIBCRYPTSETUP
710 for (i
= 0; i
< d
->n_decrypted
; i
++) {
711 DecryptedPartition
*p
= d
->decrypted
+ i
;
713 if (p
->device
&& p
->name
&& !p
->relinquished
) {
714 r
= crypt_deactivate(p
->device
, p
->name
);
716 log_debug_errno(r
, "Failed to deactivate encrypted partition %s", p
->name
);
720 crypt_free(p
->device
);
729 #ifdef HAVE_LIBCRYPTSETUP
731 static int make_dm_name_and_node(const void *original_node
, const char *suffix
, char **ret_name
, char **ret_node
) {
732 _cleanup_free_
char *name
= NULL
, *node
= NULL
;
735 assert(original_node
);
740 base
= strrchr(original_node
, '/');
747 name
= strjoin(base
, suffix
);
750 if (!filename_is_valid(name
))
753 node
= strjoin(crypt_get_dir(), "/", name
);
764 static int decrypt_partition(
765 DissectedPartition
*m
,
766 const char *passphrase
,
767 DissectImageFlags flags
,
770 _cleanup_free_
char *node
= NULL
, *name
= NULL
;
771 struct crypt_device
*cd
;
777 if (!m
->found
|| !m
->node
|| !m
->fstype
)
780 if (!streq(m
->fstype
, "crypto_LUKS"))
783 r
= make_dm_name_and_node(m
->node
, "-decrypted", &name
, &node
);
787 if (!GREEDY_REALLOC0(d
->decrypted
, d
->n_allocated
, d
->n_decrypted
+ 1))
790 r
= crypt_init(&cd
, m
->node
);
794 r
= crypt_load(cd
, CRYPT_LUKS1
, NULL
);
798 r
= crypt_activate_by_passphrase(cd
, name
, CRYPT_ANY_SLOT
, passphrase
, strlen(passphrase
),
799 ((flags
& DISSECT_IMAGE_READ_ONLY
) ? CRYPT_ACTIVATE_READONLY
: 0) |
800 ((flags
& DISSECT_IMAGE_DISCARD_ON_CRYPTO
) ? CRYPT_ACTIVATE_ALLOW_DISCARDS
: 0));
808 d
->decrypted
[d
->n_decrypted
].name
= name
;
811 d
->decrypted
[d
->n_decrypted
].device
= cd
;
814 m
->decrypted_node
= node
;
824 static int verity_partition(
825 DissectedPartition
*m
,
826 DissectedPartition
*v
,
827 const void *root_hash
,
828 size_t root_hash_size
,
829 DissectImageFlags flags
,
832 _cleanup_free_
char *node
= NULL
, *name
= NULL
;
833 struct crypt_device
*cd
;
842 if (!m
->found
|| !m
->node
|| !m
->fstype
)
844 if (!v
->found
|| !v
->node
|| !v
->fstype
)
847 if (!streq(v
->fstype
, "DM_verity_hash"))
850 r
= make_dm_name_and_node(m
->node
, "-verity", &name
, &node
);
854 if (!GREEDY_REALLOC0(d
->decrypted
, d
->n_allocated
, d
->n_decrypted
+ 1))
857 r
= crypt_init(&cd
, v
->node
);
861 r
= crypt_load(cd
, CRYPT_VERITY
, NULL
);
865 r
= crypt_set_data_device(cd
, m
->node
);
869 r
= crypt_activate_by_volume_key(cd
, name
, root_hash
, root_hash_size
, CRYPT_ACTIVATE_READONLY
);
873 d
->decrypted
[d
->n_decrypted
].name
= name
;
876 d
->decrypted
[d
->n_decrypted
].device
= cd
;
879 m
->decrypted_node
= node
;
890 int dissected_image_decrypt(
892 const char *passphrase
,
893 const void *root_hash
,
894 size_t root_hash_size
,
895 DissectImageFlags flags
,
896 DecryptedImage
**ret
) {
898 _cleanup_(decrypted_image_unrefp
) DecryptedImage
*d
= NULL
;
899 #ifdef HAVE_LIBCRYPTSETUP
905 assert(root_hash
|| root_hash_size
== 0);
909 * = 0 → There was nothing to decrypt
910 * > 0 → Decrypted successfully
911 * -ENOKEY → There's some to decrypt but no key was supplied
912 * -EKEYREJECTED → Passed key was not correct
915 if (root_hash
&& root_hash_size
< sizeof(sd_id128_t
))
918 if (!m
->encrypted
&& !m
->verity
) {
923 #ifdef HAVE_LIBCRYPTSETUP
924 if (m
->encrypted
&& !passphrase
)
927 d
= new0(DecryptedImage
, 1);
931 for (i
= 0; i
< _PARTITION_DESIGNATOR_MAX
; i
++) {
932 DissectedPartition
*p
= m
->partitions
+ i
;
938 r
= decrypt_partition(p
, passphrase
, flags
, d
);
942 k
= PARTITION_VERITY_OF(i
);
944 r
= verity_partition(p
, m
->partitions
+ k
, root_hash
, root_hash_size
, flags
, d
);
949 if (!p
->decrypted_fstype
&& p
->decrypted_node
) {
950 r
= probe_filesystem(p
->decrypted_node
, &p
->decrypted_fstype
);
965 int dissected_image_decrypt_interactively(
967 const char *passphrase
,
968 const void *root_hash
,
969 size_t root_hash_size
,
970 DissectImageFlags flags
,
971 DecryptedImage
**ret
) {
973 _cleanup_strv_free_erase_
char **z
= NULL
;
980 r
= dissected_image_decrypt(m
, passphrase
, root_hash
, root_hash_size
, flags
, ret
);
983 if (r
== -EKEYREJECTED
)
984 log_error_errno(r
, "Incorrect passphrase, try again!");
985 else if (r
!= -ENOKEY
) {
986 log_error_errno(r
, "Failed to decrypt image: %m");
991 log_error("Too many retries.");
992 return -EKEYREJECTED
;
997 r
= ask_password_auto("Please enter image passphrase!", NULL
, "dissect", "dissect", USEC_INFINITY
, 0, &z
);
999 return log_error_errno(r
, "Failed to query for passphrase: %m");
1005 #ifdef HAVE_LIBCRYPTSETUP
1006 static int deferred_remove(DecryptedPartition
*p
) {
1008 struct dm_ioctl dm
= {
1012 DM_VERSION_PATCHLEVEL
1014 .data_size
= sizeof(dm
),
1015 .flags
= DM_DEFERRED_REMOVE
,
1018 _cleanup_close_
int fd
= -1;
1022 /* Unfortunately, libcryptsetup doesn't provide a proper API for this, hence call the ioctl() directly. */
1024 fd
= open("/dev/mapper/control", O_RDWR
|O_CLOEXEC
);
1028 strncpy(dm
.name
, p
->name
, sizeof(dm
.name
));
1030 if (ioctl(fd
, DM_DEV_REMOVE
, &dm
))
1037 int decrypted_image_relinquish(DecryptedImage
*d
) {
1039 #ifdef HAVE_LIBCRYPTSETUP
1046 /* Turns on automatic removal after the last use ended for all DM devices of this image, and sets a boolean so
1047 * that we don't clean it up ourselves either anymore */
1049 #ifdef HAVE_LIBCRYPTSETUP
1050 for (i
= 0; i
< d
->n_decrypted
; i
++) {
1051 DecryptedPartition
*p
= d
->decrypted
+ i
;
1053 if (p
->relinquished
)
1056 r
= deferred_remove(p
);
1058 return log_debug_errno(r
, "Failed to mark %s for auto-removal: %m", p
->name
);
1060 p
->relinquished
= true;
1067 static const char *const partition_designator_table
[] = {
1068 [PARTITION_ROOT
] = "root",
1069 [PARTITION_ROOT_SECONDARY
] = "root-secondary",
1070 [PARTITION_HOME
] = "home",
1071 [PARTITION_SRV
] = "srv",
1072 [PARTITION_ESP
] = "esp",
1073 [PARTITION_SWAP
] = "swap",
1074 [PARTITION_ROOT_VERITY
] = "root-verity",
1075 [PARTITION_ROOT_SECONDARY_VERITY
] = "root-secondary-verity",
1078 DEFINE_STRING_TABLE_LOOKUP(partition_designator
, int);