this post was submitted on 27 Jul 2024
24 points (100.0% liked)

Linux 101 stuff. Questions are encouraged, noobs are welcome!

1023 readers
2 users here now

Linux introductions, tips and tutorials. Questions are encouraged. Any distro, any platform! Explicitly noob-friendly.

founded 1 year ago
MODERATORS
 

Well, wasn't expecting this...

I rebooted my laptop, and it keeps booting to the grub shell.

I was going to arch-chroot into it and update grub, and rebuild intarimfs, however, I guess I don't know how to with BTRFS subvolumes that are LUKS encrypted.

I would appreciate any help, and am willing to learn.

I could even jump on a call of some kind if anyone has time to help...


Arch

BTRFS encrypted with LUKS (No LVM)

GRUB


I live booted into the live usb

cryptsetup luksOpen /dev/nvme0n1p2 arch
mount /dev/mapper/arch /mnt
arch-chroot /mnt

Output:

mount: /mnt/proc: mount point does not exist
dmesg(1) may have more information after failed mount system call.
=> ERROR: failed to setup chroot /mnt

So I browsed /mnt and it lists subvolumes. However, I am not sure how to go about arch-chrooting into this.

top 8 comments
sorted by: hot top controversial new old
[–] Hellmo_Luciferrari@lemm.ee 10 points 1 month ago (2 children)

I cannot take credit for finding the solution. Someone on a discord chat I found was able to help me. The fix:

1 Open a terminal:

Unlock the LUKS partition:

cryptsetup luksOpen /dev/nvme0n1p2 arch

2 Mount the BTRFS filesystem: Since BTRFS has subvolumes, you need to mount the correct subvolume:

mount -o subvol=@ /dev/mapper/arch /mnt

3 Mount the necessary virtual filesystems:


mount --types proc /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev

4 Bind the boot partition (if separate): If you have a separate boot partition, you need to mount it too:

mount /dev/nvme0n1p1 /mnt/boot

5 Chroot into your system:

arch-chroot /mnt

6 Fix your fstab: Ensure that your /etc/fstab file inside the chroot environment is correctly set up. You might need to generate a new one using genfstab:

genfstab -U /mnt >> /mnt/etc/fstab

7 Update GRUB: Reinstall and update GRUB to ensure it is correctly installed:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Exit the chroot environment:

exit

Unmount all the filesystems:

bash

umount -R /mnt
cryptsetup luksClose arch

8 Reboot:

reboot
[–] kitnaht@lemmy.world 6 points 1 month ago (1 children)

Hell yeah dude. Props for the solution! We need more things like this for search engines to index so that less people rely on centralized places like Reddit.

[–] Hellmo_Luciferrari@lemm.ee 2 points 1 month ago

I am fully with you!

Thank you! Wish I was the one who figured it out. I am just sharing what was taught to me!

That is exactly the reason I joined Lemmy, to ditch centralization.

[–] Rooki@lemmy.world 4 points 1 month ago (1 children)

Thanks for sharing the solution!

[–] Hellmo_Luciferrari@lemm.ee 5 points 1 month ago

I will always try to share the solutions, even if I find them elsewhere. Changes are it could help someone else out!

[–] bsergay@discuss.online 1 points 1 month ago (1 children)

Thanks for sharing the solution! Though, I wonder... What caused this issue in the first place?

[–] Hellmo_Luciferrari@lemm.ee 1 points 1 month ago (1 children)

That's what I want to know. I don't know where to begin looking?

[–] bsergay@discuss.online 2 points 1 month ago

Unfortunately, neither do I. I hope this will be the last time you'll have to face this issue.