LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Boot Slackware on NVME SSD? (https://www.linuxquestions.org/questions/slackware-14/boot-slackware-on-nvme-ssd-4175586404/)

Wiser Slacker 08-11-2016 12:07 AM

wrong
Quote:

image = /boot/vmlinuz-generic-3.10.17
initrd = /boot/initrd-3.10.17.gz
#root = /dev/sda2
root = "UUID=23bce2c2-996d-449e-89cc-0e5029cc6d8d"
#root = "LABEL=Mylabelhere"
label = Slack-generic
read-only
this gives NOT a static number
Quote:

auto BOOT_IMAGE=MyServer ro root=804 vt.default_utf8=0 elevator=noop
both labels UUID= and LABEL= do find its way into kernel commandline


right
Quote:

image = /boot/vmlinuz
addappend = " root=PARTUUID=6f47c81b-02"
#root =
this gives a commandline to the kernel:
Quote:

auto BOOT_IMAGE=Slack14 ro vt.default_utf8=0 elevator=noop raid=noautodetect root=PARTUUID=6f47c81b-02

bassmadrigal 08-11-2016 09:39 AM

I am thinking you're not understanding things. The way I put UUIDs is the correct way to do it with lilo.conf. I am successfully using it in my computer right now. Others have successfully done it with labels. I've helped several people set up their lilo.conf files with UUIDs. As I wrote in the article, PARTUUIDs are not properly supported in lilo (unlike regular UUIDs), so you need to use the addappend option, but you do not need it for UUIDs (if you're using an initrd). If you're trying to do it without an initrd, it might be completely different (and might get the output you found), but the way I wrote it there most definitely works.

There is even a perl script included with lilo called lilo-uuid-diskid (it's under /sbin/) that will go through and convert your lilo.conf to use UUIDs in the format I listed. You can view the script here and between lines 443 and 447 it will show an example of what it does, which is the format I provided.

Also, to further iterate that this method works (without an append), if I view my /proc/cmdline, I get:

Code:

BOOT_IMAGE=Slack-4.4.13 ro root=UUID=23bce2c2-996d-449e-89cc-0e5029cc6d8d vt.default_utf8=0
That particular boot is done with the following stanza:

Code:

image = /boot/vmlinuz-generic-4.4.13
initrd = /boot/initrd-4.4.13.gz
root = "UUID=23bce2c2-996d-449e-89cc-0e5029cc6d8d"
label = Slack-4.4.13
read-only

My computer boots up properly every time. And when I first implemented UUIDs in my lilo.conf, I then played around with my drive order to ensure it worked, and when I swapped cables for my first and sixth drive, it still booted, although, my main OS drive was now /dev/sdf2 instead of /dev/sda2. It worked exactly as it should.

What you're probably seeing is when you use UUIDs without an initrd, which isn't supported. I specifically mentioned in the article that an initrd is required if using LABEL or UUID. The reason an initrd is required is because of what you quoted out of /usr/src/linux/init/do_mounts.c. As you can see, it doesn't support using UUIDs specifically (the only mention of UUID is under the PARTUUID section). It needs the environment provided by the initrd to use the UUID. If the environment isn't there, the kernel doesn't know what to mount and you end up with a kernel panic.

Quote:

Originally Posted by Wiser Slacker (Post 5589270)
and maybe to prevent further discussions - the PARTUID exist as long as winNT exist ... its a time stamp - do have a look at this http://thestarman.pcministry.com/asm/mbr/STDMBR.htm

As for your comment about PARTUIDs (not sure if this was a misspelling since that term did not exist in your link) existing since winNT, that is probably something other than the PARTUUIDs that exist now (notice the extra U). UID stands for Unique IDentifier, but there is no standard on what that means. That is why with WinNT systems, according to you, it is a timestamp. UUIDs are universally unique, which means there needs to be a standard. That standard is a 128bit value that is comprised of 32 characters. GPT stands for GUID Partition Table, and GUID *is* a 128bit UUID. The whole partition table was designed around using universally unique identifiers for partitions, which are referenced using PARTUUIDs. As I mentioned, PARTUUIDs are only included with GPT partitions. They, flatout, don't exist for MBR tables. However, some clever people found a way to take the drive identifier and attach the partition name to allow referencing specific drives and partitions without PARTUUIDs under the PARTUUID label (this is why your MBR drives don't show up under /dev/disk/by-partuuid/ -- because they don't exist, but you can view the fake "PARTUUID" under blkid). But this wasn't implemented until the 3.8 kernel. If you were to try this on an older kernel, you wouldn't have any PARTUUIDs listed in blkid for your MBR devices and you'd have to use UUIDs and an initrd like old times.

This whole thing is just like how the NTFS "UUID" is not an actual UUID, but is still able to be referenced as one.

Wiser Slacker 08-11-2016 10:59 AM

re: Hi, ;)

Quote:

Originally Posted by bassmadrigal (Post 5589408)
Also, to further iterate that this method works (without an append), if I view my /proc/cmdline, I get:

Code:

BOOT_IMAGE=Slack-4.4.13 ro root=UUID=23bce2c2-996d-449e-89cc-0e5029cc6d8d vt.default_utf8=0
That particular boot is done with the following stanza:

Code:

image = /boot/vmlinuz-generic-4.4.13
initrd = /boot/initrd-4.4.13.gz
root = "UUID=23bce2c2-996d-449e-89cc-0e5029cc6d8d"
label = Slack-4.4.13
read-only


i have had a look into lilo source code and the change log ...

Quote:

Changes from version 22.7.3 to 22.8 (16-Feb-2007) John Coffman

Boot Installer
--------------
- Move configuration information (-X) to a separate procedure.
(lilo.c)
- Fix type decl problem in LVM _IOR/RW macros. (geometry.c)
- Add DEV_DISK_DIR and edit source to use it. (config.h,
device.c, geometry.c)
- Change handling of 'device-mapper' depending upon DEVMAPPER
option. (device.c, geometry.c)
- Modify 'scan_dir' to stay out of hidden directories. (device.c)
- Add 'nodevcache' option to configuration file. (cfg.c, lilo.c)
- Add sync() before boot sector write to compensate for 2.6 kernel
bug in partition buffering code. (bsect.c)
- Allow 'root="UUID=xyz"' syntax. (bsect.c)
this leads into the bsect.c (version of lilo-24.2)
Code:

if ((root = cfg_get_strg(cf_kernel,"root")) || (root = cfg_get_strg(
      cf_options,"root")))  {
        if (!strcasecmp(root,"current")) {
            if (stat("/",&st) < 0) pdie("stat /");
            sprintf(strchr(options,0),"root=%x ",(unsigned int) st.st_dev);
        }
        else if (strlen(root)>12 && !strncmp(root,"/dev/mapper/",12)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>6 && !strncmp(root,"LABEL=",6)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>5 && !strncmp(root,"UUID=",5)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else {
            sprintf(strchr(options,0),"root=%x ",dev_number(root));
        }
      }

and i can see that lilo rearly took these too words and put them into kernel commandline by itself, because i have never used this before, and have had trying this with PARTUUID= witch doesn't work, i dont know it before.

so i have learned it today ... ;)

thank you

bormant 08-11-2016 11:29 AM

may be simple patch for bsect.c is a good idea
Code:

if ((root = cfg_get_strg(cf_kernel,"root")) || (root = cfg_get_strg(
      cf_options,"root")))  {
        if (!strcasecmp(root,"current")) {
            if (stat("/",&st) < 0) pdie("stat /");
            sprintf(strchr(options,0),"root=%x ",(unsigned int) st.st_dev);
        }
        else if (strlen(root)>12 && !strncmp(root,"/dev/mapper/",12)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }

        else if (strlen(root)>6 && !strncmp(root,"LABEL=",6)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>5 && !strncmp(root,"UUID=",5)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else {
            sprintf(strchr(options,0),"root=%x ",dev_number(root));
        }
      }


bassmadrigal 08-11-2016 11:34 AM

Quote:

Originally Posted by bormant (Post 5589438)
may be simple patch for bsect.c is a good idea
Code:

if ((root = cfg_get_strg(cf_kernel,"root")) || (root = cfg_get_strg(
      cf_options,"root")))  {
        if (!strcasecmp(root,"current")) {
            if (stat("/",&st) < 0) pdie("stat /");
            sprintf(strchr(options,0),"root=%x ",(unsigned int) st.st_dev);
        }
        else if (strlen(root)>12 && !strncmp(root,"/dev/mapper/",12)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }

        else if (strlen(root)>6 && !strncmp(root,"LABEL=",6)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else if (strlen(root)>5 && !strncmp(root,"UUID=",5)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
        else {
            sprintf(strchr(options,0),"root=%x ",dev_number(root));
        }
      }


That might definitely be worth routing up to Pat since he stated he will maintain lilo after the most recent developer decided to finish the project at the end of 2015.

EDIT: I wonder if support could be added for PARTLABEL as well (I am not good enough with C to know how to add it), although, that is limited to solely GPT partitioned drives.

bormant 08-11-2016 12:11 PM

Quote:

I wonder if support could be added for PARTLABEL as well
Good catch...
Code:

# zcat lilo.root.partuud.diff.gz
--- ./src/bsect.c.orig        2011-06-22 11:09:44.000000000 +0400
+++ ./src/bsect.c        2016-08-11 20:07:50.973712769 +0300
@@ -1092,6 +1092,12 @@
        else if (strlen(root)>12 && !strncmp(root,"/dev/mapper/",12)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }
+        else if (strlen(root)>10 && !strncmp(root,"PARTLABEL=",10)) {
+            sprintf(strchr(options,0),"root=%s ", root);
+        }
+        else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {
+            sprintf(strchr(options,0),"root=%s ", root);
+        }

        else if (strlen(root)>6 && !strncmp(root,"LABEL=",6)) {
            sprintf(strchr(options,0),"root=%s ", root);
        }

Code:

# diff -u lilo.SlackBuild{.orig,}
--- lilo.SlackBuild.orig        2016-08-11 19:47:37.951483801 +0300
+++ lilo.SlackBuild        2016-08-11 19:50:57.723323256 +0300
@@ -22,7 +22,7 @@
 
 
 VERSION=${VERSION:-24.2}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
 
 # Automatically determine the architecture we're building on:
 if [ -z "$ARCH" ]; then
@@ -48,6 +48,7 @@
 chown -R root:root .
 
 zcat $CWD/lilo.ignore.usable.memory.above.4G.diff.gz | patch -p1 --verbose || exit 1
+zcat $CWD/lilo.root.partuud.diff.gz | patch -p1 --verbose || exit 1
 
 make || exit 1
 make -i install DESTDIR=$PKG || exit 1


bassmadrigal 08-11-2016 12:43 PM

Quote:

Originally Posted by bormant (Post 5589456)
Good catch...
Code:

[color=green]+        else if (strlen(root)>10 && !strncmp(root,"PARTLABEL=",10)) {
  --snip--
+        else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {


Out of random curiosity, how do you determine the number? Based on what I could find online about that line, I'm assuming it is checking if the string length is greater than 10 and

I think I just figured it out. First it's checking if the string is longer than the characters used for the definition (in PARTUUID=, it is 9 characters, plus the actual UUID after), then it checks if the first 9 characters actually equals PARTUUID= (if it doesn't, it moves on to the next else if statement).

Thanks for making me continue to learn on this thread ;)

kjhambrick 08-11-2016 01:02 PM

Good Stuff !

These are excellent enhancements for LILO.

This Arch Doc helped me 'get it' Arch Persistent block device naming

Thanks for helping make Slackware better for all !

-- kjh

bassmadrigal 08-11-2016 01:36 PM

Quote:

Originally Posted by kjhambrick (Post 5589489)
This Arch Doc helped me 'get it' Arch Persistent block device naming

I used that wiki heavily when I was switching my computer over to UUIDs. It (and the few linked pages there) taught me a lot of what I know about UUIDs and how the interact with lilo.conf and fstab. Hopefully once I finish the slackwiki page, it can be a good enough reference for Slackers that they don't need to visit the Arch page.

Wiser Slacker 08-11-2016 06:32 PM

sorry for disturbing your party ...

Quote:

Originally Posted by bassmadrigal
PARTLABEL=

but i can't find any reference to this 'PARTLABEL=' in the kernel code, so i don't think that the kernel could find its root partition by this naming.

maybe with an initrd - i dont know - i have never used that.

ok. i shut up now

bassmadrigal 08-11-2016 08:19 PM

Quote:

Originally Posted by Wiser Slacker (Post 5589595)
but i can't find any reference to this 'PARTLABEL=' in the kernel code, so i don't think that the kernel could find its root partition by this naming.

maybe with an initrd - i dont know - i have never used that.

I'll do some testing in a VM before I finalize the wiki page.

bormant 08-12-2016 04:03 AM

@bassmadrigal,
as I can see for now 'PARTLABEL='
1) is unusable by kernel itself (see name_to_dev_t() from kernel's init/do_mounts.c), as "LABEL=" and "UUID=" too, and
2) is unusable by initrd. initrd's init script uses sbin/findfs to resolve "LABEL=" and "UUID=" to device name. As for 14.2 mkinitrd 1.4.8 uses BusyBox v1.20.2. It's findfs says:
Code:

BusyBox v1.20.2 (2016-06-20 15:25:34 CDT) multi-call binary.

Usage: findfs LABEL=label or UUID=uuid

Find a filesystem device based on a label or UUID

As we can see it doesn't know anything about PARTLABEL=.

So, for now "PARTLABEL=" is unusable by the kernel itself and by the initrd's init.

bassmadrigal 08-12-2016 08:33 AM

Sounds good. Where would we look to see if the fstab still supports it?

bormant 08-12-2016 08:53 AM

@bassmadrigal,
/etc/fstab is a config file of mount command, so

man mount -- for commandline support,
man fstab -- for support in /etc/fstab.

They (LABEL=, UUID=, PARTLABEL=, PATUUID=) are mentioned there.

bassmadrigal 08-12-2016 10:59 AM

Quote:

Originally Posted by bormant (Post 5589844)
@bassmadrigal,
/etc/fstab is a config file of mount command, so

man mount -- for commandline support,
man fstab -- for support in /etc/fstab.

They (LABEL=, UUID=, PARTLABEL=, PATUUID=) are mentioned there.

Good point. I had thought about that after I posted, but I was already in bed.


All times are GMT -5. The time now is 04:45 AM.