Skip to content

Instantly share code, notes, and snippets.

@greginvm
Last active November 10, 2022 03:46
Show Gist options
  • Save greginvm/af68bef3c81a9594a80d to your computer and use it in GitHub Desktop.
Save greginvm/af68bef3c81a9594a80d to your computer and use it in GitHub Desktop.
Restore GRUB in UEFI + LVM + LUKS setup (Manjaro)
Setup: UEFI, LVM + LUKS encrypted drive
Bootloader: Grub
Links:
- https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader
-
Restore GRUB (boot into live env):
# get the encrypted partition (crypto_LUKS)
lsblk -f
cryptsetup open --type luks /dev/sda2 lvm
mount /dev/mapper/cryptVG-root /mnt
mount /dev/sda1 /mnt/boot # boot partition
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts/
modprobe efivarfs
chroot /mnt
# I get the "EFI variables are not supported on this system." so do this:
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
pacman -S mtools os-prober # probably not needed
# set use_lvmetad = 0 in /etc/lvm/lvm.conf
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro_grub --recheck
update-grub
# set use_lvmetad to previous value in /etc/lvm/lvm.conf
REBOOT and should work
Note: If initial ramdisk env needs to be updated and boot is unsuccessful do this:
- chroot like here but don't mount the boot partition
- make sure use_lvmetad is set correctly
mkinitcpio -p linux41
@codeliger
Copy link

You saved me an hour or more. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment