LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-15-2023, 11:00 AM   #1
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 907

Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
Root partition (using LUKS) fails to mount in initrd for Linux kernel 6.3


I'm on Slackware 15.0 using a custom compiled Linux kernel 6.3 (6.3.8 to be more precise).

I just upgraded from Linux kernel 6.2 to 6.3 (using "make oldconfig" to make a .config as close as possible to Slackware's kernel .config) and booting reliably fails with "ERROR: No /sbin/init found on rootdev (or not mounted)." Dropping back to kernel 6.2 booting works fine. However, if I manually mount the root drive and type "exit" the boot process resumes and boots normally. Here is a portion of the boot console, including commands typed by me (in bold):

Code:
[   14.763250] scsi 8:0:0:0: Direct-Access     SanDisk  U3 Contour       4.04 PQ: 0 ANSI: 2
[   14.765212] sd 8:0:0:0: [sdi] 8027793 512-byte logical blocks: (4.11 GB/3.83 GiB)
[   14.766210] sd 8:0:0:0: [sdi] Write Protect is off
[   14.766734] sd 8:0:0:0: [sdi] Mode Sense: 03 00 00 00
[   14.767062] sd 8:0:0:0: [sdi] No Caching mode page found
[   14.767554] sd 8:0:0:0: [sdi] Assuming drive cache: write through
[   14.784381]  sdi: sdi1 sdi2 sdi3
[   14.785569] sd 8:0:0:0: [sdi] Attached SCSI removable disk
[   16.365082] EXT4-fs (sdi3): mounted filesystem <redacted UUID> with ordered data mode. Quota mode: none.
>>> Using LUKS key file: 'LABEL=LIVESLAK:/persistence/luks_keys/nvme0n1p5.luks'
Unlocking LUKS encrypted device '/dev/nvme0n1p5' as luks mapped device 'luksnvme0n1p5' with '--allow-discards':
[   21.047074] EXT4-fs (sdi3): unmounting filesystem <redacted UUID>.
[   21.061384] /dev/mapper/luksnvme0n1p8: Can't open blockdev
mount: mounting /dev/mapper/luksnvme0n1p8 on /mnt failed: No such file or directory
ERROR:  No /sbin/init found on rootdev (or not mounted).  Trouble ahead.
        You can try to fix it. Type 'exit' when things are done.

/bin/sh: can't access tty; job control turned off
/ # mount -o ro /dev/mapper/luksnvme0n1p5 /mnt
[   42.457027] EXT4-fs (dm-0): mounted filesystem <redacted UUID> with ordered data mode. Quota mode: none.
/ # exit
After typing "exit" the boot continues normally (since I mounted the root filesystem successfully manually).

Taking a look at init in the initrd there is:

Code:
  # Switch to real root partition:
  /sbin/udevadm settle --timeout=10
  echo 0x0100 > /proc/sys/kernel/real-root-dev
  mount -o ro${ROOTFLAGS:+,$ROOTFLAGS} -t $ROOTFS $ROOTDEV /mnt
  
  if [ ! -r /mnt/sbin/init ]; then
    echo "ERROR:  No /sbin/init found on rootdev (or not mounted).  Trouble ahead."
    echo "        You can try to fix it. Type 'exit' when things are done." 
    echo
    /bin/sh
  fi
So my best guess is that the "udevadm settle" command isn't waiting long enough for /dev/mapper/luksnvme0n1p5 to be available. After it drops to a shell and I mount manually it works (so enough time has elapsed). I have not tried editing init (add a "sleep" command) and rebuilding the initrd to test this theory.

Here is my drive layout:
Code:
# lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1           259:0    0   1.8T  0 disk  
├─nvme0n1p1       259:1    0  1010M  0 part  /boot/efi
├─nvme0n1p2       259:2    0   3.5G  0 part  /recovery
├─nvme0n1p3       259:3    0 279.4G  0 part  
├─nvme0n1p4       259:4    0     4G  0 part  
│ └─cryptswap     253:1    0     4G  0 crypt [SWAP]
└─nvme0n1p5       259:5    0   1.5T  0 part  
  └─luksnvme0n1p5 253:0    0   1.5T  0 crypt /
# mount | grep luksnvme0n1p5
/dev/mapper/luksnvme0n1p5 on / type ext4 (rw,relatime,discard)
/ is an ext4 partition on a LUKS partition on /dev/nvme0n1p5.

Has anyone else seen this with Linux kernel 6.3? Is adding a "sleep" command before mounting root in init the best solution?
 
Old 06-15-2023, 11:09 AM   #2
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,570

Rep: Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438Reputation: 3438
You can add a "wait" in the initrd - it's parameter on /etc/mkinitrd.conf is like
Code:
WAIT="5"
 
Old 06-15-2023, 11:39 AM   #3
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 907

Original Poster
Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
Quote:
Originally Posted by LuckyCyborg View Post
You can add a "wait" in the initrd - it's parameter on /etc/mkinitrd.conf is like
Code:
WAIT="5"
Thanks I will try that. My concern is that the "wait" happens before the LUKS partition is unlocked. But I will try it first before inserting a "wait" after the LUKS stuff but before mounting root.
 
Old 06-15-2023, 01:42 PM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,917

Rep: Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035
It does sound like a timing issue doesn't it. You might consider adding time to the timeout on the settle command and see if that helps.
 
Old 06-16-2023, 12:06 PM   #5
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 907

Original Poster
Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
Problem Exists Between Keyboard And Chair

If you look real close at the error message:

Code:
[   21.061384] /dev/mapper/luksnvme0n1p8: Can't open blockdev
You'll note it's the wrong partition name (root should be /dev/mapper/luksnvme0n1p5).

So what happened? When I copied and pasted the entries in elilo.conf and updated the kernel patch level from 5 to 8 using search and replace I accidentally also changed the partition number from 5 to 8.

I even missed this when I manually mounted the drive from initrd's shell (the error message was different than what I typed to mount the root drive).

Thanks everyone for your help and suggestions.
 
  


Reply

Tags
initrd, luks



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] Initrd requires LVM option for RAID/LUKS root partition TracyTiger Slackware 5 09-19-2016 03:31 AM
custom kernel initrd for LVM on LUKS MEC75 Slackware 16 11-11-2014 10:42 AM
[SOLVED] Initrd for kernel 3.8.11 and encrypted luks root partition in current Phorize Slackware 8 06-15-2013 09:04 AM
[SOLVED] LUKS / LVM2: Root partition unable to boot, initrd errors ADX Slackware 5 01-13-2012 04:57 PM
[SOLVED] Kernel update on LUKS and LVM encrypted Slackware, mount fails KMBS Slackware 15 02-08-2010 01:23 PM

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

All times are GMT -5. The time now is 10:53 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