Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dracut freezes while booting
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
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Sat Oct 22, 2022 5:34 pm    Post subject: Dracut freezes while booting Reply with quote

Hello, Gentoo community.
It is not my first time in Gentoo, but first time on forums. I have run into trouble with such type of installation: root on BTRFS on LUKS encrypted with key file, which is symmetrically encrypted using gpg. The key file resides on EFI partiton located on USB drive. Kernel and initramfs are also there. Kernel config is here and my /etc/dracut.conf.d/main.conf is here.

The problem itself: nothing happens after kernel printed some logs in the console. Blinking cursor disappears from screen. No kernel panic displayed or some sort of error.
I have not managed to configure boot loader yet, so I kexec from the host system with these commands:
Code:
kexec -l <mount point of flash drive>/vmlinuz-5.19.10-xanmod1 --initrd=<mount point of flash drive>/initramfs-5.19.10-xanmod1.img
systemctl kexec

Any help would be highly appreciated.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Sun Oct 23, 2022 12:05 pm    Post subject: Reply with quote

Welcome to Gentoo Forums!

Is this efistub or grub?
Plz post
Code:
 
lsblk -f
cat /etc/default/grub
cat /etc/crypttab
efibootmgr
ls -R /boot

Quote:

I have not managed to configure boot loader yet

So you are using efistub.
Please post the efibootmgr invocation you used for creating the entry.
Quote:

add_dracutmodules+=" base btrfs crypt crypt-gpg "
filesystems+=" btrfs vfat "

Comment out these lines.Just let dracut do its job.
You can use omit_dracutmodules if you wish.
_________________
:)
Back to top
View user's profile Send private message
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Mon Oct 24, 2022 10:40 am    Post subject: Reply with quote

Thank you very much for your reply. Here is the info you asked:
lsblk -f
Code:
NAME       FSTYPE      FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                   
├─sda1     vfat                    C750-370D                                           
├─sda2     btrfs                   9f0c4e57-5e96-46b7-aa40-161de70e184a  304,2G    12% /etc/resolv.conf
└─sda3     crypto_LUKS             a8abaf30-6a47-4e4d-9dac-b414a05ab517               
  └─rootfs btrfs                   e380058b-4c14-4b7d-b957-08fbc869e9e8  112,4G     3% /home
                                                                                       /
sdb                                                                                   
├─sdb1     vfat                    8BA3-5AD4                              14,4G     0% /boot
└─sdb2     exfat                   9403-B396                                           
sr0

cat /etc/crypttab
Code:
luks UUID=a8abaf30-6a47-4e4d-9dac-b414a05ab517 /boot/keyfile.gpg

ls -R /boot
Code:
/boot:
config-5.19.10-xanmod1      EFI                            keyfile.gpg                 System.map-5.19.10-xanmod1.old  vmlinuz-5.19.10-xanmod1.old
config-5.19.10-xanmod1.old  initramfs-5.19.10-xanmod1.img  System.map-5.19.10-xanmod1  vmlinuz-5.19.10-xanmod1

/boot/EFI:
Linux

/boot/EFI/Linux:

I did not installed ANY bootloader yet. I am currently using kexec via commands above and, when my Gentoo installation works properly, I will install or reconfigure existing bootloader.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Mon Oct 24, 2022 5:16 pm    Post subject: Reply with quote

Quote:

luks UUID=a8abaf30-6a47-4e4d-9dac-b414a05ab517 /boot/keyfile.gpg


plz change it to
Code:

rootfs UUID=a8abaf30-6a47-4e4d-9dac-b414a05ab517 /boot/keyfile.gpg initramfs



You have 2 efi partitions.
Do you need them?
Please either install grub or use efistub.
How can you expect to boot without a bootloader or without efistub?
Also this
Code:

├─sda2     btrfs                   9f0c4e57-5e96-46b7-aa40-161de70e184a  304,2G    12% /etc/resolv.conf


seems odd...
_________________
:)


Last edited by alamahant on Mon Oct 24, 2022 5:43 pm; edited 2 times in total
Back to top
View user's profile Send private message
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Tue Oct 25, 2022 5:09 pm    Post subject: Reply with quote

Changed /etc/crypttab as you suggested. My /etc/default/grub:
Code:
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
#     'grub-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.

GRUB_DISTRIBUTOR="Gentoo"

# Default menu entry
#GRUB_DEFAULT=0

# Boot the default entry this many seconds after the menu is displayed
#GRUB_TIMEOUT=5
#GRUB_TIMEOUT_STYLE=menu

# Append parameters to the linux kernel command line
GRUB_CMDLINE_LINUX="ro cryptdevice=/dev/sda3:rootfs rd.luks.key=/keyfile.gpg:/dev/sdb1 root=/dev/mapper/rootfs rootfstype=btrfs rootflags=subvol=@"
#
# Examples:
#
# Boot with network interface renaming disabled
# GRUB_CMDLINE_LINUX="net.ifnames=0"
#
# Boot with systemd instead of sysvinit (openrc)
# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

# Append parameters to the linux kernel command line for non-recovery entries
#GRUB_CMDLINE_LINUX_DEFAULT=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.
# You can see them in real GRUB with the command `vbeinfo'.
#GRUB_GFXMODE=640x480

# Set to 'text' to force the Linux kernel to boot in normal text
# mode, 'keep' to preserve the graphics mode set using
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
# graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence.
#GRUB_GFXPAYLOAD_LINUX=

# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

# Background image used on graphical terminal.
# Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true

# Uncomment to disable generation of the submenu and put all choices on
# the top-level menu.
# Besides the visual affect of no sub menu, this makes navigation of the
# menu easier for a user who can't see the screen.
#GRUB_DISABLE_SUBMENU=y

# Uncomment to play a tone when the main menu is displayed.
# This is useful, for example, to allow users who can't see the screen
# to know when they can make a choice on the menu.
#GRUB_INIT_TUNE="60 800 1"

It stops at probing my pendrive for the key file. My first EFI partition is for my host system, which I installed Gentoo from.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Tue Oct 25, 2022 9:14 pm    Post subject: Reply with quote

Try
Code:

GRUB_CMDLINE_LINUX="cryptdevice=UUID=a8abaf30-6a47-4e4d-9dac-b414a05ab517:rootfs rd.luks.key=/keyfile.gpg:UUID=8BA3-5AD4 root=/dev/mapper/rootfs rootfstype=btrfs rootflags=subvol=@"


Comment out the cmdline and modules stuff in dracut.conf.
Plz re-edit your crypttab
Code:

rootfs UUID=a8abaf30-6a47-4e4d-9dac-b414a05ab517  /dev/disk/by-uuid/8BA3-5AD4:/keyfile.gpg luks,initramfs,discard


Sorry about that.
My error.

Rebuild initramfs,update grub enable dmcrypt@boot and reboot
_________________
:)
Back to top
View user's profile Send private message
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Wed Oct 26, 2022 9:26 am    Post subject: Reply with quote

Tried that, but it does not help. Dracut finds the keyfile, but still does not boot, but kernel started to mirror characters I enter on keyboard and also respond to SysRq hotkeys. The two things I changed are the removal of discard option in /etc/crypttab, because I do not have SSD and I also manually added the crypt-gpg module in dracut configuration, beacuse, according to the logs, it does not include it automatically.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Wed Oct 26, 2022 4:44 pm    Post subject: Reply with quote

Can you post a pic of your booting?
What is the error now?
Plz use the binary kernel and make sure dmcrypt is enabled @boot
Also plz check if you can boot by providing a luks password.
You will have to update crypttab and /etc/default/grub.
Also plz add "rootwait" kernel parameter.
_________________
:)
Back to top
View user's profile Send private message
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Thu Oct 27, 2022 8:20 pm    Post subject: Reply with quote

The boot log is here. If I leave it in this state for a minute or two, dracut starts scanning all devices for Btrfs endlessly. Binary kernel does the same. rootwait kernel parameter does not help, dm@boot present.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Thu Oct 27, 2022 9:08 pm    Post subject: Reply with quote

Plz remove the luks key clauses from /etc/default/grub and crypttab,add a luks password rebuild dracut update grub and see if you can boot by prompted password.
I see
Code:

└─sda3     crypto_LUKS             a8abaf30-6a47-4e4d-9dac-b414a05ab517               
  └─rootfs btrfs                   e380058b-4c14-4b7d-b957-08fbc869e9e8  112,4G     3% /home
                                                                                       /

I guess maybe btrfs subvolume issue?
_________________
:)
Back to top
View user's profile Send private message
stillar
n00b
n00b


Joined: 22 Oct 2022
Posts: 6

PostPosted: Thu Oct 27, 2022 9:24 pm    Post subject: Reply with quote

Sorry, I forgot to mention that I already tried that exactly as you explained, but result is the same. Even on a binary kernel.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3916

PostPosted: Thu Oct 27, 2022 9:31 pm    Post subject: Reply with quote

Normally dracut should dump you to a dracut shell if it cant mount /
Does this happen?
Plz allow dracut to act freely without adding or removing any features when invoking it.
Especially modules and filesystems and command line arguments.
Let it discover what is needed by itself.
If it is bootable, dracut will boot it.
_________________
:)
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