Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
custom initramfs: kernel panic on mount
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
cheddar-cheeze
n00b
n00b


Joined: 02 Feb 2019
Posts: 3

PostPosted: Thu Mar 14, 2019 6:40 pm    Post subject: custom initramfs: kernel panic on mount Reply with quote

At boot my system keeps kernel panicing since the kernel cant mount to the root fs is still encrypted
The initramfs is supposed to promt me to enter my encryption key, but doesnt do so
ive checked grub, it has the correct initrd parameter
ive checked the kernel conf, the kernel has initramfs support enabled


Code:

#!/bin/busybox sh

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

cryptsetup luksOpen --tries 5 --header /dev/sdd1 /dev/sda2 crypto
mount -o ro /dev/mapper/crypto /mnt/root

umount /proc
umount /sys
exec switch_root /mnt/root /sbin/init
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13509

PostPosted: Fri Mar 15, 2019 1:48 am    Post subject: Reply with quote

At the stage where the initramfs should have prompted you, what happens instead? Are you sure the initramfs is actually loaded and used? Have you added output statements to the initramfs and observed that they are printed when they should be? Is sdd1 ready at boot?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Fri Mar 15, 2019 7:45 pm    Post subject: Reply with quote

cheddar-cheeze,

Add the following to your init script.

Right at the top, under the shebang

Code:
rescue_shell() {
    echo "$@"
    echo "Something went wrong. Dropping you to a shell."
# have time to read the message
    /bin/sleep 20
    /bin/busybox --install -s
    exec /bin/sh
}

Now when booting breaks you can have a shell, so you can look around.

Change the cryptsetup line to either work or drop you to the shuell if it fails.
Code:
cryptsetup luksOpen --tries 5 --header /dev/sdd1 /dev/sda2 crypto || rescue_shell "Cryptsetup failed"


Feel free to add the
Code:
|| rescue_shell "Text_Message"
wherever it might be useful.
When it all works, you won't see it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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