Skip to contentSkip to conversation

Add GRUB_DISABLE_UUID.

PATCH Superseded Javier Martinez Canillas 4 participants 8 messages Sep 17, 2019 – Sep 20, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add GRUB_DISABLE_UUID.

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

---

 docs/grub.texi            |  7 +++++++
 util/grub-mkconfig.in     | 22 +++++++++++++++++++---
 util/grub-mkconfig_lib.in |  4 ++--
 3 files changed, 28 insertions(+), 5 deletions(-)
docs/grub.texi +7 -0
index 3d50b16ba4c..132e56a7b44 100644
@@ -1441,6 +1441,13 @@ enable the use of partition UUIDs, set this option to @samp{false}.
 If this option is set to @samp{true}, disable the generation of recovery
 mode menu entries.
 
+@item GRUB_DISABLE_UUID
+Normally, @command{grub-mkconfig} will generate menu entries that use
+universally-unique identifiers (UUIDs) to identify various filesystems to
+search for files.  This is usually more reliable, but in some cases it may
+not be appropriate.  To disable this use of UUIDs, set this option to
+@samp{true}.
+
 @item GRUB_VIDEO_BACKEND
 If graphical video support is required, either because the @samp{gfxterm}
 graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
util/grub-mkconfig.in +19 -3
index 523d4e029bb..9ecbcfb5b43 100644
@@ -133,12 +133,12 @@ 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
+GRUB_DEVICE_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+GRUB_DEVICE_PARTUUID_GENERATED="`${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`"
-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+GRUB_DEVICE_BOOT_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
 
 # Filesystem for the device containing our userland.  Used for stuff like
 # choosing Hurd filesystem module.
@@ -158,6 +158,21 @@ if test -f ${sysconfdir}/default/grub ; then
   . ${sysconfdir}/default/grub
 fi
 
+if [ "x$GRUB_DISABLE_UUID" != "xtrue" ]; then
+  if [ -z "$GRUB_DEVICE_UUID" ]; then
+    GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_BOOT_UUID" ]; then
+    GRUB_DEVICE_BOOT_UUID="$GRUB_DEVICE_BOOT_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_UUID" ]; then
+    GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_PART_UUID" ]; then
+    GRUB_DEVICE_PART_UUID="$GRUB_DEVICE_PART_UUID_GENERATED"
+  fi
+fi
+
 # XXX: should this be deprecated at some point?
 if [ "x${GRUB_TERMINAL}" != "x" ] ; then
   GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}"
@@ -227,6 +242,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
   GRUB_DISABLE_RECOVERY \
+  GRUB_DISABLE_UUID \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \
   GRUB_BACKGROUND \
util/grub-mkconfig_lib.in +2 -2
index 0f801cab3e4..1001a12232b 100644
@@ -156,7 +156,7 @@ prepare_grub_to_access_device ()
   if [ "x$fs_hint" != x ]; then
     echo "set root='$fs_hint'"
   fi
-  if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
     hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
     echo "if [ x\$feature_platform_search_hint = xy ]; then"
     echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
@@ -173,7 +173,7 @@ grub_get_device_id ()
   IFS='
 '
   device="$1"
-  if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
     echo "$fs_uuid";
   else
     echo $device |sed 's, ,_,g'
Signature · 1 line
2.21.0
#1 lore raw

Adding Nicholas...

Quoted 8 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

Daniel

Quoted 100 lines

---

 docs/grub.texi            |  7 +++++++
 util/grub-mkconfig.in     | 22 +++++++++++++++++++---
 util/grub-mkconfig_lib.in |  4 ++--
 3 files changed, 28 insertions(+), 5 deletions(-)
docs/grub.texi +7 -0
index 3d50b16ba4c..132e56a7b44 100644
@@ -1441,6 +1441,13 @@ enable the use of partition UUIDs, set this option to @samp{false}.
 If this option is set to @samp{true}, disable the generation of recovery
 mode menu entries.
 
+@item GRUB_DISABLE_UUID
+Normally, @command{grub-mkconfig} will generate menu entries that use
+universally-unique identifiers (UUIDs) to identify various filesystems to
+search for files.  This is usually more reliable, but in some cases it may
+not be appropriate.  To disable this use of UUIDs, set this option to
+@samp{true}.
+
 @item GRUB_VIDEO_BACKEND
 If graphical video support is required, either because the @samp{gfxterm}
 graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
util/grub-mkconfig.in +19 -3
index 523d4e029bb..9ecbcfb5b43 100644
@@ -133,12 +133,12 @@ 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
+GRUB_DEVICE_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+GRUB_DEVICE_PARTUUID_GENERATED="`${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`"
-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+GRUB_DEVICE_BOOT_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
 
 # Filesystem for the device containing our userland.  Used for stuff like
 # choosing Hurd filesystem module.
@@ -158,6 +158,21 @@ if test -f ${sysconfdir}/default/grub ; then
   . ${sysconfdir}/default/grub
 fi
 
+if [ "x$GRUB_DISABLE_UUID" != "xtrue" ]; then
+  if [ -z "$GRUB_DEVICE_UUID" ]; then
+    GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_BOOT_UUID" ]; then
+    GRUB_DEVICE_BOOT_UUID="$GRUB_DEVICE_BOOT_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_UUID" ]; then
+    GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
+  fi
+  if [ -z "$GRUB_DEVICE_PART_UUID" ]; then
+    GRUB_DEVICE_PART_UUID="$GRUB_DEVICE_PART_UUID_GENERATED"
+  fi
+fi
+
 # XXX: should this be deprecated at some point?
 if [ "x${GRUB_TERMINAL}" != "x" ] ; then
   GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}"
@@ -227,6 +242,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
   GRUB_DISABLE_RECOVERY \
+  GRUB_DISABLE_UUID \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \
   GRUB_BACKGROUND \
util/grub-mkconfig_lib.in +2 -3
index 0f801cab3e4..1001a12232b 100644
@@ -156,7 +156,7 @@ prepare_grub_to_access_device ()
   if [ "x$fs_hint" != x ]; then
     echo "set root='$fs_hint'"
   fi
-  if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
     hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
     echo "if [ x\$feature_platform_search_hint = xy ]; then"
     echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
@@ -173,7 +173,7 @@ grub_get_device_id ()
   IFS='
 '
   device="$1"
-  if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
     echo "$fs_uuid";
   else
     echo $device |sed 's, ,_,g'
--

2.21.0

#2 lore raw

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

But Peter's patch is about setting the root param to a device name instead of a UUID.

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option for the first part, so we only need to add an option for the second part.

Since this is not about Linux not using a UUID but grub not using it, I think that we should add another option as this patch does. So GRUB_DISABLE_LINUX_UUID would disable using a UUID for the root param and GRUB_DISABLE_UUID would be about disabling using a UUID to set the $root (and $boot) variables in grub.

GRUB_DISABLE_UUID=true probably should imply GRUB_DISABLE_LINUX_UUID=true also I think. But I guess is OK to have separate options and the user could set both if want to disable using the UUID for Linux and grub.

Another option is to extend GRUB_DISABLE_LINUX_UUID semantics and don't add search commands if this is set to true, but I'm not sure if that's correct.

Quoted 2 lines

Daniel

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
#3 lore raw
Quoted 24 lines · Javier Martinez Canillas

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

Quoted 7 lines

But Peter's patch is about setting the root param to a device name instead of a UUID.

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option

There are two variables: GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID.

Quoted 1 line

for the first part, so we only need to add an option for the second part.

OK.

Quoted 6 lines

Since this is not about Linux not using a UUID but grub not using it, I think that we should add another option as this patch does. So GRUB_DISABLE_LINUX_UUID would disable using a UUID for the root param and GRUB_DISABLE_UUID would be about disabling using a UUID to set the $root (and $boot) variables in grub.

GRUB_DISABLE_UUID=true probably should imply GRUB_DISABLE_LINUX_UUID=true also

OK but only if GRUB_DISABLE_LINUX_UUID is not set explicitly. And what about GRUB_DISABLE_LINUX_PARTUUID?

Quoted 5 lines

I think. But I guess is OK to have separate options and the user could set both if want to disable using the UUID for Linux and grub.

Another option is to extend GRUB_DISABLE_LINUX_UUID semantics and don't add search commands if this is set to true, but I'm not sure if that's correct.

Hmmm... Probably I prefer former approach...

Daniel

#4 lore raw
Quoted 28 lines · Daniel Kiper
Quoted 27 lines · Javier Martinez Canillas

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

But Peter's patch is about setting the root param to a device name instead of a UUID.

Quoted 7 lines
Quoted 4 lines

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option

There are two variables: GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID.

Yes. I didn't mention the GRUB_DISABLE_LINUX_PARTUUID variable because the search command only has support to search using the UUID and not the PARTUUID.

Quoted 9 lines
Quoted 1 line

for the first part, so we only need to add an option for the second part.

OK.

Quoted 5 lines

Since this is not about Linux not using a UUID but grub not using it, I think that we should add another option as this patch does. So GRUB_DISABLE_LINUX_UUID would disable using a UUID for the root param and GRUB_DISABLE_UUID would be about disabling using a UUID to set the $root (and $boot) variables in grub.

Quoted 5 lines
Quoted 1 line

GRUB_DISABLE_UUID=true probably should imply GRUB_DISABLE_LINUX_UUID=true also

OK but only if GRUB_DISABLE_LINUX_UUID is not set explicitly. And what about GRUB_DISABLE_LINUX_PARTUUID?

That's a good question. Would disabling using UUID mean "always use device name for both GRUB and Linux" or "don't use the filesystem UUID for both GRUB and Linux but allow Linux to use the partition UUID" ?

Peter's patch does the former. And yes, agreed that setting GRUB_DISABLE_LINUX* to true should only be done if they weren't explicitly set.

Quoted 7 lines
Quoted 5 lines

I think. But I guess is OK to have separate options and the user could set both if want to disable using the UUID for Linux and grub.

Another option is to extend GRUB_DISABLE_LINUX_UUID semantics and don't add search commands if this is set to true, but I'm not sure if that's correct.

Hmmm... Probably I prefer former approach...

Agreed. I also prefer to introduce a new variable for this.

Quoted 3 lines

Daniel

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
#5 lore raw
Quoted 32 lines · Javier Martinez Canillas
Quoted 31 lines · Daniel Kiper
Quoted 30 lines · Javier Martinez Canillas

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

But Peter's patch is about setting the root param to a device name instead of a UUID.

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option

There are two variables: GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID.

Yes. I didn't mention the GRUB_DISABLE_LINUX_PARTUUID variable because the search command only has support to search using the UUID and not the PARTUUID.

It has support to search using the PARTUUID in case of a GPT, cf. commit f2b9083f859c7dbf44a7a8e96ee0cf202f9a4187

As an aside, it would be very useful to extend this support to dos partition tables. I believe that all partition tools create a disk identifier when creating a dos partition table (at least fdisk, cfdisk and parted do) so if I am not mislead-ed all dos partitions should have a partuuid in the form DisklabelPartitionnumber.

This would allow e.g. to find the root Linux partitions from a rescue media, even if the kernel has no associated initrd.

Maybe Jacob could propose a patch for that, as he did for gpt?

Quoted 30 lines
Quoted 9 lines
Quoted 1 line

for the first part, so we only need to add an option for the second part.

OK.

Quoted 5 lines

Since this is not about Linux not using a UUID but grub not using it, I think that we should add another option as this patch does. So GRUB_DISABLE_LINUX_UUID would disable using a UUID for the root param and GRUB_DISABLE_UUID would be about disabling using a UUID to set the $root (and $boot) variables in grub.

Quoted 5 lines
Quoted 1 line

GRUB_DISABLE_UUID=true probably should imply GRUB_DISABLE_LINUX_UUID=true also

OK but only if GRUB_DISABLE_LINUX_UUID is not set explicitly. And what about GRUB_DISABLE_LINUX_PARTUUID?

That's a good question. Would disabling using UUID mean "always use device name for both GRUB and Linux" or "don't use the filesystem UUID for both GRUB and Linux but allow Linux to use the partition UUID" ?

Peter's patch does the former. And yes, agreed that setting GRUB_DISABLE_LINUX* to true should only be done if they weren't explicitly set.

Quoted 7 lines
Quoted 5 lines

I think. But I guess is OK to have separate options and the user could set both if want to disable using the UUID for Linux and grub.

Another option is to extend GRUB_DISABLE_LINUX_UUID semantics and don't add search commands if this is set to true, but I'm not sure if that's correct.

Hmmm... Probably I prefer former approach...

Quoted 7 lines

Agreed. I also prefer to introduce a new variable for this.

Quoted 3 lines

Daniel

Best regards,

Best regards,

Didier

#6 lore raw
Quoted 51 lines · Didier Spaier
Quoted 33 lines · Javier Martinez Canillas
Quoted 32 lines · Daniel Kiper
Quoted 31 lines · Javier Martinez Canillas

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

But Peter's patch is about setting the root param to a device name instead of a UUID.

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option

There are two variables: GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID.

Yes. I didn't mention the GRUB_DISABLE_LINUX_PARTUUID variable because the search command only has support to search using the UUID and not the PARTUUID.

It has support to search using the PARTUUID in case of a GPT, cf. commit f2b9083f859c7dbf44a7a8e96ee0cf202f9a4187

As an aside, it would be very useful to extend this support to dos partition tables. I believe that all partition tools create a disk identifier when creating a dos partition table (at least fdisk, cfdisk and parted do) so if I am not mislead-ed all dos partitions should have a partuuid in the form DisklabelPartitionnumber.

Quoted 4 lines

This would allow e.g. to find the root Linux partitions from a rescue media, even if the kernel has no associated initrd.

Maybe Jacob could propose a patch for that, as he did for gpt?

I have a patch for that. I just have not tested it yet.

Thanks,
Nicholas Vinson

Quoted 46 lines
Quoted 30 lines
Quoted 10 lines
Quoted 2 lines

for the first part, so we only need to add an option for the second part.

OK.

Quoted 5 lines

Since this is not about Linux not using a UUID but grub not using it, I think that we should add another option as this patch does. So GRUB_DISABLE_LINUX_UUID would disable using a UUID for the root param and GRUB_DISABLE_UUID would be about disabling using a UUID to set the $root (and $boot) variables in grub.

Quoted 5 lines
Quoted 1 line

GRUB_DISABLE_UUID=true probably should imply GRUB_DISABLE_LINUX_UUID=true also

OK but only if GRUB_DISABLE_LINUX_UUID is not set explicitly. And what about GRUB_DISABLE_LINUX_PARTUUID?

That's a good question. Would disabling using UUID mean "always use device name for both GRUB and Linux" or "don't use the filesystem UUID for both GRUB and Linux but allow Linux to use the partition UUID" ?

Peter's patch does the former. And yes, agreed that setting GRUB_DISABLE_LINUX* to true should only be done if they weren't explicitly set.

Quoted 7 lines
Quoted 5 lines

I think. But I guess is OK to have separate options and the user could set both if want to disable using the UUID for Linux and grub.

Another option is to extend GRUB_DISABLE_LINUX_UUID semantics and don't add search commands if this is set to true, but I'm not sure if that's correct.

Hmmm... Probably I prefer former approach...

Quoted 7 lines

Agreed. I also prefer to introduce a new variable for this.

Quoted 3 lines

Daniel

Best regards,

Best regards,

Didier

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#7 lore raw
In reply to Didier Spaier
Quoted 35 lines · Didier Spaier
Quoted 34 lines · Javier Martinez Canillas
Quoted 33 lines · Daniel Kiper
Quoted 31 lines · Javier Martinez Canillas

Hello Daniel,

Quoted 9 lines · Daniel Kiper

Adding Nicholas...

Quoted 6 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name as it understands it.

Quoted 7 lines
Quoted 2 lines

We have this functionality in GRUB upstream. Please take a look at commit 51be3372e (templates: Update grub script template files). Could you pick it up in RH/Fedora?

That commit does something different if I'm reading it correctly. It's about allowing to set the root kernel command line parameter to a PARTUUID instead of a UUID or a device name, by using the grub-probe --target=partuuid option.

But Peter's patch is about setting the root param to a device name instead of a UUID.

And also about not adding search commands in the grub.cfg to set the $root and $boot grub environment variables by searching using a UUID.

Now digging more I found that there's already a GRUB_DISABLE_LINUX_UUID option

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

There are two variables: GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID.

Yes. I didn't mention the GRUB_DISABLE_LINUX_PARTUUID variable because the search command only has support to search using the UUID and not the PARTUUID.

It has support to search using the PARTUUID in case of a GPT, cf. commit f2b9083f859c7dbf44a7a8e96ee0cf202f9a4187

I see. I missed that commit since is newer than grub-2.04 which is what we are using as the base for our package now.

But that commit adds PARTUUID support to the probe command, not the search command. We can later add a GRUB_DISABLE_PARTUUID variable to disable the search using a PARTUUID, once the search command gets a --part-uuid option and a command using that option is added to grub.cfg to search the devices.

Quoted 9 lines

As an aside, it would be very useful to extend this support to dos partition tables. I believe that all partition tools create a disk identifier when creating a dos partition table (at least fdisk, cfdisk and parted do) so if I am not mislead-ed all dos partitions should have a partuuid in the form DisklabelPartitionnumber.

This would allow e.g. to find the root Linux partitions from a rescue media, even if the kernel has no associated initrd.

Agreed.

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat