You are not logged in.

#1 2021-09-06 20:18:15

Bagool
Member
Registered: 2021-01-11
Posts: 7

[SOLVED] Grub cryptodisk not mounting rootfs

Hi,

I'm running encrypted boot and when i start up, grub asks me to enter passphrase to decrypt. When I do I can choose to boot into Arch, after loading initial ramdisk my openswap script fails because it fails to mount /dev/mapper/croot (my root part) and drops me into a shell where no decrypted devices are under /dev/mapper, just /dev/mapper/control. This install usually works, the only difference I can see is that I'm installing everything on /dev/nvme1n1 instead of /dev/sda .
lsblk shows
/dev/sda (shouldn't be here, didn't exist when initially starting the install)
/dev/sdb (archiso)
/dev/nvme1n1
    - /dev/nvme1n1p1 1Gb BIOS BOOT
    - /dev/nvme1n1p2 1Gb EFI SYSTEM fat32
    - /dev/nvme1n1p3 600Gb LINUX FS ext4
    - /dev/nvme1n1p4 64Gb SWAP swap
    - /dev/nvme1n1p5 REST LINUX FS ext4
/dev/nvme0n1 (w10 stuff)

/etc/default/grub
# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet resume=/dev/mapper/cswap"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=19ace206-da6e-42a9-93b7-7df520505be6:croot root=/dev/mapper/croot cryptkey=rootfs:/root/croot.keyfile"

...

GRUB_ENABLE_CRYPTODISK=y

/etc/mkinitcpio.conf

HOOKS=(base udev autodetect modconf block keyboard fsck keymap encrypt openswap resume filesystems)

I can unencrypt boot, which is sus, but then it seems like it doesn't use my root partition since it can't be found and mounted, really scratching my head about this
Also strange is the sudden appearance of a /dev/sda which seemingly shouldn't exist...
any clues?

Edit: This computer boots really slowly for some reason, might be this race condition making things difficult https://wiki.archlinux.org/title/Dm-cry … tcpio_hook
Gonna raise it to 3 minutes just to check
Edit2: Cranked it to 5 mins, still no dice

Last edited by Bagool (2021-09-06 22:11:55)

Offline

#2 2021-09-06 20:47:19

Ammako
Member
Registered: 2021-07-16
Posts: 267

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Bagool wrote:

cryptkey=rootfs:/root/croot.keyfile

By any chance, might you be trying to read the decryption key from within the encrypted partition itself? That's never going to work

https://wiki.archlinux.org/title/Dm-cry … initcpio_6

More specifically, your key needs to be embedded in initramfs, at FILES=() in mkinitcpio.conf

Last edited by Ammako (2021-09-06 20:54:11)

Offline

#3 2021-09-06 20:55:02

Bagool
Member
Registered: 2021-01-11
Posts: 7

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Ammako wrote:
Bagool wrote:

cryptkey=rootfs:/root/croot.keyfile

By any chance, might you be trying to read the decryption key from within the encrypted partition itself? That's never going to work

https://wiki.archlinux.org/title/Dm-cry … initcpio_6

Sorry should have pasted this line from mkinitcpio.conf
FILES=(/root/croot.keyfile)
I can find that file when I'm dropped into the rescue shell, but I can't find /dev/mapper/croot

Offline

#4 2021-09-06 21:12:08

Ammako
Member
Registered: 2021-07-16
Posts: 267

Re: [SOLVED] Grub cryptodisk not mounting rootfs

You mention an openswap script. What is that script?

What do you mean by "my [...] script fails because it fails to mount /dev/mapper/croot"? What is "it" in this scenario? Is your script supposed to handle the unlocking of your root partition? or is it doing something that relies on the root partition being unlocked? What is the script supposed to be doing that isn't working?

Output of # blkid? and # fdisk -l?

and what do you mean by "This install usually works"?

It doesn't really make sense why you're able to boot unencrypted without using the root partition, what do you get when you boot that way?

Offline

#5 2021-09-06 21:21:49

Bagool
Member
Registered: 2021-01-11
Posts: 7

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Sorry I have an install script that i usually run, its pretty huge but it basically does what's in the wiki here:
https://wiki.archlinux.org/title/Dm-cry … ion_(GRUB)

In my edit I linked to this https://wiki.archlinux.org/title/Dm-cry … tcpio_hook that's the script
The script unlocks the swap. that being said i can remove both openswap, resume from mkinitcpio.conf and regen initramfs and then, after unlocking GRUB and choosing to boot into arch it tells me that /dev/mapper/croot doesn't exist and drops me into some kind of resque-terminal that says rootfs and has initcpio hooks and some files in it. Basically it seems to be unable to mount any partition and drops me into a shell with the boot-files only.

both fdisk -l and blkid shows basically the same info as i wrote for lsblk -f, only it does not show /dev/sda, can't screenshot that atm. Correct crypto_LUKS parts for /dev/nvme1...p3, p4, and p5 and the correct UUID found in /etc/default/grub

Ps. The UUID for nvme1n1p3 (croot crypto part) is the one in /etc/default/grub, the UUID for /dev/mapper/croot is in /etc/fstab

Last edited by Bagool (2021-09-06 21:28:29)

Offline

#6 2021-09-06 21:27:35

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Please post your install script.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#7 2021-09-06 21:30:29

Bagool
Member
Registered: 2021-01-11
Posts: 7

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Slithery wrote:

Please post your install script.

Alright https://github.com/MarcusGrass/arch_con … install.sh it was not meant to be readable, just convenient, if you really want to dig the more interesting commands are found here https://github.com/MarcusGrass/arch_con … pt_conf.py

Offline

#8 2021-09-06 22:07:11

Bagool
Member
Registered: 2021-01-11
Posts: 7

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Solved it with this https://www.reddit.com/r/archlinux/comm … e_on_boot/ added (vmd) to modules in mkinitcpio.conf, that's a good 5 hours wasted, hope somebody else finds this
Ps. this occured because im booting from a partition on an nvme disk

Last edited by Bagool (2021-09-06 22:07:29)

Offline

#9 2021-09-06 22:36:19

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Bagool wrote:

Ps. this occured because im booting from a partition on an nvme disk

No, it occurred because you have your motherboard set to RAID mode instead of the recommended AHCI.
It has nothing to do with NVME which usually works just fine.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2021-09-06 22:52:53

Bagool
Member
Registered: 2021-01-11
Posts: 7

Re: [SOLVED] Grub cryptodisk not mounting rootfs

Slithery wrote:
Bagool wrote:

Ps. this occured because im booting from a partition on an nvme disk

No, it occurred because you have your motherboard set to RAID mode instead of the recommended AHCI.
It has nothing to do with NVME which usually works just fine.

Good addition, I didn't know that, seems some configuration was done to the computer before I got it.

Offline

Board footer

Powered by FluxBB