LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-25-2019, 05:21 PM   #1
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Question Slackware-current, huge: Kernel panic when 'root=UUID' in GRUB configuration


The TL;DR version:

I’m experimenting with configuring GRUB, and I’m running into a kernel panic when I attempt to boot the Slackware ‘huge’ kernel from a GRUB menuentry that specifies the ‘root’ filesystem through its UUID:
Code:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
My questions:
  • Is this to be expected?
  • Is it a GRUB issue, or a kernel issue?
  • Is there anything that can be done to avoid it?

The long-winded version:

I’m using “GNU GRUB version 2.04-1”, installed and configured by Debian-Testing, to boot this Legacy-BIOS laptop, with a GPT-partitioned harddisk.

GRUB configured a submenu for my Slackware-Current system, in which it included two entries—one for the ‘generic’ kernel, and one for the ‘huge’ kernel:
Code:
menuentry 'Generic (on /dev/sda8)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic--f9f286a7-0ed3-4d01-bfa7-895fb4535697' {
   insmod part_gpt
   insmod ext2
   set root='hd0,gpt8'
   if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt8 --hint-efi=hd0,gpt8 --hint-baremetal=ahci0,gpt8  f9f286a7-0ed3-4d01-bfa7-895fb4535697
   else
      search --no-floppy --fs-uuid --set=root f9f286a7-0ed3-4d01-bfa7-895fb4535697
   fi
   linux /boot/vmlinuz-generic root=/dev/sda8 ro  vt.default_utf8=0 vga = normal
   initrd /boot/initrd-generic
}
menuentry 'Huge (on /dev/sda8)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge--f9f286a7-0ed3-4d01-bfa7-895fb4535697' {
   insmod part_gpt
   insmod ext2
   set root='hd0,gpt8'
   if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt8 --hint-efi=hd0,gpt8 --hint-baremetal=ahci0,gpt8  f9f286a7-0ed3-4d01-bfa7-895fb4535697
   else
      search --no-floppy --fs-uuid --set=root f9f286a7-0ed3-4d01-bfa7-895fb4535697
   fi
   linux /boot/vmlinuz-huge root=/dev/sda8 ro  vt.default_utf8=0 vga = normal
}
In contrast to the Debian entries, the ones for Slackware specify the ‘root’ filesystem on the ‘linux’ line as the device name (while for Debian, the ‘root=UUID’ notation is used).

As a test, I copied these two Slackware entries into the ‘/etc/grub.d/40_custom’ file (under Debian, obviously) and I edited their ‘root’ parameters to specify the UUID instead:
Code:
menuentry 'Generic UUID (on /dev/sda8)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic--f9f286a7-0ed3-4d01-bfa7-895fb4535697' {
   insmod part_gpt
   insmod ext2
   set root='hd0,gpt8'
   if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt8 --hint-efi=hd0,gpt8 --hint-baremetal=ahci0,gpt8  f9f286a7-0ed3-4d01-bfa7-895fb4535697
   else
      search --no-floppy --fs-uuid --set=root f9f286a7-0ed3-4d01-bfa7-895fb4535697
   fi
   linux /boot/vmlinuz-generic root=UUID=f9f286a7-0ed3-4d01-bfa7-895fb4535697 ro  vt.default_utf8=0 vga = normal
   initrd /boot/initrd-generic
}
menuentry 'Huge UUID (on /dev/sda8)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge--f9f286a7-0ed3-4d01-bfa7-895fb4535697' {
   insmod part_gpt
   insmod ext2
   set root='hd0,gpt8'
   if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt8 --hint-efi=hd0,gpt8 --hint-baremetal=ahci0,gpt8  f9f286a7-0ed3-4d01-bfa7-895fb4535697
   else
      search --no-floppy --fs-uuid --set=root f9f286a7-0ed3-4d01-bfa7-895fb4535697
   fi
   linux /boot/vmlinuz-huge root=UUID=f9f286a7-0ed3-4d01-bfa7-895fb4535697 ro  vt.default_utf8=0 vga = normal
}
The only difference with the original entries are the menuentry titles, and the “root=UUID” notation on the ‘linux’ lines.

After I ran update-grub, the two entries were successfully added to the GRUB menu, and now, the “Generic UUID” entry boots fine. The “Huge UUID” entry, however, runs into the kernel panic shown above.
 
Old 07-25-2019, 05:32 PM   #2
ZhaoLin1457
Senior Member
 
Registered: Jan 2018
Posts: 1,022

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
I believe that the UUIDs method to specify the root device for the kernel, needs a special processing done by an initrd. More specifically, this is how is done in the Slackware's initrd:
Code:
  # $ROOTDEV maybe contains: "UUID=f9f286a7-0ed3-4d01-bfa7-895fb4535697"

  # Find root device if a label or UUID was given:
  if echo $ROOTDEV | grep -q "LABEL=" || \
     echo $ROOTDEV | grep -q "UUID=" ; then
    ROOTDEV=$(findfs $ROOTDEV)
  fi

  # $ROOTDEV contains: "/dev/sda8"
And very probably that's why that huge kernel is not aware by that particular way how the root is specified, unless you use an initrd also for it.

Last edited by ZhaoLin1457; 07-25-2019 at 05:38 PM.
 
4 members found this post helpful.
Old 07-25-2019, 05:43 PM   #3
Labinnah
Member
 
Registered: May 2014
Location: Łódź, Poland
Distribution: Slackware-current
Posts: 185

Rep: Reputation: 112Reputation: 112
Kernel documentation tell to read this comment about root parameter:
Code:
/*
 *	Convert a name into device number.  We accept the following variants:
 *
 *	1) <hex_major><hex_minor> device number in hexadecimal represents itself
 *         no leading 0x, for example b302.
 *	2) /dev/nfs represents Root_NFS (0xff)
 *	3) /dev/<disk_name> represents the device number of disk
 *	4) /dev/<disk_name><decimal> represents the device number
 *         of partition - device number of disk plus the partition number
 *	5) /dev/<disk_name>p<decimal> - same as the above, that form is
 *	   used when disk name of partitioned disk ends on a digit.
 *	6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
 *	   unique id of a partition if the partition table provides it.
 *	   The UUID may be either an EFI/GPT UUID, or refer to an MSDOS
 *	   partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
 *	   filled hex representation of the 32-bit "NT disk signature", and PP
 *	   is a zero-filled hex representation of the 1-based partition number.
 *	7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
 *	   a partition with a known unique id.
 *	8) <major>:<minor> major and minor number of the device separated by
 *	   a colon.
 *
 *	If name doesn't have fall into the categories above, we return (0,0).
 *	block_class is used to check if something is a disk name. If the disk
 *	name contains slashes, the device name has them replaced with
 *	bangs.
 */
So probably you should use "PARTUUID" instead of "UUID".

Last edited by Labinnah; 07-25-2019 at 05:45 PM.
 
3 members found this post helpful.
Old 07-25-2019, 06:21 PM   #4
ZhaoLin1457
Senior Member
 
Registered: Jan 2018
Posts: 1,022

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
BTW, the PARTUID can contain an real UUID only while is used the GPT (and EFI), also the GPT UUIDs aren't same as the filesystem UUIDs...

Last edited by ZhaoLin1457; 07-25-2019 at 06:33 PM.
 
1 members found this post helpful.
Old 07-25-2019, 06:30 PM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
As of the last time I dug into it, using UUID does require an initrd. If you don't want to use an initrd, you can use PARTUUID, but I believe these are only generated on GPT formatted disks.

I also enclosed my UUID=XXXX in quotes, just to make sure the system reads it properly. I never checked if it worked fine without it. Example below:

Code:
root="UUID=f9f286a7-0ed3-4d01-bfa7-895fb4535697"
 
1 members found this post helpful.
Old 07-25-2019, 08:28 PM   #6
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by Labinnah View Post
So probably you should use "PARTUUID" instead of "UUID".
Thanks for this! PARTUUID does indeed work.
 
Old 07-25-2019, 08:36 PM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Indeed you can't set root by uuid in grub.cfg if there's no initrd to find the associated file system.

I just checked it , it works if you set it by partuuid (that's the default in Slint cf. our attached /etc/default/grub).

As an aside, that's an issue when using os-detect to detect and boot Linux if an initrd is not found because it uses the grub command probe to find the uuid aka the fs-uuid, not the partuuid.

This commit could help change that, however it was merged after the release of grub 2.04 (so you need to patch it to get it) and it works for gpt only.
Attached Files
File Type: txt default.txt (3.9 KB, 19 views)

Last edited by Didier Spaier; 07-25-2019 at 09:01 PM. Reason: Actually uploaded the attached file
 
2 members found this post helpful.
Old 07-25-2019, 11:52 PM   #8
ZhaoLin1457
Senior Member
 
Registered: Jan 2018
Posts: 1,022

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Why we need to patch the grub, while we already have the blkid to find the PARTUIDs ?
Code:
bash-5.0# blkid
/dev/sda1: LABEL="LINUX-SYSTEM" UUID="9a83ce56-19db-4a1d-839c-5273ec4306c8" TYPE="ext4" PARTUUID="2ab22339-01"
/dev/sdb1: LABEL="WINDOWS" UUID="448296C41A95D837" TYPE="ntfs" PARTUUID="c4cd6b35-01"
/dev/sdb2: LABEL="LINUX-DATA" UUID="36a04dd5-acbf-4c2c-b4e9-1f3598ff6d95" TYPE="ext4" PARTUUID="c4cd6b35-02"
/dev/sdb3: LABEL="LINUX-SWAP" UUID="b91dcdb4-4c11-47e2-b134-3b2aec1e3418" TYPE="swap" PARTUUID="c4cd6b35-03"
My computer have one SSD containing the system root and one mechanical drive containing the rest.
 
1 members found this post helpful.
Old 07-26-2019, 02:22 AM   #9
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Quote:
Originally Posted by ZhaoLin1457 View Post
Why we need to patch the grub, while we already have the blkid to find the PARTUIDs ?
blkid is available when Linux is running. It is not before booting, when the GRUB menu is displayed.

I was not speaking about creating a grub.cfg file from an installed system using e.g. grub-mkconfig but detecting then booting the installed OS like with an USB boot stick as the one created by /var/log/setup/setup.80-make-bootstick.
 
2 members found this post helpful.
Old 07-26-2019, 04:09 AM   #10
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by luvr View Post
[SIZE="3"]
My questions:
  • Is this to be expected?
  • Is it a GRUB issue, or a kernel issue?
  • Is there anything that can be done to avoid it?
1) yes, the kernel hasn't got the (e)udev output available, so only knows /dev/ paths
2) kernel, grub does have limited file system support, to find kernel and initrd
3) make an initrd (ramdisk) with eudev etc IN it, to support UUID=, LABEL= etc options in the /etc/fstab file. Those are only generated BY running udev, which then creates the /dev/disk subtree. Make sure that initrd is loaded before the root partition is mounted.
 
1 members found this post helpful.
Old 01-19-2021, 06:22 AM   #11
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by ehartman View Post
3) make an initrd (ramdisk) with eudev etc IN it, to support UUID=, LABEL= etc options in the /etc/fstab file. Those are only generated BY running udev, which then creates the /dev/disk subtree. Make sure that initrd is loaded before the root partition is mounted.
Right, I ignored this option until now, but I’m curious about what exactly will have to go into the initrd. How can I find this out? Could I start from a generic-kernel initrd and just remove anything that I assume unnecessary? I know I will at least have to remove the modules that are built into the huge kernel, because they will make the kernel panic (at least, that was what happened when I accidentally attempted to boot a huge kernel with a generic-kernel initrd, long ago).

Is there an intelligent way to obtain a list of what has to go into the huge-kernel initrd, or do I have to make an educated guess until it actually works?
 
Old 01-19-2021, 06:45 AM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Quote:
Is there an intelligent way to obtain a list of what has to go into the huge-kernel initrd, or do I have to make an educated guess until it actually works?
run /usr/share/mkinitrd/mkinitrd_command_generator.sh will give you a starting point.
 
Old 04-20-2022, 02:31 PM   #13
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by colorpurple21859 View Post
run /usr/share/mkinitrd/mkinitrd_command_generator.sh will give you a starting point.
Sorry to return to this issue after such a long time, but doesn’t mkinitrd_command_generator.sh work on the assumption that you will be using a generic kernel? I mean, even if I pass it the filename of my huge kernel, it just gives me the same list of modules as for the generic one. That won’t work, will it?

In fact, here’s the output that mkinitrd_command_generator.sh gives me:
Code:
# /usr/share/mkinitrd/mkinitrd_command_generator.sh /boot/vmlinuz-huge-5.15.27
#
# mkinitrd_command_generator.sh revision 1.45
#
# This script will now make a recommendation about the command to use
# in case you require an initrd image to boot a kernel that does not
# have support for your storage or root filesystem built in
# (such as the Slackware 'generic' kernels').
# A suitable 'mkinitrd' command will be:

mkinitrd -c -k 5.15.27 -f ext4 -r /dev/nvme0n1p15 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz
# An entry in 'etc/lilo.conf' for kernel '/boot/vmlinuz-huge-5.15.27' would look like this:
# Linux bootable partition config begins
# initrd created with 'mkinitrd -c -k 5.15.27 -f ext4 -r /dev/nvme0n1p15 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz'
image = /boot/vmlinuz-huge-5.15.27
  initrd = /boot/initrd.gz
  root = /dev/nvme0n1p15
  label = 5.15.27
  read-only
# Linux bootable partition config ends
As far as I can tell, there’s nothing there that will point me in any direction that gets me closer to finding out what I need to include in an initrd in order for the huge kernel to understand filesystem UUIDs.

(By the way, this issue came up again after I installed Slackware next to an existing Ubuntu system and I subsequently let Ubuntu regenerate its GRUB configuration file. It used filesystem UUIDs on all entries, which didn’t work on the Slackware generic kernel because I didn’t have an initrd yet, and it didn’t work on the huge kernel either, because that couldn’t make sense of the UUID.)
 
Old 04-20-2022, 02:50 PM   #14
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,505

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
Quote:
Originally Posted by luvr View Post
Sorry to return to this issue after such a long time, but doesn’t mkinitrd_command_generator.sh work on the assumption that you will be using a generic kernel? I mean, even if I pass it the filename of my huge kernel, it just gives me the same list of modules as for the generic one. That won’t work, will it?
Man, forget about the existence of huge kernels. Now and ever, till you use UUIDs. Take a step back and say for thousand times: there is no such thing like a huge kernel!

Because to use UUIDs on your bootloader, means that you need to use always the generic kernel and this is end of line. And the usage of an initrd with the huge kernels makes no sense.

Secondly, never, BUT never mess with the bootloader of one OS on another OS.

Eventually, use chainloading, eventually use different hard disks, BUT trust me, the Ubuntu tools mess with all configuration, not only "regenerates" its own entries.

IF those things are too complicated to you, there's always the option to use a single operating system. Slackware or Ubuntu. Your call.

Last edited by LuckyCyborg; 04-20-2022 at 03:15 PM.
 
Old 04-20-2022, 03:32 PM   #15
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by LuckyCyborg View Post
Take a step back and say thousand times: there is no such thing like a huge kernel!
(Takes a step back…)

[1] “There is no such thing like a huge kernel!”
[2] “There is no such thing like a huge kernel!”
[3] “There is no such thing like a huge kernel!”

[998] “There is no such thing like a huge kernel!”
[999] “There is no such thing like a huge kernel!”
[1000] “There is no such thing like a huge kernel!”

Quote:
To use UUIDs on your bootloader, means that you need to use always the generic kernel and this is end of line. And the usage of an initrd with the huge kernels makes no sense.
Sounds all very logical, but I just got curious again after I got reminded of this issue. I got to wonder if there was anything interesting I could learn about it.

Quote:
Secondly, never, BUT never mess with the bootloader of one OS on another OS.
Well, if you allow me to be pedantic for a moment, then I will say that I wasn’t actually messing with the bootloader of one OS on another OS. Technically, I only had one bootloader, being the GRUB copy that got installed together with Ubuntu. But anyway, my end goal is to remove the Ubuntu GRUB copy (which turns out to be a bit harder than it sounds, because the software packages that make up GRUB must be removed in the right order, and certainly not all in one go, or you get “broken” packages due to dependency troubles.) I will compile my own GRUB copy, for which I will write my own configuration file, manually. Much easier and far more elegant, and even far less error-prone, than the mess that GRUB tends to make of it. (And if it ever does go wrong, I’ll at least know who to blame…)

Quote:
Eventually, use chainloading, eventually use different hard disks, BUT trust me, the Ubuntu tools mess with all configuration, not only "regenerates" its own entries.
Actually, that’s one of the so-called “virtues” of GRUB: It will automate the bootloader configuration process, so you won’t need to worry about it ever again.

And about chainloading: I’m not even sure at this point that that would work under UEFI. I’m assuming that the messing around that I want to undertake with getting my own GRUB copy properly installed and the Ubuntu GRUB getting removed, may well render my system unbootable a few times because I’m still unfamiliar with UEFI. In any case, it will be a learning process.

Quote:
IF those things are too complicated to you, there's always the option to use a single operating system. Slackware or Ubuntu. Your call.
Nothing complicated about this issue, as far as I’m concerned. Just a question that popped up again after all this time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /dev/disk/by-uuid/<uuid here> does not exist and initramfs shell Mitt Green Linux - Kernel 4 08-03-2015 11:56 AM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
[SOLVED] How to mount by-uuid if the device won't show in /dev/disk/by-uuid untill after blkid /dev/sd* ? masmddr Linux - General 4 01-10-2011 07:38 PM
Change UUID - Edit UUID using the dd command GMHilltop Linux - Newbie 10 10-28-2010 07:39 PM
Volume has problems including no uuid in /dev/disk/by-uuid abejarano Linux - Hardware 3 12-31-2008 08:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration