Add PARTUUID detection support
v9 cover Add PARTUUID detection support
Changes from Patch v8:
- Renamed GRUB_ENABLE_LINUX_PARTUUID to GRUB_DISABLE_LINUX_PARTUUID
- Updated the 10_linux logic so GRUB_ENABLE_LINUX_PARTUUID and GRUB_ENABLE_LINUX_UUID would behave more independently.
- Documented interactions of GRUB_DISABLE_LINUX_UUID, GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection in commit message.
- Added optional patch that sets GRUB_DISABLE_LINUX_PARTUUID to true by default.
- Fixed merge conflicts between this patchset and upstream's master branch.
Changes from Patch v7:
- Changed checks in probe_partuuid() to use the variable 'p' instead of disk->partition
- Moved 'disk->partition = p;' assignment to inside the 'p & p->parent == NULL' statement
- Moved 'disk->partition = p->parent;' assignment to before partmap name checks.
- Fixed formatting issues.
- Copied Daniel Kiper's reviewed-by line to unaltered patches.
Changes from Patch v6:
- Corrected spelling and grammatical errors in description text for GRUB_ENABLE_LINUX_PARTUUID
- Moved disk->partition save & restore logic to beginning and end of probe_partuuid()
- Fixed formatting errors in probe_partuuid
Changes from Patch v5:
- Added sign-off by lines
- Fixed formatting errors found by Daniel Kiper
Changes from Patch v4:
- Updated grub.texi to reflect new behavior for GRUB_ENABLE_LINUX_PARTUUID
- Updated 10_linux.in logic to favor the PARTUUID when GRUB_ENABLE_LINUX_PARTUUID is enabled and GRUB_DISABLE_LINUX_UUID is disabled.
Changes from Patch v3:
- Removed flex-2.6.3 compatibility patch
- Removed Steve Kenton's patch
Changes from Patch v2:
- Added flex-2.6.3 compatibility patch
- Fixed a GPT partition read error
- Added Steve Kenton's patch
- Changed struct grub_part_gpt_type name to struct grub_part_gpt_part_guid
- Changed grub_part_gpt_type_t typedef name to grub_part_gpt_guid_t
- Added sprint_gpt_guid to Steve Kenton's patch
- Updated v1 and Steve Kenton's patch to use similar methods when reading partition GUIDs.
Changes from Patch v1:
- Added GRUB_ENABLE_LINUX_PARTUUID variable description to grub.texi
- Removed added gpt_part_guid copy logic from
grub_gpt_partition_map_iterate()
- Removed added NT disk signature copy logic from grub_partition_msdos_iterate()
- Removed modifications to partition number increment logic
- Removed added guid union definition.
- Added GRUB_ENABLE_LINUX_PARTUUID to grub-mkconfig.in export list
- Moved PRINT_GPT_PARTTYPE printing logic to print_gpt_guid() function in grub-probe.c
- Updated PRINT_GPT_PARTTYPE case to call print_gpt_guid() function in grub-probe.c.
- Created probe_partuuid() function in grub-probe.c
- Updated print == PRINT_PARTUUID check logic in probe() to call probe_partuuid().
- Updated UUID logic in 10_linux.in to enable root=PARTUUID feature only if GRUB_DISABLE_LINUX_UUID is not set to true, and GRUB_DEVICE_PARTUUID is not empty, GRUB_ENABLE_LINUX_PARTUUID is set to true.
Hello,
This is a request to add PARTUUID detection support grub-probe for MBR and GPT partition schemes. The Linux kernel supports mounting the root filesystem by Linux device name or by the Partition [GU]UID. GRUB's mkconfig, however, currently only supports specifying the rootfs in the kernel command-line by Linux device name unless an initramfs is also present. When an initramfs is present GRUB's mkconfig will set the kernel's root parameter value to either the Linux device name or to the filesystem [GU]UID.
Therefore, the only way to protect a Linux system from failing to boot when its Linux storage device names change is to either manually edit grub.cfg or /etc/default/grub and append root=PARTUUID=xxx to the command-line or create an initramfs that understands how to mount devices by filesystem [G]UID and let grub-mkconfig pass the filesystem [GU]UID to the initramfs.
The goal of this patch set is to enable root=PARTUUID=xxx support in grub-mkconfig, so that users don't have to manually edit /etc/default/grub or grub.cfg, or create an initramfs for the sole purpose of having a robust bootloader configuration for Linux.
Thanks,
Nicholas Vinson
Nicholas Vinson (5):
Centralize guid prints
Update grub_gpt_partentry
Add PARTUUID detection support to grub-probe
Update grub script template files
Default to disabling partition UUID support
docs/grub.texi | 11 +++++++ grub-core/disk/ldm.c | 2 +- grub-core/partmap/gpt.c | 4 +-- include/grub/gpt_partition.h | 8 ++--- util/grub-install.c | 2 +- util/grub-mkconfig.in | 3 ++ util/grub-probe.c | 76 +++++++++++++++++++++++++++++++++++--------- util/grub.d/10_linux.in | 22 +++++++++++-- 8 files changed, 102 insertions(+), 26 deletions(-)
Signature · 1 line
2.16.3
PATCH v9 1/5 Centralize guid prints
Define print_gpt_guid(), so there is a central function for printing GUID strings. This change is a precursor for later patches which rely on this logic.
--- util/grub-probe.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
util/grub-probe.c +15 -15
@@ -129,6 +129,20 @@ get_targets_string (void)return str; } +static int +print_gpt_guid (grub_gpt_part_guid_t guid) +{ + guid.data1 =grub_le_to_cpu32 (guid.data1); + guid.data2 =grub_le_to_cpu16 (guid.data2); + guid.data3 =grub_le_to_cpu16 (guid.data3); + +return grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" , + guid.data1, guid.data2, guid.data3, guid.data4[0 ], + guid.data4[1 ], guid.data4[2 ], guid.data4[3 ], + guid.data4[4 ], guid.data4[5 ], guid.data4[6 ], + guid.data4[7 ]); +} +static void do_print (const char *x,void *data) {
@@ -641,21 +655,7 @@ probe (const char *path, char **device_names, char delim)if (grub_disk_read (dev->disk, p->offset, p->index,sizeof (gptdata), &gptdata) ==0 ) - { -grub_gpt_part_type_t gpttype; - gpttype.data1 =grub_le_to_cpu32 (gptdata.type.data1); - gpttype.data2 =grub_le_to_cpu16 (gptdata.type.data2); - gpttype.data3 =grub_le_to_cpu16 (gptdata.type.data3); -grub_memcpy (gpttype.data4, gptdata.type.data4,8 ); - -grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" , - gpttype.data1, gpttype.data2, - gpttype.data3, gpttype.data4[0 ], - gpttype.data4[1 ], gpttype.data4[2 ], - gpttype.data4[3 ], gpttype.data4[4 ], - gpttype.data4[5 ], gpttype.data4[6 ], - gpttype.data4[7 ]); - } +print_gpt_guid (gptdata.type); dev->disk->partition = p; }putchar (delim);
Signature · 1 line
2.16.3
PATCH v9 2/5 Update grub_gpt_partentry
In reply to Nicholas VinsonRename grub_gpt_part_type to grub_gpt_part_guid and update grub_gpt_partentry to use this type for both the partition type GUID string and the partition GUID string entries. This change ensures that the two GUID fields are handled more consistently and helps to simplify the changes needed to add Linux partition GUID support.
--- grub-core/disk/ldm.c | 2 +- grub-core/partmap/gpt.c | 4 ++-- include/grub/gpt_partition.h | 8 ++++---- util/grub-install.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
grub-core/disk/ldm.c +1 -1
@@ -135,7 +135,7 @@ msdos_has_ldm_partition (grub_disk_t dsk)return has_ldm; } -static const grub_gpt_part_type_t ldm_type =GRUB_GPT_PARTITION_TYPE_LDM ; +static const grub_gpt_part_guid_t ldm_type =GRUB_GPT_PARTITION_TYPE_LDM ;/* Helper for gpt_ldm_sector. */ static int
grub-core/partmap/gpt.c +2 -2
@@ -33,10 +33,10 @@ static grub_uint8_t grub_gpt_magic[8] = 0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54 }; -static const grub_gpt_part_type_t grub_gpt_partition_type_empty =GRUB_GPT_PARTITION_TYPE_EMPTY ; +static const grub_gpt_part_guid_t grub_gpt_partition_type_empty =GRUB_GPT_PARTITION_TYPE_EMPTY ;#ifdef GRUB_UTIL -static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot =GRUB_GPT_PARTITION_TYPE_BIOS_BOOT ; +static const grub_gpt_part_guid_t grub_gpt_partition_type_bios_boot =GRUB_GPT_PARTITION_TYPE_BIOS_BOOT ;#endif /* 512 << 7 = 65536 byte sectors. */
include/grub/gpt_partition.h +4 -4
@@ -22,14 +22,14 @@#include <grub/types.h> #include <grub/partition.h> -struct grub_gpt_part_type +struct grub_gpt_part_guid {grub_uint32_t data1;grub_uint16_t data2;grub_uint16_t data3;grub_uint8_t data4[8 ]; }GRUB_PACKED ; -typedef struct grub_gpt_part_type grub_gpt_part_type_t ; +typedef struct grub_gpt_part_guid grub_gpt_part_guid_t ;#define GRUB_GPT_PARTITION_TYPE_EMPTY \ { 0x0, 0x0, 0x0, \
@@ -70,8 +70,8 @@ struct grub_gpt_headerstruct grub_gpt_partentry { -grub_gpt_part_type_t type; -grub_uint8_t guid[16 ]; +grub_gpt_part_guid_t type; +grub_gpt_part_guid_t guid;grub_uint64_t start;grub_uint64_t end;grub_uint64_t attrib;
util/grub-install.c +1 -1
@@ -714,7 +714,7 @@ is_prep_partition (grub_device_t dev)if (grub_disk_read (dev->disk, p->offset, p->index,sizeof (gptdata), &gptdata) ==0 ) { -const grub_gpt_part_type_t template = { +const grub_gpt_part_guid_t template = {grub_cpu_to_le32_compile_time (0x9e1a2d38 ),grub_cpu_to_le16_compile_time (0xc612 ),grub_cpu_to_le16_compile_time (0x4316 ),
Signature · 1 line
2.16.3
PATCH v9 3/5 Add PARTUUID detection support to grub-probe
In reply to Nicholas VinsonAdd PARTUUID detection support grub-probe for MBR and GPT partition schemes.
--- util/grub-probe.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
util/grub-probe.c +46 -0
@@ -28,6 +28,7 @@#include <grub/partition.h> #include <grub/msdos_partition.h> #include <grub/gpt_partition.h> +#include <grub/i386/pc/boot.h> #include <grub/emu/hostdisk.h> #include <grub/emu/getroot.h> #include <grub/term.h>
@@ -62,6 +63,7 @@ enum {PRINT_DRIVE ,PRINT_DEVICE ,PRINT_PARTMAP , +PRINT_PARTUUID ,PRINT_ABSTRACTION ,PRINT_CRYPTODISK_UUID , PRINT_HINT_STR,
@@ -85,6 +87,7 @@ static const char *targets[] = [PRINT_DRIVE] = "drive", [PRINT_DEVICE] = "device", [PRINT_PARTMAP] = "partmap", + [PRINT_PARTUUID] = "partuuid", [PRINT_ABSTRACTION] = "abstraction", [PRINT_CRYPTODISK_UUID] = "cryptodisk_uuid", [PRINT_HINT_STR] = "hints_string",
@@ -181,6 +184,43 @@ probe_partmap (grub_disk_t disk, char delim) } } +static void +probe_partuuid (grub_disk_t disk,char delim) +{ +grub_partition_t p = disk->partition; + +/* +* Nested partitions not supported for now. +* Non-nested partitions must have disk->partition->parent == NULL +*/ +if (p && p->parent ==NULL ) + { + disk->partition = p->parent; +if (strcmp (p->partmap->name,"msdos" ) ==0 ) + { +/* +* The partition GUID for MSDOS is the partition number (starting +* with 1) prepended with the NT disk signature. +*/ +grub_uint32_t nt_disk_sig; + +if (grub_disk_read (disk,0 ,GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC , +sizeof (nt_disk_sig), &nt_disk_sig) ==0 ) +grub_printf ("%08x-%02x" , +grub_le_to_cpu32 (nt_disk_sig),1 + p->number); + } +else if (strcmp (p->partmap->name,"gpt" ) ==0 ) + { +struct grub_gpt_partentry gptdata; + +if (grub_disk_read (disk, p->offset, p->index, +sizeof (gptdata), &gptdata) ==0 ) +print_gpt_guid (gptdata.guid); + } + disk->partition = p; + } +} +static void probe_cryptodisk_uuid (grub_disk_t disk,char delim) {
@@ -635,6 +675,12 @@ probe (const char *path, char **device_names, char delim)/* Check if dev->disk itself is contained in a partmap. */ probe_partmap (dev->disk, delim); + else if (print == PRINT_PARTUUID) + { +probe_partuuid (dev->disk, delim); +putchar (delim); + } + else if (print == PRINT_MSDOS_PARTTYPE) { if (dev->disk->partition
Signature · 1 line
2.16.3
PATCH v9 4/5 Update grub script template files
In reply to Nicholas VinsonUpdate grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how GRUB_DISABLE_LINUX_UUID, GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:
Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID Method
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev name
--- docs/grub.texi | 10 ++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-)
docs/grub.texi +10 -0
@@ -1424,6 +1424,16 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}. +@item GRUB_DISABLE_LINUX_PARTUUID +If @command{grub-mkconfig} cannot identify the root filesystem via its +universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +of the partition containing the filesystem to identify the root filesystem to +the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not +as reliable as using the filesystem UUID, but is more reliable than using the +Linux device names. When enabled, this option requires the Linux kernel version +to be greater than 2.6.37 (3.10 for systems using the MSDOS partition scheme) or +newer. To disable the use of partition UUIDs, set this option to @samp{true}. + @item GRUB_DISABLE_RECOVERY If this option is set to @samp{true}, disable the generation of recovery mode menu entries.
util/grub-mkconfig.in +3 -0
@@ -134,6 +134,7 @@ fi # Device containing our userland. Typically used for root= parameter. GRUB_DEVICE="`${grub_probe} --target=device /`" GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true +GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true # Device containing our /boot partition. Usually the same as GRUB_DEVICE. GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
@@ -188,6 +189,7 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub # override them. export GRUB_DEVICE \ GRUB_DEVICE_UUID \ + GRUB_DEVICE_PARTUUID \ GRUB_DEVICE_BOOT \ GRUB_DEVICE_BOOT_UUID \ GRUB_FS \
@@ -223,6 +225,7 @@ export GRUB_DEFAULT \ GRUB_TERMINAL_OUTPUT \ GRUB_SERIAL_COMMAND \ GRUB_DISABLE_LINUX_UUID \ + GRUB_DISABLE_LINUX_PARTUUID \ GRUB_DISABLE_RECOVERY \ GRUB_VIDEO_BACKEND \ GRUB_GFXMODE \
util/grub.d/10_linux.in +15 -3
@@ -45,10 +45,16 @@ esac # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter # and mounting btrfs requires user space scanning, so force UUID in this case. -if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ +if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ) \ + || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ + && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ + || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ + && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then LINUX_ROOT_DEVICE=${GRUB_DEVICE} +elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ + || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then + LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} else LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} fi
@@ -242,7 +248,13 @@ while [ "x$list" != "x" ] ; do if test -z "${initramfs}" && test -z "${initrd_real}" ; then # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's # no initrd or builtin initramfs, it can't work here. - linux_root_device_thisversion=${GRUB_DEVICE} + if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ + || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then + + linux_root_device_thisversion=${GRUB_DEVICE} + else + linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} + fi fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
Signature · 1 line
2.16.3
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID Method
Quoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev name
What will happen if GRUB_DISABLE_LINUX_PARTUUID and/or GRUB_DISABLE_LINUX_UUID are not set? I think that you can avoid that by setting defaults. You do that for GRUB_DISABLE_LINUX_PARTUUID in next patch but GRUB_DISABLE_LINUX_UUID does not have any default.
Quoted 5 lines
Signed-off-by Nicholas Vinson <[email protected]>--- docs/grub.texi | 10 ++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 18 +++++++++++++++---
Could you update util/grub.d/20_linux_xen.in too?
Quoted 7 lines
3 files changed, 28 insertions(+), 3 deletions(-)docs/grub.texi +0
-0
docs/grub.texi the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is · line 1433
Quoted 10 lines
docs/grub.texi +7
-0@@ -1424,6 +1424,16 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}. +@item GRUB_DISABLE_LINUX_PARTUUID +If @command{grub-mkconfig} cannot identify the root filesystem via its +universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +of the partition containing the filesystem to identify the root filesystem to +the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not +as reliable as using the filesystem UUID, but is more reliable than using the +Linux device names. When enabled, this option requires the Linux kernel version
s/When enabled, /When enabled, GRUB_DISABLE_LINUX_PARTUUID set to false, / or something like that. Otherwise it is unclear.
Daniel
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID MethodQuoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev name
Quoted 5 lines
What will happen if
GRUB_DISABLE_LINUX_PARTUUIDand/orGRUB_DISABLE_LINUX_UUIDare not set? I think that you can avoid that by setting defaults. You do that forGRUB_DISABLE_LINUX_PARTUUIDin next patch butGRUB_DISABLE_LINUX_UUIDdoes not have any default.
If they're not set, then that's the same as them being set to 'False'. I should have worded my table above a bit differently and used Yes/No instead of True/False as that is really what it is trying to convey. I.E. If there is no initramfs detected and GRUB_DISABLE_LINUX_PARTUUID is not set and GRUB_DISABLE_LINUX_UUID is not set, set the kernel root variable to "root=PARTUUID=...".
In the scripts, the only value explicitly checked for is 'true'. Anything else (including unset) is considered false.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Nicholas Vinson <[email protected]>--- docs/grub.texi | 10 ++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 18 +++++++++++++++---Could you update util/grub.d/20_linux_xen.in too?
Let me see what I can do. I have never worked with xen before, so I do not know much about it.
Quoted 11 lines
Quoted 11 lines
3 files changed, 28 insertions(+), 3 deletions(-)docs/grub.texi +0
-0@@ -1424,6 +1424,16 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}.
Quoted 10 lines
docs/grub.texi the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is · line 1433
Quoted 7 lines
docs/grub.texi +7
-0+@item GRUB_DISABLE_LINUX_PARTUUID +If @command{grub-mkconfig} cannot identify the root filesystem via its +universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +of the partition containing the filesystem to identify the root filesystem to +the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not +as reliable as using the filesystem UUID, but is more reliable than using the +Linux device names. When enabled, this option requires the Linux kernel versions/When enabled, /When enabled,
GRUB_DISABLE_LINUX_PARTUUIDset to false, / or something like that. Otherwise it is unclear.
I'll clean up the wording in the next release.
Thanks,
Nicholas Vinson
Quoted 3 lines
Daniel
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 25 lines · Nick Vinson
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID MethodQuoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev nameQuoted 5 lines
What will happen if
GRUB_DISABLE_LINUX_PARTUUIDand/orGRUB_DISABLE_LINUX_UUIDare not set? I think that you can avoid that by setting defaults. You do that forGRUB_DISABLE_LINUX_PARTUUIDin next patch butGRUB_DISABLE_LINUX_UUIDdoes not have any default.
Quoted 3 lines
If they're not set, then that's the same as them being set to 'False'. I should have worded my table above a bit differently and used Yes/No instead of True/False as that is really what it is trying to convey.
IMO it will be more confusing. I think that I would use lowercase false/true as it is used in the script and below the table I would add a note that <VARIABLE_UNSET> == false or something like that.
Quoted 6 lines
I.E. If there is no initramfs detected and
GRUB_DISABLE_LINUX_PARTUUIDis not set andGRUB_DISABLE_LINUX_UUIDis not set, set the kernel root variable to "root=PARTUUID=...".In the scripts, the only value explicitly checked for is 'true'. Anything else (including unset) is considered false.
OK, perfect!
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Signed-off-by Nicholas Vinson <[email protected]>--- docs/grub.texi | 10 ++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 18 +++++++++++++++---Could you update util/grub.d/20_linux_xen.in too?
Let me see what I can do. I have never worked with xen before, so I do not know much about it.
This should be easy. However, if you are not sure please drop me a line.
Quoted 21 lines
Quoted 10 lines
Quoted 10 lines
3 files changed, 28 insertions(+), 3 deletions(-)docs/grub.texi +0
-0@@ -1424,6 +1424,16 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}.Quoted 10 lines
docs/grub.texi the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is · line 1433
Quoted 7 lines
docs/grub.texi +7
-0+@item GRUB_DISABLE_LINUX_PARTUUID +If @command{grub-mkconfig} cannot identify the root filesystem via its +universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +of the partition containing the filesystem to identify the root filesystem to +the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not +as reliable as using the filesystem UUID, but is more reliable than using the +Linux device names. When enabled, this option requires the Linux kernel versions/When enabled, /When enabled,
GRUB_DISABLE_LINUX_PARTUUIDset to false, / or something like that. Otherwise it is unclear.
Quoted 1 line
I'll clean up the wording in the next release.
Thanks a lot!
By the way, should not we merge patches 4 and 5 into one patch?
Daniel
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 26 lines · Daniel Kiper
Quoted 25 lines · Nick Vinson
Quoted 23 lines · Daniel Kiper
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID MethodQuoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev nameWhat will happen if
GRUB_DISABLE_LINUX_PARTUUIDand/orGRUB_DISABLE_LINUX_UUIDare not set? I think that you can avoid that by setting defaults. You do that forGRUB_DISABLE_LINUX_PARTUUIDin next patch butGRUB_DISABLE_LINUX_UUIDdoes not have any default.
Quoted 7 lines
Quoted 3 lines
If they're not set, then that's the same as them being set to 'False'. I should have worded my table above a bit differently and used Yes/No instead of True/False as that is really what it is trying to convey.
IMO it will be more confusing. I think that I would use lowercase false/true as it is used in the script and below the table I would add a note that <
VARIABLE_UNSET> == false or something like that.
Ack. I will update the commit comment.
Quoted 44 lines
Quoted 7 lines
I.E. If there is no initramfs detected and
GRUB_DISABLE_LINUX_PARTUUIDis not set andGRUB_DISABLE_LINUX_UUIDis not set, set the kernel root variable to "root=PARTUUID=...".In the scripts, the only value explicitly checked for is 'true'. Anything else (including unset) is considered false.
OK, perfect!
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Signed-off-by Nicholas Vinson <[email protected]>--- docs/grub.texi | 10 ++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 18 +++++++++++++++---Could you update util/grub.d/20_linux_xen.in too?
Let me see what I can do. I have never worked with xen before, so I do not know much about it.
This should be easy. However, if you are not sure please drop me a line.
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
3 files changed, 28 insertions(+), 3 deletions(-)docs/grub.texi +0
-0docs/grub.texi the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is · line 1433
Quoted 10 lines
docs/grub.texi +7
-0@@ -1424,6 +1424,16 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}. +@item GRUB_DISABLE_LINUX_PARTUUID +If @command{grub-mkconfig} cannot identify the root filesystem via its +universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +of the partition containing the filesystem to identify the root filesystem to +the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not +as reliable as using the filesystem UUID, but is more reliable than using the +Linux device names. When enabled, this option requires the Linux kernel versions/When enabled, /When enabled,
GRUB_DISABLE_LINUX_PARTUUIDset to false, / or something like that. Otherwise it is unclear.
Quoted 5 lines
Quoted 1 line
I'll clean up the wording in the next release.
Thanks a lot!
By the way, should not we merge patches 4 and 5 into one patch?
We should.
I split it so that if #5 proved controversial for some reason and received a lot of resistance, it could be dropped and the remainder of the patchset could be merged.
There does not seem to be any issue with setting GRUB_DISABLE_LINUX_PARTUUID to a default value, so there is no reason to keep it separate.
Thanks,
Nicholas Vinson
Quoted 3 lines
Daniel
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 31 lines · Nick Vinson
Quoted 30 lines · Daniel Kiper
Quoted 28 lines · Nick Vinson
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID MethodQuoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev nameQuoted 5 lines
What will happen if
GRUB_DISABLE_LINUX_PARTUUIDand/orGRUB_DISABLE_LINUX_UUIDare not set? I think that you can avoid that by setting defaults. You do that forGRUB_DISABLE_LINUX_PARTUUIDin next patch butGRUB_DISABLE_LINUX_UUIDdoes not have any default.If they're not set, then that's the same as them being set to 'False'. I should have worded my table above a bit differently and used Yes/No instead of True/False as that is really what it is trying to convey.
Quoted 5 lines
Quoted 3 lines
IMO it will be more confusing. I think that I would use lowercase false/true as it is used in the script and below the table I would add a note that <
VARIABLE_UNSET> == false or something like that.Ack. I will update the commit comment.
Thanks. May I ask you to put similar table into docs/grub.texi?
Daniel
Re: [GRUB PARTUUID PATCH V9 4/5] Update grub script template files
Quoted 32 lines · Daniel Kiper
Quoted 31 lines · Nick Vinson
Quoted 30 lines · Daniel Kiper
Quoted 28 lines · Nick Vinson
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · Nicholas Vinson
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documentation. The following table shows how
GRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection interact:Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root detected Set Set ID MethodQuoted 8 lines
False False False part UUID False False True part UUID False True False dev name False True True dev name True False False fs UUID True False True part UUID True True False fs UUID True True True dev nameQuoted 5 lines
What will happen if
GRUB_DISABLE_LINUX_PARTUUIDand/orGRUB_DISABLE_LINUX_UUIDare not set? I think that you can avoid that by setting defaults. You do that forGRUB_DISABLE_LINUX_PARTUUIDin next patch butGRUB_DISABLE_LINUX_UUIDdoes not have any default.If they're not set, then that's the same as them being set to 'False'. I should have worded my table above a bit differently and used Yes/No instead of True/False as that is really what it is trying to convey.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
IMO it will be more confusing. I think that I would use lowercase false/true as it is used in the script and below the table I would add a note that <
VARIABLE_UNSET> == false or something like that.Ack. I will update the commit comment.
Thanks. May I ask you to put similar table into docs/grub.texi?
Done.
Thanks,
Nicholas Vinson
Quoted 3 lines
Daniel
PATCH v9 5/5 Default to disabling partition UUID support
In reply to Nicholas VinsonThe addition of GRUB_DISABLE_LINUX_PARTUUID and having it default to 'false' is a breaking change for systems that use GPT partition schemes and Linux kernel version 2.6.37 or older and a breaking change for systems that use MBR partition schemes and Linux kernel version 3.10 or older.
This patch updates grub.d/10_linux so that GRUB_DISABLE_LINUX_PARTUUID is set to 'true' if the system has not specified otherwise.
--- docs/grub.texi | 5 +++-- util/grub.d/10_linux.in | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-)
docs/grub.texi +3 -2
@@ -1426,13 +1426,14 @@ disable the use of UUIDs, set this option to @samp{true}. @item GRUB_DISABLE_LINUX_PARTUUID If @command{grub-mkconfig} cannot identify the root filesystem via its -universally-unique indentifier (UUID), @command{grub-mkconfig} will use the UUID +universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID of the partition containing the filesystem to identify the root filesystem to the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not as reliable as using the filesystem UUID, but is more reliable than using the Linux device names. When enabled, this option requires the Linux kernel version to be greater than 2.6.37 (3.10 for systems using the MSDOS partition scheme) or -newer. To disable the use of partition UUIDs, set this option to @samp{true}. +newer. This option defaults to @samp{true}. To enable the use of partition +UUIDs, set this option to @samp{false}. @item GRUB_DISABLE_RECOVERY If this option is set to @samp{true}, disable the generation of recovery
util/grub.d/10_linux.in +4 -0
@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +# Default to disabling partition uuid support to maintian compatibility with +# older kernels. +GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} + # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter # and mounting btrfs requires user space scanning, so force UUID in this case. if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ) \
Signature · 1 line
2.16.3
Quoted 11 lines · Nicholas Vinson
Changes from Patch v8:
- RenamedGRUB_ENABLE_LINUX_PARTUUIDtoGRUB_DISABLE_LINUX_PARTUUID
- Updated the 10_linux logic soGRUB_ENABLE_LINUX_PARTUUIDandGRUB_ENABLE_LINUX_UUIDwould behave more independently.
- Documented interactions ofGRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection in commit message.
- Added optional patch that setsGRUB_DISABLE_LINUX_PARTUUIDto true by default.
- Fixed merge conflicts between this patchset and upstream's master branch.
Could you provide summary for current version not only for previous ones?
Anyway, I think that most of the patches are now in good shape. I am looking forward for next version.
Thank you for doing the work.
Daniel
Quoted 13 lines · Daniel Kiper
Quoted 11 lines · Nicholas Vinson
Changes from Patch v8:
- RenamedGRUB_ENABLE_LINUX_PARTUUIDtoGRUB_DISABLE_LINUX_PARTUUID
- Updated the 10_linux logic soGRUB_ENABLE_LINUX_PARTUUIDandGRUB_ENABLE_LINUX_UUIDwould behave more independently.
- Documented interactions ofGRUB_DISABLE_LINUX_UUID,GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection in commit message.
- Added optional patch that setsGRUB_DISABLE_LINUX_PARTUUIDto true by default.
- Fixed merge conflicts between this patchset and upstream's master branch.
Quoted 1 line
Could you provide summary for current version not only for previous ones?
I can add a summary section before the change log. I'll make sure to do so with the next patchset.
Thanks,
Nicholas Vinson
Quoted 8 lines
Anyway, I think that most of the patches are now in good shape. I am looking forward for next version.
Thank you for doing the work.
Daniel