Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] EFI Stub + custom Initramfs: Attempted to kill Init
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4160
Location: Bavaria

PostPosted: Fri Mar 01, 2024 11:24 pm    Post subject: Reply with quote

P.S.: I have added this chapter yesterday to my article:

https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview#Advanced_rescue_shell

Thanks to @Hu and @sublogic ! :D
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
KZQN7737
n00b
n00b


Joined: 13 Feb 2024
Posts: 27

PostPosted: Sun Mar 03, 2024 9:50 pm    Post subject: Reply with quote

GDH,

Thanks. I've searched for this problem in the Internet at the time when I wrote this and found the same problem on Gentoo forums X] Googling skills +up lvl.

https://forums.gentoo.org/viewtopic-t-1161604-highlight-tmpfs.html

Next time I'd post something I'd make sure that I didn't find it in the Internet not to extend the thread any longer. So I made sure now X].

I had a problem with not having any time after "Enter the passphrase". I was unable to type in the passphrase, because the booting just processed through. But I was able to resolve by adding sleep timing before cryptsetup line.

Then I commented lvchange and vgscan lines, following NeddySeagoon.

The script continues to fail, now on root mounting.

With $findfs (approximate output):
Code:

/etc/fstab: no such file found


With /dev/vg/root
Code:

 /dev/vg/root: Can't lookup blockdev
 /dev/vg/root: Can't lookup blockdev
 /dev/vg/root: Can't lookup blockdev
 /dev/vg/root: Can't lookup blockdev
mounting /dev/vg/root on /mnt/root failed: No such file or directory


and /dev/mapper/vg-root:
Code:

/dev/mapper/vg-root: Can't lookup blockdev
/dev/mapper/vg-root: Can't lookup blockdev
/dev/mapper/vg-root: Can't lookup blockdev
/dev/mapper/vg-root: Can't lookup blockdev
mounting /dev/mapper/vg-root on /mnt/root failed: No such file or directory


Thereafter I attempted to check if the problem is in missing device nodes ("no such file or directory), included vgscan like here:

Quote:

Calling vgscan is optional, but recommended, just in case device nodes are missing.

(C) https://wiki.gentoo.org/wiki/Custom_Initramfs#LVM

And it changed nothing.

I tried verbose output.

Code:

+/sbin/lvm.static vgscan --mknodes -v
Creating directory "/run/lock/lvm"
No volume groups found.
No volume groups found.
+ /sbin/lvm.static lvscan -v:
No volume groups found.
+ /sbin/lvm.static vgchange -ay vg
Volume group "vg" not found


Code:

ls /dev/mapper/
control cryptfs


There's no vg in /dev/ inside of initramfs.
While chrooted volume group vg exists and I have no problem mounting it.

vgscan on chrooted /dev/vg/root fs in gentoo minimal livecd:
Code:

Found volume group "vg" using metadata type lvm2


One of init script variations I've tried, with no verbose options:
https://bpa.st/MN4Q

Please guide me on what's wrong here and why doesn't vgscan inside of initramfs is seeing the vg volume group?
Back to top
View user's profile Send private message
KZQN7737
n00b
n00b


Joined: 13 Feb 2024
Posts: 27

PostPosted: Sun Mar 03, 2024 10:16 pm    Post subject: Reply with quote

Greetings, pietinger

pietinger wrote:

It is very easy ... and you can try it in a simple terminal:

Start "busybox sh" (as root) and you will see a change of your prompt, because you are now IN the shell from busybox itself. Type now "mount". It works ! Because the shell from busybox knows all of its implemented internal commands. You will need these links ONLY if you are in an other shell (like bash) and want start the internal mount-command from busybox INSTEAD the normal mount command. YES, installing all of these busybox links OVERWRITES your normal used applications ... do you want this ?


pietinger wrote:

"$@" is the representation of the transfered parameter.


pietinger wrote:

eq means "equal" ... the same as in some programming languages: "IF A == 5 THEN ..."


...And the whole post.
Brilliant explanations!
Thank you for outlining it out clearly.
:wink:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Mar 03, 2024 10:23 pm    Post subject: Reply with quote

KZQN7737

All I do is
Code:
# Then start LVM, afther all the PVs are available
vgchange -ay


It cannot work until cryptsetup works. That's not something I use.
Its odd that it does not wait for the passphrase though, particularly as you allow retries.
_________________
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
KZQN7737
n00b
n00b


Joined: 13 Feb 2024
Posts: 27

PostPosted: Mon Mar 04, 2024 5:35 pm    Post subject: Reply with quote

I had 2 passphrases: 1 - the actual passphrase, 2 - test passphrase (not to type the actual long passphrase when I'd like to change something in my kernel every time while I adjust it in livecd with the kernel that was initially panicking).

I added the 2nd using cryptsetup luksAddKey.

When I tried to use test passphrase in initramfs, the vgchange was unsuccessful. No difference when I used vgchange separately or in conjunction with vgscan. The result was the same:
Code:

+ sleep 3

[Lines with USB xchi_hcd devices and SCSI activation]
Code:

+ /sbin/cryptsetup --tries 5 luksOpen /dev/nvme0n1p2 cryptfs
Enter passphase for /dev/nvme0n1p2:


[It's enterable only because of sleep 3 line, otherwise it would've processed through with "found new xhci USB device" and would not let me enter] sleep 2 works fine, too.

Code:

[11.890413] cryptsetup (126) used greatest stack depth: 13240 bytes left
+ /sbin/lvm.static vgchange -ay vg
Volume group "vg" not found
Cannot process volume group vg
+ rescue_shell "vgchange failed"


Same result when I write:
Code:

vgchange -ay

Instead of
Code:

vgchange -ay vg


Code:

# exit
+ '[[' 0 -eq 5]]
sh: missing ]]
+ mount -o ro /dev/vg/root /mnt/root
[736.677931] /dev/vg/root: Can't lookup blockdev
[736.679992] /dev/vg/root: Can't lookup blockdev
[736.686060] /dev/vg/root: Can't lookup blockdev
[736.690226] /dev/vg/root: Can't lookup blockdev
mount: mounting /dev/vg/root on /mnt/root failed: No such file or directory
+ rescue_shell 'root mount failed'


Although the actual passphrase worked and my kernel finally booted from initramfs. Hooray.

I would've still very much liked if someone explained to me why the test passphase apparently was not unlocking the encrypted partition and reacted that way instead of expected proper booting or at least acting like it was a wrong passphrase ("wrong passphrase, try again") and if someone could, I'd mark as [SOLVED], I can provide additional data on demand if needed to understand why that's happening.

Any wrong passphrase reacts that way, not only the "test passphrase". So --tries does not work eventually.

What if I'd also liked to change the passphrase in the future?

Nevertheless, thanks a million everyone for the support and guiding me through like a blind kitten! :lol:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Mar 04, 2024 5:50 pm    Post subject: Reply with quote

KZQN7737,

What appears on the console and what you input on the console are two separate things.

The kernel is multitasking by the time it gets to
Code:
/sbin/cryptsetup --tries 5 luksOpen /dev/nvme0n1p2 cryptfs
when it prints
Code:
Enter passphase for /dev/nvme0n1p2:
Other tasks, such as bringing up USB may print to the console. That's OK because they are not listening for user input too.
Ignore those messages.
The prompt
Code:
Enter passphase for /dev/nvme0n1p2:
is still valid and cryptsetup is still waiting for your input.
Don't look at the console when you enter the pass phrase, if it helps.

That's a feature, not a bug.

Its even worse when user input is echoed to the console. The echoed user input is scattered among output from other processes but it still works.
_________________
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
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4160
Location: Bavaria

PostPosted: Mon Mar 04, 2024 8:52 pm    Post subject: Reply with quote

NeddySeagoon wrote:
[...] Other tasks, such as bringing up USB may print to the console. That's OK because they are not listening for user input too.
Ignore those messages.

I recommend to work with (as commands in the init-script):
Code:
# disable kernel messages from popping onto the screen
echo 0 > /proc/sys/kernel/printk

...

# Clean up
echo 1 > /proc/sys/kernel/printk

_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Mar 05, 2024 10:08 am    Post subject: Reply with quote

pietinger,

... once it works :)
_________________
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
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4160
Location: Bavaria

PostPosted: Wed Mar 06, 2024 3:56 pm    Post subject: Reply with quote

KZQN7737,

I have written an "ultimate" :lol: skeleton for an embedded initramfs with file-list:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview#Simple_Skeleton
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
KZQN7737
n00b
n00b


Joined: 13 Feb 2024
Posts: 27

PostPosted: Wed Mar 06, 2024 6:48 pm    Post subject: Reply with quote

NeddySeagoon wrote:

[...] Other tasks, such as bringing up USB may print to the console. That's OK because they are not listening for user input too.
Ignore those messages.
[...]
The prompt
Code:

Enter passphase for /dev/nvme0n1p2:   

is still valid and cryptsetup is still waiting for your input.


Indeed, the password was waiting for the input even after USB and SCSI devices' messages were printed. I got confused by them. :lol:

pietinger wrote:


I recommend to work with (as commands in the init-script):
Code:

# disable kernel messages from popping onto the screen
echo 0 > /proc/sys/kernel/printk

...

# Clean up
echo 1 > /proc/sys/kernel/printk



Will sure try on. Thanks! :P

Solved!
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
Goto page Previous  1, 2, 3
Page 3 of 3

 
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