Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dracut failed, droped to shell how to finish 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
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1681

PostPosted: Sun Oct 27, 2024 6:17 am    Post subject: dracut failed, droped to shell how to finish booting? Reply with quote

Greetings Gentooers
I am setting up a new Gentoo system (on bare metal) and usually make a initrd by hand for encrypted root but its been quite a few years and hand rolling was always tedious compiling stuff with static-libs then recompiling without so figured I'd try out Dracut.
This install has a encrypted root inside an LVM logical volume. I know the volume and encrypted root are good because I can mount them from the live USB. And I do realize this is the reverse of the Gentoo way of putting lvm in the encrypted drive, but this is just a router appliance and I digress.
Things have not gone very smoothly with Dracut, at first I assumed dracut would copy over the needed kernel modules but it does not seem to do that.
Also it throws allot of systemd-cryptsetup not found errors even after I configured it
Code:
hostonly="yes"
# Equivalent to -a "module"
add_dracutmodules+=" lvm crypt " # Note leading and trailing spaces
omit_drivers+=" systemd systemd-cryptsetup bluetooth "

After I reconfigured the kernel like I used to with all the Lvm and Crypt stuff BLK_DEV_CRYPTOLOOP CONFIG_DM_CRYPT ... compiled into the kernel (not as modules but compiled in) Dracut was getting closer telling me my /dev/mapper/gentoo_root does not exist.
After somehow dropping to the Dracut rescue shell (which is apparently not busybox?) I can poke around and see something named my /dev/mappter/gentoo_root something slightly different, it prefixed the logical volume name.
So I was finally able to manually unlock my root partition and mount it under /sysroot
Poking around I could see it mounted and my files were there.
I then tried
Code:
exec switch_root /sysroot /sbin/init
with no dice.
I possibly forgot to unmount proc sys and dev
So my question, how to you , finish booting from a Dracut rescue shell?
Should
Code:
exec switch_root /sysroot /sbin/init
work?
Thanks in advance

Docs I have used now and in the past:
https://wiki.gentoo.org/wiki/Dracut
https://wiki.gentoo.org/wiki/Dm-crypt
https://wiki.gentoo.org/wiki/LVM
https://wiki.gentoo.org/wiki/Custom_Initramfs
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3670
Location: Rasi, Finland

PostPosted: Sun Oct 27, 2024 8:53 am    Post subject: Reply with quote

Does the switch_root command give you any errors?
IIRC switch_root won't work unless it was exec'd from PID 1. And in case of busybox, I remember it didn't print any useful information if it failed in such way.
If you exit the rescue shell and you don't get kernel panic, it means it wasn't PID 1, and you cannot switch_root from there. Then you need to set the environment as such that dracut can continue booting (which is a limitation in my opinion).

BTW, if you want, you could try using my cinitramfs, which helps you create your own initramfs image (no static binaries needed necessarily).
It's very much WIP still. It works by reading a list of files, modules, etc from standard input and the outputs a cpio image. It handles most of the dependencies for C programs and modules at least. The extras directory contains example initramfs init script too. But you can write your own.
I'm using cinitramfs on all of my Gentoo setups which all use lvm/device mapper, but no ecryption. But it should work if you include all the commands required to unlock the filesystem.

_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
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