get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg [Solved]

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg [Solved]

Postby joe3 » Sun Aug 28, 2011 2:40

Every single partition I have on every single hard drive (fixed or removable) has a unique "HUMAN READABLE" label.
AND I absolutely detest the "human UNreadable" UUID method.

It almost doesn't matter because Sabayon's grub is installed to it's own / partition. And only called via chainloader entries if I goof when I manually edit my own boot partition's menu.lst. But when I look at the automatically generated /boot/grub/grub.cfg file I'd like to see the existing LABEL references that I can actually recognize instead of the {expletive deleted} UUID stuff. Is this possible???
Last edited by joe3 on Thu Sep 01, 2011 9:42, edited 1 time in total.
joe3
Advanced Hen
 
Posts: 200
Joined: Sun May 06, 2007 21:28

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby Fitzcarraldo » Sun Aug 28, 2011 12:42

Make sure you have the following line in /etc/default/grub (and make sure it is not commented out):

Code: Select all
GRUB_DISABLE_LINUX_UUID=true

and then regenerate grub.cfg by entering the following command as root user in a Konsole/Terminal window:

Code: Select all
grub-mkconfig -o /boot/grub/grub.cfg

If you have /boot in a separate partition to / (root), make sure you have mounted it first.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby joe3 » Mon Aug 29, 2011 2:48

It would appear that on Aug 28, Fitzcarraldo did say:

> Make sure you have the following line in /etc/default/grub (and make sure it
> is not commented out):
>
> Code: Select all
> GRUB_DISABLE_LINUX_UUID=true

Yeah, that's what I thought that was supposed to mean. But the /etc/default/grub file already has that line (in two places) and neither of them was commented out... While I was looking at it I figured out where to put "NOX" {I'm a startx user} And was pleased to see it only affected the main Sabayon boot entry when I ran:

su -c "grub-mkconfig -o /boot/grub/grub.cfg"

But unfortunately the new grub.cfg still uses UUID...

Please see:

My /etc/default/grub

http://www.pastebin.com/mwTc4gYC

My /boot/grub/grub.cfg

http://pastebin.com/9MtkjrqP

& for chucks and giggles My OWN boot partitions /boot/grub/menu.lst

http://pastebin.com/veSSYQVm

Any suggestions?
joe3
Advanced Hen
 
Posts: 200
Joined: Sun May 06, 2007 21:28

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby Fitzcarraldo » Tue Aug 30, 2011 6:25

Hmm... According to the GRUB 2 manual:

‘GRUB_DISABLE_LINUX_UUID’
Normally, grub-mkconfig will generate menu entries that use universally-unique identifiers (UUIDs) to identify the root filesystem to the Linux kernel, using a ‘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 ‘true’.

1. It appears from the manual that GRUB_DISABLE_LINUX_UUID only covers the "root=" part of the linux boot line.

2. Your running of grub-mkconfig didn't change "root=UUID=" to "root=".

So it seems using GRUB_DISABLE_LINUX_UUID is not the solution to your need, although that still does not explain point 2, as the grub.cfg you posted should at least have "root=/dev/sd<d><p>" instead of "root=UUID=". Is grub-mkconfig actually touching your /boot/grub/grub.cfg, I wonder? I wonder what you would see if you did the following:

Code: Select all
$ su
Password:
# mv /boot/grub/grub.cfg /boot/grub/grub.cfg.bak
# grub-mkconfig -o /boot/grub/grub.cfg
# ls /boot/grub/grub.cfg

Anyway, as it seems GRUB_DISABLE_LINUX_UUID is not going to do what you want, I think to achieve your goal you would need to rebuild your kernel using genkernel without the --disklabel switch (see HOWTO: Upgrade kernel using genkernel). Caveat lector: the usual disclaimers apply.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby joe3 » Wed Aug 31, 2011 22:42

Fitzcarraldo wrote:1. It appears from the manual that GRUB_DISABLE_LINUX_UUID only covers the "root=" part of the linux boot line.

2. Your running of grub-mkconfig didn't change "root=UUID=" to "root=".

So it seems using GRUB_DISABLE_LINUX_UUID is not the solution to your need, although that still does not explain point 2, as the grub.cfg you posted should at least have "root=/dev/sd<d><p>" instead of "root=UUID=". Is grub-mkconfig actually touching your /boot/grub/grub.cfg, I wonder?


I can confirm that it is rewriting the grub.cfg because it was only after I included "NOX" on line 14 0f the /etc/default/grub that the "NOX" kernel option appeared in line 87 of the /boot/grub/grub.cfg....

Fitzcarraldo wrote:Anyway, as it seems GRUB_DISABLE_LINUX_UUID is not going to do what you want, I think to achieve your goal you would need to rebuild your kernel using genkernel without the --disklabel switch (see HOWTO: Upgrade kernel using genkernel). Caveat lector: the usual disclaimers apply.


BUT if I did that (even if I didn't screw up the new kernel some how) wouldn't compiling it without the --disklabel switch also disable the kernel's ability to respond to the use of LABEL=label IE: the "root=LABEL=Esaba_lap-6" in my boot partition's menu.lst & probably also those like "LABEL=Esaba_lap6" & "LABEL=SWP_lap12" in my fstab???

I might strongly dislike UUID, (preferring to use the LABEL form of persistent device identification) But I do NOT want to revert back to the old /dev/sd${x}${y} method...

I've been looking around a bit and I suspect that part of the problem might be in the file /etc/default/sabayon-grub { see: http://pastebin.com/Tn0sGNDm } Which seems to HARDCODE some UUID values into GRUB_CMDLINE_LINUX. I suspect these values might be overriding the GRUB_DISABLE_LINUX_UUID=true option in /etc/default/grub. Though Even if so, it wouldn't explain why the menuentry for the other Linux distros are still using root=UUID=uuid in their kernel options...

I also found some clues in:

http://techpatterns.com/forums/about1575.html
http://sourceforge.net/apps/mediawiki/b ... ems:search
http://ubuntuforums.org/showthread.php?t=1530532&page=2
http://www.linuxquestions.org/questions ... ow-819474/

It seems that with some other Linux the GRUB_DISABLE_LINUX_UUID=true option actually does something. I found a listing of a {I think debian based} patch for /etc/grub.d/10_linux that looked promising. So I backed up my etc/grub.d and gave it a whirl using grub-mkconfig -o /boot/grub/grub.cfg.out. But I couldn't find any difference between "boot/grub/grub.cfg.out" & "boot/grub/grub.cfg" {sigh}

On the other hand when I commented out the lines in /etc/default/grub that called /etc/default/sabayon-grub and repeated the grub-mkconfig -o /boot/grub/grub.cfg.out , the resulting file actually used my LABELs for the Sabayon menuentry kernel options.(Though it also lost all references to "resume=", "real_resume=", & "splash=" also all sabayon menuenry items had "nox" just before they said "vga=normal" instead of saying "vga=781", and the main menuentry also had "ro ro" instead of "ro". Do I don't think bypassing this file is the answer. But maybe if I edited it instead...

OK I edited /etc/default/sabayon-grub to replace the hardcoded UUID stuff with hard coded LABEL versions and again ran "grub-mkconfig -o /boot/grub/grub.cfg.out" I finally got reasonable LABEL based menuenty stansas for Sabayon...

However the file /etc/default/sabayon-grub carries one of those do not edit warnings, so It's probable that some future update will just put the uuid stuff back. So if you know what I can edit to prevent future updates from trashing my changes, please do tell.

Now about the other half of the problem:

There were a couple of clues about getting the search line(s) to use --label instead of --fs-uuid etc... But they all wanted an edit of /usr/lib/grub/grub-mkconfig_lib, and there doesn't seem to be a /usr/lib/grub anything on Sabayon. Could you tell me where they hid the grub-mkconfig configuration stuff that other distros put in /usr/lib/grub/grub-mkconfig_lib????

--
joe3
joe3
Advanced Hen
 
Posts: 200
Joined: Sun May 06, 2007 21:28

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby Fitzcarraldo » Wed Aug 31, 2011 23:53

joe3 wrote:I might strongly dislike UUID, (preferring to use the LABEL form of persistent device identification) But I do NOT want to revert back to the old /dev/sd${x}${y} method...

Well, if you don't want to use device names, then, no, you shouldn't omit the --disklabel switch. However, devices are much easier to remember than UUIDs, and don't change if you resize the partition.

Anyway, have you seen the following Web pages, which show how to use labels instead of UUIDs?

archlinux Wiki - GRUB 2 - Using labels

Grub2 "search" line - what is it for?
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby joe3 » Thu Sep 01, 2011 5:01

Fitzcarraldo wrote:
joe3 wrote:I might strongly dislike UUID, (preferring to use the LABEL form of persistent device identification) But I do NOT want to revert back to the old /dev/sd${x}${y} method...

Well, if you don't want to use device names, then, no, you shouldn't omit the --disklabel switch. However, devices are much easier to remember than UUIDs, and don't change if you resize the partition.

True. And that was why I stuck with it for years of dealing with device name for the same partition on my old multi drive desktop being different depending on which of several linux distros I was running. At one point the same partition was indicated by /dev/sda3, /dev/sdb3, /dev/hda3, and even /dev/hdc3...

Fitzcarraldo wrote:Anyway, have you seen the following Web pages, which show how to use labels instead of UUIDs?

archlinux Wiki - GRUB 2 - Using labels


Indeed, it was that wiki item that finaly convinced me to stop using the device names (about halfway through my first Arch Linux install && configuration}

This guy was about where I am except, unlike me, he could edit something at /usr/lib/grub/grub-mkconfig_lib...

I think I figured out that while /etc/default/sabayon-grub may come with a do not edit warning, it's simply sourced from /etc/default/grub which I can edit... So I again commented out the conditional "source /etc/default/sabayon-grub " logic and instead directly assigned my LABEL based values to GRUB_CMDLINE_LINUX in /etc/default/grub itself which I can edit...

Considering the way that the value in GRUB_CMDLINE_LINUX seems to ovedrride everything else I'm not so sure that the changes in /etc/default/grub and /etc/grub.d/10_linux to set and use GRUB_ENABLE_LINUX_LABEL do much, but I don't see what they can hurt and both of those files should stay edited...

This leaves only durable search lines that use "--label" instead of "--fs-uuid" to get me to mark this thread as solved...
But like I said, my Sabayon installation doesn't have a /usr/lib/grub/grub-mkconfig_lib file in which to find where it would say
Code: Select all
if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
  fi
So that I can change that to say instead
Code: Select all
if label="`${grub_probe} --device ${device} --target=fs_label 2> /dev/null`" ; then
    echo "search --no-floppy --label --set=root ${label}"
  elif fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
  fi
Can anybody tell me where to find this part of grub-mkconfig's configureation logic??????????
joe3
Advanced Hen
 
Posts: 200
Joined: Sun May 06, 2007 21:28

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby Fitzcarraldo » Thu Sep 01, 2011 5:05

Are you using 64-bit SL?:

Code: Select all
$ locate grub-mkconfig_lib
/lib64/grub/grub-mkconfig_lib
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Can I get Sabayon to use "LABEL=" NOT "UUID" in grub.cfg

Postby joe3 » Thu Sep 01, 2011 9:37

Fitzcarraldo wrote:Are you using 64-bit SL?:

Code: Select all
$ locate grub-mkconfig_lib

/lib64/grub/grub-mkconfig_lib


OK then... Task complete... & just to recap what worked... I note that since this thread might be googled by someone trying to do the same for ubuntu I'll add that MOST of this worked with ubuntu 10.04 (LTS) with two differences I will mention below...

1) modified /etc/default/grub as follows:

Where it says:
GRUB_DISABLE_LINUX_UUID="true"

MUST comment it out, and add line to enable label
Code: Select all
# GRUB_DISABLE_LINUX_UUID="true"
GRUB_ENABLE_lINUX_LABEL="true"

Note: I found 2 instances of "GRUB_DISABLE_LINUX_UUID=" so I did the above twice.

Next find where it sources /etc/default/sabayon-grub, comment out the if then source
logic. And using /etc/default/sabayon-grub as a guide, directly assign a LABEL based version
of it's contents like this:
Since Ubuntu doesn't have a "sabayon-grub file this section wouldn't apply.
Code: Select all
# Replace conditional call to /etc/default/sabayon-grub with direct assignment
# of GRUB_CMDLINE_LINUX with my approved LABEL based values
# if [ -f "/etc/default/sabayon-grub" ]; then
#       # this file is placed by the Sabayon Installer and contains
#       # custom GRUB_CMDLINE_LINUX parameters created at install
#       # time.
#       source /etc/default/sabayon-grub
# fi
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} init=/linuxrc splash=silent,theme:sabayon radeon.modeset=1 vga=791 console=tty1 quiet dokeymap keymap=us domdadm  root=LABEL=Esaba_lap-6 docrypt"


I Note: I don't use resume so I didn't include resume...

2) modify /etc/grub.d/10_linux

find where it says "LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}"
edit the section to look like this:

Code: Select all
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
    || uses_abstraction "${GRUB_DEVICE}" lvm; then
  LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
  LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
  GRUB_DEVICE_LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)"
  . /etc/default/grub
  if [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
  && test -e "/dev/disk/by-label/${GRUB_DEVICE_LABEL}" ; then
  LINUX_ROOT_DEVICE=LABEL=${GRUB_DEVICE_LABEL}
  fi
fi



3) modify /lib64/grub/grub-mkconfig_lib
For ubuntu the file is at /usr/lib/grub/grub-mkconfig_lib and the modification is different {see below}
find where it says:
Code: Select all
 if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
   echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
 fi
Make the section look like:

Code: Select all
  # If there's a filesystem UUID that GRUB is capable of identifying, use it;
  # otherwise set root as per value in device.map.
  echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
if label="`${grub_probe} --device ${device} --target=fs_label 2> /dev/null`" ; then
    echo "search --no-floppy --label --set=root ${label}"
  elif fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
  fi

With Ubuntu 10.04 grub-probe didn't like the "--target=fs_label" option so I used a somewhat less elegant modification to grub-mkconfig_lib...I note that this modification isn't conditional, But since all my partitions do have unique labels that wasn't a problem for me.
Code: Select all
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
  # otherwise set root as per value in device.map.
  echo "set root='`${grub_probe} --device ${device} --target=drive`'"
  #if fs_label="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    #echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
  #fi
auto_label="`e2label ${device} 2>/dev/null`"
echo "search --no-floppy --label ${auto_label} --set root"
#   fi


Then I did a "grub-mkconfig -o /boot/grub/grub.cfg"
Of course with ubuntu that can be done as an "update-grub" command ;-)

Anyway that's what worked for me...

--
joe3
joe3
Advanced Hen
 
Posts: 200
Joined: Sun May 06, 2007 21:28


Return to Sabayon Linux General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest