The "Restore the GRUB Bootloader" in Manjaro wiki needs an update

I just followed the “Restore the GRUB Bootloader” directions on the Manjaro wiki. At first I got an error, “EFI variables are not supported on this system.” I found the solution with Google. It is necessary to run

mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars

before

chroot /mnt

Please update the wiki with this information

2 Likes

I see this in the wiki page though:

1 Like

I booted up livecd in uefi mode
Confirm efivar are supported in livecd and packages efibootmgr, dosfstools, efivar and grub are installed.

[manjaro@manjaro ~]$ sudo ls -ld /sys/firmware/efi
drwxr-xr-x 4 root root 0 Aug 17 15:02 /sys/firmware/efi

Restoring grub without needing chroot using this or this has no issues.

If livecd is booted up in bios-legacy mode, efivar is not supported and packages are not installed. The steps will then be necessary to install for uefi mode.

1 Like

That is much farther down the page from the instructions on how to chroot. That’s why I did not see it.

Also, we could maybe advice to just use manjaro-chroot? Just mount root to /mnt, esp to /boot/efi and run

   manjaro-chroot /mnt

Or if you have a simple setup (no btrfs subvolumes, only one esp present), just use automatic mode:

  manjaro-chroot -a
1 Like

Manjaro-chroot and mhwd-chroot cannot hadle encrypted volumes (at least in my case). For non-encrypted disks, these tools are great. But generally chroot utility is not that difficult to substitute it with smth else, especially when it is required for one-time work.

As for the wiki page, I suggest to add the following line there (into the section listing commands before chroot):

mount -o bind /run /mnt/run

This helps to avoid quite annoying error “failed to connect to lvmetad” when running ‘update-grub’ script.
Also, sometimes the root of a user’s problem is not a ‘broken’ bootloader, so it’s a good idea to check /etc/mkinitcpio.conf hooks and modules for (probable) mess, and regenerate initrd image with mkinitcpio -p linux_414_ (underscored just to highlight my kernel version, yours may be different). This must be done when chrooted, of course, followed by ‘update-grub’ command.

This wiki page is great but a little bit outdated, and the link there pointing to some ‘forum discussion topic’ is broken, so why not edit it to point at least here? Just a suggestion.

2 Likes

They also don’t handle btrfs-subvolumes. In the mounting part that is. If you manually mount your root to /mnt and do

  manjaro-chroot /mnt bash

It works with encryption, lvm and btrfs subvolumes.

2 Likes

You need to decrypt the partition first, then mount and chroot the decrypted device mapper.

sudo cryptsetup open /dev/sdXX cryptroot
sudo mount /dev/mapper/cryptroot
sudo manjaro-chroot /mnt

You can change cryptroot device mapper name to whatever you like, it is just a label.

2 Likes

Thank you guys for your replies. Yeah, for sure I was wrong regarding encryption, just didn’t dig into this case well enough as I had another trouble to shoot.