TommyTran732 / Arch-Setup-Script

Setting up Arch Linux with BTRFS, snapshots and full disk encryption including /boot (UEFI only)
Apache License 2.0
45 stars 38 forks source link

Dropped to emergency shell after reboot #26

Closed 5ouls3dge closed 5 months ago

5ouls3dge commented 9 months ago

Describe the bug Waiting 10 seconds for device /dev/mapper/cryptroot ... ERROR: device '/dev/mapper/cryptroot' not found. Skipping fsck. :: mounting 'dev/mapper/cryptroot' on real root mount:/new_root: no valid filesystem type specified. ERROR: Failed to mount '/dev/mapper/cryptroot' on real root

To Reproduce Steps to reproduce the behavior: install server.sh reboot after the script runs. no additional steps done. straight reboot

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

mihneaCR commented 9 months ago

I am experiencing this exact issue also. The UUID is correct (I've checked). Manually referencing the drive in /etc/default/grub yields the same result (Only one nvme connected for the installation, so the mapping could not have changed). Not quite sure what the error is, will update if I find anything.

5ouls3dge commented 9 months ago

Wow thank you, thought i was alone, rewritting the script to find it. what do you think of this line. No system to test code if you have a vm see if it makes a difference?

`# Formatting the LUKS Container as BTRFS. echo "Formatting the LUKS container as BTRFS." mkfs.btrfs $BTRFS &>/dev/null

this line:

mount -o clear_cache,nospace_cache $BTRFS $MOUNT_POINT

Change to (Create and set COW on the Btrfs subvolumes)

mount -t btrfs $BTRFS $MOUNT_POINT `

The code is well written. hard to find bug. i have created a version that removes the crypt file part to see if it resolves it. to see if it is isolated around that setup.

mihneaCR commented 9 months ago

I don't think that this will change anything, the error stems from grub (I think) not being able to find /dev/mapper/cryptroot, which occurs one step prior to the mount call. /dev/mapper/cryptroot is the device then being mounted by the call you mention, it does not appear in the emergency shell, thus indicating a problem with the encryption. You can try though, and let me know whether this changed anything. From when I've used btrfs, specifying the filesystem wasn't necessary

5ouls3dge commented 9 months ago

maybe this: https://bbs.archlinux.org/viewtopic.php?id=250585

5ouls3dge commented 9 months ago

@TommyTran732 does the script work for you? Any ideas on this?

funk-on-code commented 5 months ago

In case it's relevant, I fixed this by changing the HOOKS line on line 236 from:

sed -i 's,modconf block filesystems keyboard,keyboard modconf block encrypt filesystems,g' /mnt/etc/mkinitcpio.conf

to:

sed -i 's,HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck),HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems fsck),g' /mnt/etc/mkinitcpio.conf

The syntax for modconf changed in the most recent few updates, so after much trial-and-error, quoting the entire line worked the most reliably, works in ISOs 202404 and above.