Rebooting after update causes "grub_calloc" error. Trying to restore grub on encrypted system - luks & EFI

Hi all. I’ve been working on this for 3 days now and getting nowhere. I’ve been pointed in the direction of the wiki to the grub restore page and to this link about chroot-ing into an encrypted partition. I’ve also scoured the web and found some other things I found. I came up with a game plan and it didn’t work. Below is that plan in three sections: 1. my system structure. 2. my command attack list I cobbled together from multiple sources. And 3. my terminal session including errors. I’m sure I’m making some rookie mistake somewhere, but I can’t see it. Hopefully one of you kind souls can help me out.

SECTION 1

[manjaro@manjaro ~]$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0
squash 4.0 0 100% /run/miso/
loop1
squash 4.0 0 100% /run/miso/
loop2
squash 4.0 0 100% /run/miso/
loop3
squash 4.0 0 100% /run/miso/
sda
├─sda1
│ vfat FAT32
├─sda2
│ crypto 1
└─sda3
crypto 1
sdb iso966 Jolie MANJARO_XFCE_2003
│ 2020-06-06-07-11-25-00
├─sdb1
│ iso966 Jolie MANJARO_XFCE_2003
│ 2020-06-06-07-11-25-00 0 100% /run/miso/
└─sdb2
vfat FAT12 MISO_EFI
08E4-9928
sr0

SECTION 2

su

cryptsetup open --type luks /dev/sda2 crypto

mount /dev/mapper/crypto /mnt

mount /dev/sda1 /mnt/boot

cd /mnt

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/

chroot /mnt

sudo mount /dev/sda1 /boot/efi

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

FAIL EFI variables are not supported on this system.

exit

sudo modprobe efivarfs

chroot /mnt

mount -t efivarfs efivarfs /sys/firmware/efi/efivars

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

sudo update-grub

SECTION 3

[manjaro@manjaro ~]$ su

[manjaro manjaro]# cryptsetup open --type luks /dev/sda2 crypto

Enter passphrase for /dev/sda2:

[manjaro manjaro]# mount /dev/mapper/crypto /mnt

[manjaro manjaro]# mount /dev/sda1 /mnt/boot

[manjaro manjaro]# cd /mnt

[manjaro mnt]# mount -t proc proc /mnt/proc

[manjaro mnt]# mount -t sysfs /mnt/sys

mount: /mnt/sys: can’t find in /etc/fstab.

[manjaro mnt]# mount -t sysfs sys /mnt/sys

[manjaro mnt]# mount -o bind /dev /mnt/dev

[manjaro mnt]# mount -t devpts pts /mnt/dev/pts/

[manjaro mnt]# chroot /mnt

[manjaro /]# sudo mount /dev/sda1 /boot/efi

[manjaro /]# sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

Installing for x86_64-efi platform.

EFI variables are not supported on this system.

EFI variables are not supported on this system.

grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.

[manjaro /]# exit

exit

[manjaro mnt]# sudo modprobe efivarfs

[manjaro mnt]# chroot /mnt

[manjaro /]# mount -t efivarfs efivarfs /sys/firmware/efi/efivars

[manjaro /]# sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

Installing for x86_64-efi platform.

Installation finished. No error reported.

[manjaro /]# sudo update-grub

Generating grub configuration file …

Found theme: /usr/share/grub/themes/manjaro/theme.txt

grub-probe: error: cannot find a GRUB drive for /dev/sdb1. Check your device.map.

grub-probe: error: cannot find a GRUB drive for /dev/sdb1. Check your device.map.

Adding boot menu entry for UEFI Firmware Settings …

done

[manjaro /]# exit

[manjaro mnt]#

Thanks for taking the time to look this over, and for patience. :slight_smile:

see this topic

also before going in chroot check
in terminal

inxi -Mxxxa
test -d /sys/firmware/efi && echo efi || echo bios
sudo parted -l 
sudo efibootmgr -v

@stephane

That was one of the things I saw before my original post. I didn’t see anything that worked for me. My password is on the standard EN keyboard that Manjaro installs with.

I input the commands you suggested before chroot. Here is the return:

[manjaro mnt]# inxi -Mxxxa
Machine:
Type: Laptop System: Hewlett-Packard product: HP ENVY 17 Notebook PC
v: 0884100000305B00000630000 serial: 5CG32919MY Chassis: type: 10
serial: N/A
Mobo: Hewlett-Packard model: 1966 v: KBC Version 93.52
serial: PDNTR00WD4Y0LO UEFI: Insyde v: F.69 date: 03/06/2017
[manjaro mnt]# test -d /sys/firmware/efi && echo efi || echo bios
efi
[manjaro mnt]# sudo parted -l
Model: ATA ST1000LM014-1EJ1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 2097kB 317MB 315MB fat32 boot, esp
2 317MB 982GB 981GB
3 982GB 1000GB 18.4GB

Model: SMI (scsi)
Disk /dev/sdb: 31.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
2 2839MB 2843MB 4194kB primary esp

[manjaro mnt]# sudo efibootmgr -v
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 2001,0001,3001,2002,2003
Boot0000* Notebook Hard Drive BBS(HD,0x500)…-.V…V.A.V…L…A…
Boot0001* EFI HDD Device (ST1000LM014-1EJ164-SSHD) PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,0,0)/HD(1,GPT,4e45b4d1-09ce-2747-b488-dd771b593cb9,0x1000,0x96000)RC
Boot0002* USB Hard Drive - SMI BBS(7,0x500)…A…
Boot0003* USB Hard Drive (UEFI) - SMI PciRoot(0x0)/Pci(0x1d,0x0)/USB(0,0)/USB(1,0)/HD(1,MBR,0x0,0x5499e8,0x2000)RC
Boot2001* USB Drive (UEFI) RC
Boot2002* Internal CD/DVD ROM Drive (UEFI) RC
Boot3001* Internal Hard Disk or Solid State Disk RC
Boot3003* Internal Hard Disk or Solid State Disk RC
[manjaro mnt]#

Looks like mostly system info. I didn’t see anything that would change the process, unless I’m missing something. (Highly likely! :smile:) I’ll edit this comment in 5-10 when I complete the process again. Thanks!

EDIT - as expected, nothing changed. After inputing my password, I get the same “grub_calloc” error.

boot on USB iso manjaro
open a terminal

sudo manjaro-chroot -a ( type 1 if only one line appears )
sudo cp /boot/efi/EFI/manjaro/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
exit

@stephane

First command returns:

==> ERROR: You can’t mount 0!

type 1 if only one line appears 

@stephane
I’m sorry if I’m missing somthing, but no combination of typing 1 does anything.

[manjaro@manjaro ~]$ sudo manjaro-chroot -a
==> ERROR: You can’t mount 0!
[manjaro@manjaro ~]$ 1
bash: 1: command not found
[manjaro@manjaro ~]$

[manjaro@manjaro ~]$ sudo manjaro-chroot -1
usage: manjaro-chroot -a [or] manjaro-chroot chroot-dir [command]
-a Automount detected linux system
-h Print this help message
-q Query settings and pretend

If 'command' is unspecified, manjaro-chroot will launch /bin/sh.

If 'automount' is true, manjaro-chroot will launch /bin/bash
and .

[manjaro@manjaro ~]$ sudo manjaro-chroot 1
==> ERROR: Can’t create chroot on non-directory 1
[manjaro@manjaro ~]$

sudo manjaro-chroot -a 

if there is only one line 0 - …
then type 1 enter

It doesn’t give me that option. It spits out :

==> ERROR: You can’t mount 0!

and returns immediately to the CL. No pause.

I have a feeling this older post might have the answer to my problem. I’m not competent enough to put it together.

are using Luks ? ( encrypted installation ? )

Yes, I am. I can mount through Thunar like the post suggest, but then I can’t mount the /boot.

see this topic

I don’t see anything that pertains to my situation. I’m not attempting to do the procedure from within Manjaro. I’m locked out at using a live USB. I’m also not dealing with dual booting. I only have Manjaro on my HD.

you have to read this
https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system

1 how to mount open luks
2 and reinstall grub

The word “reinstall” isn’t even on that page. I feel like I’m going deeper down a rabbit hole than I need. I can mount the drive! But I can’t figure out the right order to do things in, or apparently where the files are actually supposed to go. I really appreciate your help, but I feel like I’m getting further from the solution at this point.

from USB iso manjaro
you can select your drive to boot ?
( not live , but the disk ? )

I’m sorry. I don’t understand what you’re asking. I can mount my system drive from Thunar (or the CL) within the live system.

from USB iso manjaro ( before start booting )
you can click on boot to select your disk

is this working ?

From the USB boot menu, I can choose to look at the EFI bootloaders. Listed as follows:

(hd1,gpt1)/efi/manjaro/grub64.efi
(hd1,gpt1)/efi/boot/bootx64.efi
(hd1,gpt1)/efi/boot/grubx64.efi
(hd1,gpt1)/efi/boot/Manjaro/grubx6464.efi