Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kernel panic with encrypted disk
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Fri Aug 13, 2021 5:12 pm    Post subject: Reply with quote

http://0x0.st/-JUY.log

output of ls -R /boot above.

there were files in /boot before i mounted /dev/sda2 which i deleted earlier today.
just rebooted and its (almost working!) it seems to freeze after seeing my sdc removable device
Back to top
View user's profile Send private message
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Fri Aug 13, 2021 5:14 pm    Post subject: Reply with quote

frddbbbl wrote:
http://0x0.st/-JUY.log

output of ls -R /boot above.

there were files in /boot before i mounted /dev/sda2 which i deleted earlier today.
just rebooted and its (almost working!) it seems to freeze after seeing my sdc removable device

it then spits out 67.864565 random: cringe init done
4 urandom warnings missed due to retaliating
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Fri Aug 13, 2021 5:38 pm    Post subject: Reply with quote

Ah ok I though this was an uefi boot.
So plz modify your /boot entry in fstab to reflect your non uefi setup.
Did you see the binary kernel 5-10-52 in grub menu when booting?
Did it ask you for the luks password?
NO because you do NOT have a grub.cfg in /boot
you only have a

Code:

libreboot_grub.cfg

What kind of setup do you have?
Plz do NOT use exotic setups UNTIL you are first able to boot with plain grub.
Quote:

I am also using libreboot as my bios.

plz DONT.your setup is enough complicated as it is without adding an extra layer of complexity.
_________________
:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Fri Aug 13, 2021 6:37 pm    Post subject: Reply with quote

frddbbbl,

The are two places on your system called boot.
One is the boot directory on the root filesystem written as /boot.
The other is the boot partition, mounted at /boot when you want to use it.

Its not an error to put things into /boot when the boot partition is not mounted but grub won't see them.
Grub has to make its own arrangements to read the HDD, as the kernel is not loaded and the filesystem tree does not exist when it runs.

Looking at your ls -R /boot.
Code:
/boot/lost+found:
Good. only the top level directory of a partition has a lost+found

Code:
/boot:
config-5.10.27-gentoo
config-5.10.52-gentoo-dist
grub
initramfs-5.10.52-gentoo-dist.img
lost+found
System.map-5.10.27-gentoo
System.map-5.10.52-gentoo-dist
vmlinuz-5.10.27-gentoo
vmlinuz-5.10.52-gentoo-dist

Your vmlinuz-5.10.27-gentoo cannot boot. It has no matching initramfs. Be careful not to choose it from the from menu.

If grub displays its menu, I don't understand how as you have no /boot/grub/grub.cfg but somehow a kernel gets loaded and fails to mount root.

Are you actually using grub or do you have an EFI stub kernel booting directly from the firmware?
_________________
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
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Fri Aug 13, 2021 11:09 pm    Post subject: Reply with quote

NeddySeagoon wrote:
frddbbbl,

The are two places on your system called boot.
One is the boot directory on the root filesystem written as /boot.
The other is the boot partition, mounted at /boot when you want to use it.

Its not an error to put things into /boot when the boot partition is not mounted but grub won't see them.
Grub has to make its own arrangements to read the HDD, as the kernel is not loaded and the filesystem tree does not exist when it runs.

Looking at your ls -R /boot.
Code:
/boot/lost+found:
Good. only the top level directory of a partition has a lost+found

Code:
/boot:
config-5.10.27-gentoo
config-5.10.52-gentoo-dist
grub
initramfs-5.10.52-gentoo-dist.img
lost+found
System.map-5.10.27-gentoo
System.map-5.10.52-gentoo-dist
vmlinuz-5.10.27-gentoo
vmlinuz-5.10.52-gentoo-dist

Your vmlinuz-5.10.27-gentoo cannot boot. It has no matching initramfs. Be careful not to choose it from the from menu.

If grub displays its menu, I don't understand how as you have no /boot/grub/grub.cfg but somehow a kernel gets loaded and fails to mount root.

Are you actually using grub or do you have an EFI stub kernel booting directly from the firmware?

To try and answer both of the questions that you both have asked, i cannot not NOT use libreboot as that is what my laptop had as its bios when i bought it. i am booting from 5.10.52, 5.10.27 does not have an initramfs as it is the kernel i configured and used before i started this post, but i am now booting from 5.10.52. I believe i am using grub as that is what i configured when i first installed gentoo, i have always used grub as the boot loader as i believe my x200 does not support uefi. to continue the error message i mentioned in my last post, after the crng init done and d4 random warning... the kernel says:
Code:

[    204.386164]dracut warning:could not boot
dracut warning: could not boot

[    204.403588]dracut warning: /dev/mapper/vg0-root does not exist

generating "run/initramfs/rdspreport.txt"

and then talks about where i should save the bug report and drops me into the debug shell. I am very sorry for how confusing my setup is.... I was under the impression that libreboot_grub.cfg was the same thing as grub.cfg but just named differently so the libretto bios recognises it? when i first installed gentoo i had issues starting it until i grub-mkconfig -o /boot/grub/libreboot_grub.cfg as libreboot did not recognise grub.cfg. Sorry if i am wrong. I also just want to thank you guys for all your help so far.
Cheers,
Freddie


Last edited by frddbbbl on Fri Aug 13, 2021 11:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Aug 14, 2021 12:45 pm    Post subject: Reply with quote

frddbbbl,

Code:
[    204.403588]dracut warning: /dev/mapper/vg0-root does not exist


Tells that either the LUKS unlock step or the lvm starting failed, or maybe both.
As its into the initrd init script by that time, or should be, any failures should offer you a shell.
Does that happen?
If not, I suspect that the initrd is not being used.

Once you can get into the shell after a boot failure, you can have a look round to see what's missing and determine where it failed.

e.g. Does /dev/mapper/ exist and what does it contain?
What does
Code:
vgchange -ay
say.?
It tries to start all the logical volumes. If the decrypt step failed, it will fail too.
Can you give the decpypt command by hand?
I don't know it as I don't use it.

The
Code:
crng init done
message is the kernel doing things in other threads. Its expected.
_________________
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
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Sat Aug 14, 2021 5:32 pm    Post subject: Reply with quote

NeddySeagoon wrote:
frddbbbl,

Code:
[    204.403588]dracut warning: /dev/mapper/vg0-root does not exist


Tells that either the LUKS unlock step or the lvm starting failed, or maybe both.
As its into the initrd init script by that time, or should be, any failures should offer you a shell.
Does that happen?
If not, I suspect that the initrd is not being used.

Once you can get into the shell after a boot failure, you can have a look round to see what's missing and determine where it failed.

e.g. Does /dev/mapper/ exist and what does it contain?
What does
Code:
vgchange -ay
say.?
It tries to start all the logical volumes. If the decrypt step failed, it will fail too.
Can you give the decpypt command by hand?
I don't know it as I don't use it.

The
Code:
crng init done
message is the kernel doing things in other threads. Its expected.


after the warning ends i end up in a dracut shell. i am in the initrd i imagine? vgchange -ay isn't an option from the shell, it is very limited. I was however able to manually unlock the drive from the shell with cryptSetup luksOpen lvm, does this mean it is likely a configuration problem as it was looking for /dev/mapper/vg0-root before it has been able to unlock the partition?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Sat Aug 14, 2021 5:50 pm    Post subject: Reply with quote

Quote:

I was however able to manually unlock the drive from the shell with cryptSetup luksOpen lvm, does this mean it is likely a configuration problem as it was looking for /dev/mapper/vg0-root before it has been able to unlock the partition?

if you unlocked it you are good to go.
Just type exit or ctrl+D or ctrl+X to resume booting and see if you boot.
The moment of truth!
Is your grub the Gentoo grub or libretool provided?
Did you add
Code:

GRUB_PRELOAD_MODULES="luks lvm"

in /etc/default/grub?
Did you enable dmcrypt and lvm services?
Also maybe create an entry in /etc/crypttab like this
Code:

echo "lvm   /dev/sda4" >> /etc/crypttab

Better if you replace /dev/sda4 with /dev/disk/by-partuuid/<PARTUUID-of-/dev/sda4>
Perhaps dracut needs it.
:)
_________________
:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Aug 14, 2021 8:18 pm    Post subject: Reply with quote

alamahant,

/dev/disk/by-* is a set of udev created symbolic links.
The may not have been created when you try to use them in early boot. They may not be in the initrd ever.

frddbbbl,

Code:
/sbin/vgchange -ay
has to work but the volume group header is inside the LUKS container, so is encrypted until the container is unlocked.

vgchange is not a shell command. Its a user space tool that is included in the initrd.
If vgchange fails, its because the LUKS container is not yet unlocked.
Its OK for it to fail, for you to unlock the container, then for it to work.
That demonstrates that the step that fails is the unlocking the container.
_________________
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
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Mon Aug 16, 2021 1:19 pm    Post subject: Reply with quote

alamahant wrote:
Quote:

I was however able to manually unlock the drive from the shell with cryptSetup luksOpen lvm, does this mean it is likely a configuration problem as it was looking for /dev/mapper/vg0-root before it has been able to unlock the partition?

if you unlocked it you are good to go.
Just type exit or ctrl+D or ctrl+X to resume booting and see if you boot.
The moment of truth!
Is your grub the Gentoo grub or libretool provided?
Did you add
Code:

GRUB_PRELOAD_MODULES="luks lvm"

in /etc/default/grub?
Did you enable dmcrypt and lvm services?
Also maybe create an entry in /etc/crypttab like this
Code:

echo "lvm   /dev/sda4" >> /etc/crypttab

Better if you replace /dev/sda4 with /dev/disk/by-partuuid/<PARTUUID-of-/dev/sda4>
Perhaps dracut needs it.
:)


Fist time actually booting not from a liveUSB this week! thanks so much guys. I did not haveGRUB_PRELOAD_MODULES="luks lvm" in my config it has been added now and will test on reboot. There isn't a crypttab in /etc/ ? dmcrypyt and lvm servies are enabled.
The one other question i have is how easy it would be to swich back to my user configured kernel? obviously i would prefer this over using the binary kernel but i'm not sure if there were a lot of settings i missed when i tried to configure it last time? i enabled all the flags the wiki said dmcrypt and lvm required.
Also before i wrote this post i was following the wiki, which seemed to have a few missing bits, maybe i could go through and add them or possibly also link to this post as an external resource?
my grub is the normal grub, libreboot is simply an opensource replacement for the firmware bios supplied with the computer (i think)
Cheers,
Freddie
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Aug 16, 2021 2:28 pm    Post subject: Reply with quote

frddbbbl,

Booting with root on an encrypted volume requires two things.
1. Kernel support
2. An initrd with the user space tools required to make the real root filesystem available.

You need both pieces.

When you use dracut or genkernel to do the builds, the distinction between what is kernel and what is initrd gets a bit blurred.
That's because the build tools make a fully modular kernel and put the modules into the initrd, so the two have to be updated together.

It need not be that that way. All the kernel options needed to boot can be built into the kernel.
The initrd then only needs to contain user space tools. No bits of kernel.

My root is in LVM on raid5, no encryption, but it still needs an initrd for the same reason your install does.
I made my initrd in 2009, when the system was new. As it does not contain any kernel bits, there is no need to updalt it.

That's a long winded way of saying yes but ...
You can build your own kernel and your own initrd and leave all the black magic behind.
You can still have kernel modules but they won't be loaded until after root is mounted.

For completeness, you can also make your own kernel and have the tools make just the initrd.
I'm not sure if you can keep the kernel modules out of the initrd that way.
_________________
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
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Mon Aug 16, 2021 4:02 pm    Post subject: Reply with quote

Quote:

my grub is the normal grub, libreboot is simply an opensource replacement for the firmware bios supplied with the computer (i think)

Ok perfect.Just to err on the side of caution you can
Code:

USE="device-mapper" emerge -1av grub

If it helps plz make it permanent via package.use
Quote:

dmcrypyt and lvm servies are enabled.

in boot runlevel?
_________________
:)
Back to top
View user's profile Send private message
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Tue Aug 17, 2021 10:31 am    Post subject: Reply with quote

alamahant wrote:
Quote:

my grub is the normal grub, libreboot is simply an opensource replacement for the firmware bios supplied with the computer (i think)

Ok perfect.Just to err on the side of caution you can
Code:

USE="device-mapper" emerge -1av grub

If it helps plz make it permanent via package.use
Quote:

dmcrypyt and lvm servies are enabled.

in boot runlevel?


Thanks for double checking with me! dmcrypt wasn't added at boot level, i have a massive update emerging at the moment, when it's finished i will update grub like you said and config it and restart.
Cheers,
Freddie
Back to top
View user's profile Send private message
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Mon Sep 13, 2021 8:05 pm    Post subject: Reply with quote

I still have the issue of having to manually open it through the dracut shell. Not really an issue to be honest though. The initramfs takes a very long time to load and my laptop has felt a fair bit slower since i changed to the binary kernel, it is very old. I was wondering how i can make sure i have all the correct modules built into my custom kernel will it just be the ones mentioned on the wiki pages for initramfs, lvm and dmcrypt? on the wiki it seems that i can also make a dracut initramfs without modules, would this work fine? if not should i try a different method of making one? thanks for all the help so far, it has been incredibly usefull.
Cheers,
Freddie
Back to top
View user's profile Send private message
frddbbbl
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2019
Posts: 98

PostPosted: Sun Sep 19, 2021 4:10 pm    Post subject: Reply with quote

are there any guides that might be helpfull?
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
Goto page Previous  1, 2
Page 2 of 2

 
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