Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Failed to find LUKS device.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dscharalampidis
n00b
n00b


Joined: 07 Dec 2021
Posts: 18

PostPosted: Sun Jul 03, 2022 9:32 pm    Post subject: [SOLVED] Failed to find LUKS device. Reply with quote

I have installed Gentoo on a USB drive to run on an old ThinkPad Chromebook.
I am using a LUKS partition, on top of it I have set up LVM and the root is under a volume group.

On boot, I am getting the following message:
Code:
!! Failed to find LUKS device. If crypt_root kernel command-line argument is correct you are probably missing kernel support for your storage!
!! Could not find the root in .
!! Please specify another value or:
!! - press Enter for the same
!! - type "shell" for a shell
!! - type "q" to skip ...
root() ::


After typing "/dev/sda3" at the prompt and pressing Enter, I am asked for the passphrase, and the system boots normally.

To make sure I am not doing any typos, I removed UUIDs and other parameters and my GRUB command line looks like this:
GRUB_CMDLINE_LINUX="dolvm crypt_root=/dev/sda3"

Can you please help me troubleshoot this?


Last edited by dscharalampidis on Wed Jul 06, 2022 10:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21489

PostPosted: Mon Jul 04, 2022 3:26 pm    Post subject: Reply with quote

USB drives are well known to be slow to respond. It may be that the initramfs searches for devices before the kernel has enumerated the USB drive, so nothing is found, but by the time you type the drive name, the drive has been found. You may be able to hack around this by instructing the initramfs to wait for several seconds before searching for devices.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 887
Location: Richmond Hill, Canada

PostPosted: Mon Jul 04, 2022 4:05 pm    Post subject: Reply with quote

dscharalampidis,

Assume you were using genkernel generated initrd.

It looks to me you have encounter two issues.

First, As Hu point out USB device need time to ready, so usually kernel command argument rootdelay=[30 | some number] will help.

Secondly, You enter "/dev/sda3" at the prompt of the /init script which at this time already pass the logic for LUKS volume, so it looks like your system setup may not be what you intended. I am guessing your rootfs is not really encrypted, the prompt for password may be for other file system(s)

If you wish to further debug this issue, Please share your actual kernel command line
Code:
## After system boot completed at tty prompt enter following command

cat /proc/cmdline | tr '\0' '\n'


And output of /bin/mount command
Back to top
View user's profile Send private message
dscharalampidis
n00b
n00b


Joined: 07 Dec 2021
Posts: 18

PostPosted: Tue Jul 05, 2022 11:27 pm    Post subject: Reply with quote

Thanks for the answers!

Unfortunately, the rootdelay didn't really help. I don't think the issue is related to the slow recognition of the device. I tried several values, up to 120 seconds. I must also say that on the same machine, I can boot Archlinux without adding a delay to GRUB.

@pingtoo I am indeed using genkernel-generated initrd.

Please find the requested information below, and thank you in advance for helping debug this.

lsblk -f

Code:
NAME           FSTYPE      FSVER LABEL      UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                               
├─sda1                                                                                           
├─sda2         vfat                         4A32-71AA                                             
└─sda3         crypto_LUKS                  a1775cd7-6c53-4e93-977b-0b02879d6986                 
  └─root       LVM2_member                  MI5P8K-nyDL-IRID-FB1K-z2SR-WDIF-gwNu9J               
    ├─vg0-root ext4                         3cc1c37e-a2e1-44e7-aa87-e12916b66dd7        1G    81% /
    ├─vg0-var  ext4                         626816f7-04e6-407a-98c4-a2b9dcfc84f1      5.6G    23% /var
    ├─vg0-swap swap                         10e80453-c03e-448f-b527-7388edf18177                  [SWAP]
    └─vg0-home ext4                         14ba17bf-6b34-401f-9c20-908e9b2527f9     88.2G     0% /home
sdb            vfat                         9601-C09F                                16.8G    86% /mnt
mmcblk0                                                                                           
├─mmcblk0p1    ext4                         c2be4804-e7a8-46e5-8f23-dbeb00afa5e8                 
├─mmcblk0p2                                                                                       
├─mmcblk0p3    ext4              ROOT-A                                                           
├─mmcblk0p4                                                                                       
├─mmcblk0p5    ext4              ROOT-A                                                           
├─mmcblk0p6                                                                                       
├─mmcblk0p7                                                                                       
├─mmcblk0p8    ext4              OEM        f6dbc576-a591-4fdc-8c29-1ad4592be5b0                 
├─mmcblk0p9                                                                                       
├─mmcblk0p10                                                                                     
├─mmcblk0p11                                                                                     
└─mmcblk0p12   vfat              EFI-SYSTEM 44ED-93C9                                             
mmcblk0boot0                                                                                     
mmcblk0boot1                                                                                     


cat /proc/cmdline | tr '\0' '\n'

Code:
BOOT_IMAGE=/vmlinuz-5.15.41-gentoo-x86_64 root=/dev/mapper/vg0-root ro dolvm crypt_root=/dev/sda3


/bin/mount

Code:
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /run type tmpfs (rw,nosuid,nodev,relatime,seclabel,mode=755,inode64)
udev on /dev type devtmpfs (rw,nosuid,relatime,seclabel,size=10240k,nr_inodes=454578,mode=755,inode64)
devpts on /dev/pts type devpts (rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel,inode64)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
/dev/mapper/vg0-root on / type ext4 (rw,relatime,seclabel)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel,size=10240k,mode=755,inode64)
openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,release_agent=/lib/rc/sh/cgroup-release-agent.sh,name=openrc)
none on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate)
cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu)
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct)
blkio on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
memory on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
devices on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
net_cls on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls)
perf_event on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
net_prio on /sys/fs/cgroup/net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio)
hugetlb on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
pids on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
rdma on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,rdma)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime,seclabel)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
/dev/mapper/vg0-var on /var type ext4 (rw,relatime,seclabel)
/dev/mapper/vg0-home on /home type ext4 (rw,relatime,seclabel)
/dev/sdb on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 555
Location: Ásgarðr

PostPosted: Wed Jul 06, 2022 7:21 am    Post subject: Reply with quote

dscharalampidis wrote:
To make sure I am not doing any typos, I removed UUIDs and other parameters and my GRUB command line looks like this:
GRUB_CMDLINE_LINUX="dolvm crypt_root=/dev/sda3"


It seems you're missing the root parameter for the kernel command line.
This should work :

Code:
GRUB_CMDLINE_LINUX="dolvm crypt_root=UUID=a1775cd7-6c53-4e93-977b-0b02879d6986 root=UUID=3cc1c37e-a2e1-44e7-aa87-e12916b66dd7"


Don't forget to regenerate the grub.cfg of course.
Back to top
View user's profile Send private message
dscharalampidis
n00b
n00b


Joined: 07 Dec 2021
Posts: 18

PostPosted: Wed Jul 06, 2022 7:58 am    Post subject: Reply with quote

Hello @sdauth, and thanks for the reply.

The root parameter is added automatically upon configuring GRUB. Please check my BOOT_IMAGE:
Code:
BOOT_IMAGE=/vmlinuz-5.15.41-gentoo-x86_64 root=/dev/mapper/vg0-root ro dolvm crypt_root=/dev/sda3


In any case, I tried your suggestion, and it does not work.
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 555
Location: Ásgarðr

PostPosted: Wed Jul 06, 2022 8:34 am    Post subject: Reply with quote

Are dmcrypt & lvm in boot runlevel ? (If you use openrc : rc-update add dmcrypt boot && rc-update add lvm boot)
Back to top
View user's profile Send private message
dscharalampidis
n00b
n00b


Joined: 07 Dec 2021
Posts: 18

PostPosted: Wed Jul 06, 2022 8:45 am    Post subject: Reply with quote

@sdauth initially I had dmcrypt at boot and lvm at default. I changed lvm to boot as well. I didn't make a difference.
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 555
Location: Ásgarðr

PostPosted: Wed Jul 06, 2022 8:55 am    Post subject: Reply with quote

Alright. Strange. Since when you type manually /dev/sda3, it works; I guess it is initramfs related.. I don't use genkernel though.
Maybe you could share your genkernel.conf. I used it years ago so I don't remember very well.
Honestly, I don't have other suggestion... Hopefully other will. :o
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 887
Location: Richmond Hill, Canada

PostPosted: Wed Jul 06, 2022 2:06 pm    Post subject: Reply with quote

dscharalampidis wrote:
Thanks for the answers!

Unfortunately, the rootdelay didn't really help. I don't think the issue is related to the slow recognition of the device. I tried several values, up to 120 seconds. I must also say that on the same machine, I can boot Archlinux without adding a delay to GRUB.


I am sorry, my mistake, it should be scandelay[=10|or more]. scandelay actually cause /init pause for given number of seconds before start_volumes procedure, scandelay default 3 seconds if not specify =XX.

Thanks for the lsblk output, I don't use LUKS so, I don't know that is how the dm structured.

I was look at wrong place for the prompt_user message so fall in to wrong logical thinking the process already pass the openLUKS logic.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21489

PostPosted: Wed Jul 06, 2022 3:14 pm    Post subject: Reply with quote

sdauth wrote:
Are dmcrypt & lvm in boot runlevel ? (If you use openrc : rc-update add dmcrypt boot && rc-update add lvm boot)
The boot runlevel runs once the root filesystem is mounted, and OP's problem is that the automatic prompt to unlock the root filesystem is not working properly. Since root is not unlocked or mounted, no mistakes there can influence the initramfs. At worst, they might confuse genkernel into generating a bogus initramfs, but I doubt genkernel's init is implemented that way. Even if that did apply, OP would need to regenerate the initramfs after fixing them.
Back to top
View user's profile Send private message
dscharalampidis
n00b
n00b


Joined: 07 Dec 2021
Posts: 18

PostPosted: Wed Jul 06, 2022 10:26 pm    Post subject: [SOLVED] Failed to find LUKS device. Reply with quote

pingtoo wrote:

I am sorry, my mistake, it should be scandelay[=10|or more]. scandelay actually cause /init pause for given number of seconds before start_volumes procedure, scandelay default 3 seconds if not specify =XX.


That was it

The scandelay parameter did the trick.

Thank you all!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum