You are not logged in.

#1 2021-03-27 14:16:43

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

[SOLVED] Resolved booting after BIOS update but GRUB can't load config

Hi,
I've updated BIOS and got a "No bootable device found" message. So chrooted to the system, reinstalled GRUB and got "calloc not found" message when booting to GRUB. Went here and did what the guy suggested with mounting EFI and installing there. Now I can get to GRUB prompt and manually load config by

configfile (hd0,gpt1)/grub/grub.cfg

Well, I would be glad to have it loaded automatically big_smile. Is there a way to set it up in this state or what to do with this? I suspect that the reason is that now I might have two GRUBS in the boot partition. I don't wanna mess things up right now. Looks like this:

/boot
├── EFI
│   ├── EFI
│   │   └── GRUB
│   └── GRUB
│       ├── fonts
│       ├── locale
│       ├── themes
│       │   └── starfield
│       └── x86_64-efi
└── grub
    ├── fonts
    ├── locale
    ├── themes
    │   └── starfield
    └── x86_64-efi

Thanks and have a great day!

Last edited by Hitokage (2021-03-28 17:17:26)

Offline

#2 2021-03-27 15:11:12

lazarys
Member
Registered: 2020-08-30
Posts: 15

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

The post you refer to is correct, but you somehow ended up mounting your boot partition under /boot/EFI.
You also used GRUB as your bootloader-id, as in wiki, which is fine, but that's how you got that structure.

Mount partitions properly and reinstall grub (loader, not the package), it should be fine.

Later you can clean up /boot/EFI manually...

Offline

#3 2021-03-27 15:38:15

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

lazarys wrote:

The post you refer to is correct, but you somehow ended up mounting your boot partition under /boot/EFI.

Yea, the guy in the linked post did that

mount /dev/sda1 /boot/EFI

I did that because of the calloc problem.

Last edited by Hitokage (2021-03-27 15:40:35)

Offline

#4 2021-03-27 18:10:40

lazarys
Member
Registered: 2020-08-30
Posts: 15

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

ok, maybe i got it wrong...
(hd0,gpt1) - this is your /boot

Since you didn't mention I "assume" arch is the only system you got there.

You need to mount (from live session) root, usually at /mnt, then boot, usually at /mnt/boot, then esp at /mnt/boot/EFI. In that order smile
Then arch-chroot /mnt, then run grub-install...

Don't mount your (hd0,gpt1), whatever the actual device is, to /boot/EFI. That one goes to /boot

On another note, you have /boot/EFI/GRUB/fonts, /boot/EFI/GRUB/locale etc. for some reason, implying grub was at some point insalled to /boot/EFI instead of /boot.
And to /boot/EFI/GRUB (instead of grub) that is created by grub-install using bootloader-id flag.

That's why i think you mis-mounted something...

In any case, after you mount all properly and before you run grub-install you can delete all contents of /boot/EFI, only thing that needs to be there is /EFI/name-you-gave-as-bootloader-id/grubx64.efi

Edit: run grub-mkconfig if you need to.

Last edited by lazarys (2021-03-27 18:22:36)

Offline

#5 2021-03-28 07:16:11

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Thank you so much for the advice, one more thing! What's with the esp? I never made any partition like that.

lazarys wrote:

esp at /mnt/boot/EFI

My disk:

/dev/sda1      2048   2099199   2097152     1G EFI System
/dev/sda2   2099200  12584959  10485760     5G Linux swap
/dev/sda3  12584960 937703054 925118095 441.1G Linux filesystem

Can't I just do this?

before restarting: rm -rf /boot/*
reboot to live usb...
mount /dev/sda3 /mnt
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
arch-chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=GRUB --recheck
grub-mkconfig -o boot/grub/grub.cfg

A bit afraid of getting the calloc thing again.

Last edited by Hitokage (2021-03-28 07:57:15)

Offline

#6 2021-03-28 09:30:14

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Hitokage wrote:

I've updated BIOS and got a "No bootable device found" message.

Sounds like the firmware ("BIOS") lost the NVRAM boot entries. You could have just copied grubx64.efi to /EFI/BOOT/BOOTX64.EFI on the ESP, that should boot automatically if there are no NVRAM entries. The --removable option for the grub-install command does this for you. This is all covered in the ArchWiki.

Hitokage wrote:

chrooted to the system, reinstalled GRUB

That's far too vague. What were the *exact* commands that you used?

Hitokage wrote:

got "calloc not found" message

That happens when the installed GRUB modules don't match the core.img being booted.

Hitokage wrote:

Went here and did what the guy suggested with mounting EFI and installing there.

That's far too vague. What were the *exact* commands that you used?

Hitokage wrote:

Now I can get to GRUB prompt and manually load config by

configfile (hd0,gpt1)/grub/grub.cfg

Use the set command to find where GRUB is looking for the configuration file.

Hitokage wrote:

Looks like this

What command did you use for that output?

Hitokage wrote:

What's with the esp? I never made any partition like that.

In your system /dev/sda1 is the EFI system partition or ESP.

Hitokage wrote:
before restarting: rm -rf /boot/*

That will remove the kernel & initramfs images. Don't do that.

Hitokage wrote:

My disk:

And how are the partitions mounted?

lsblk -o name,mountpoint

And can we also see

efibootmgr -v

Offline

#7 2021-03-28 09:36:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,093

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Your --efi-directory= has to be --efi-directory=/boot/efi and the grub-mkconfig command has to be grub-mkconfig -o /boot/grub/grub.cfg with that setup and yes that should work.

Offline

#8 2021-03-28 09:41:35

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

V1del wrote:

yes that should work.

Apart from the OP removing the kernel & initramfs images before rebooting into the live environment.

Offline

#9 2021-03-28 09:55:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,093

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Ah yeah right I totally missed that, don't do that.

Offline

#10 2021-03-28 11:32:48

lazarys
Member
Registered: 2020-08-30
Posts: 15

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

I obviously missed you dont have a separate /boot partition, sorry about that, it might make things somewhat simpler, i guess.

Just pay attention to directory names, they are case sensitive.
I used /boot/EFI (capital), because that was the structure you already posted as existing on your system.

If you do:

Hitokage wrote:
mkdir /mnt/boot/efi

...then you have to point grub-install to the same directory --efi-directory=/boot/efi, not /boot/EFI
In this case, you would just get an error so not a big deal, but a very important thing to remember for linux.

Head_on_a_Stick wrote:
Hitokage wrote:
before restarting: rm -rf /boot/*

That will remove the kernel & initramfs images. Don't do that.

Where did this command came from?
Be carefull when you pick up stuff from other places with "similar" issues. It's enough that the system configuration is a bit different for some things not to work or to actually cause more damage to your system.
Or at least search for the syntax to try and figure out more precisely what it's used for. ArchWiki is a good place wink

One more thing, IIRC boards that require you to reinstall bootloader after bios update, tend to do that every time (after you update bios), so you might take a note of how you fixed it this time, because you will most likely have to do it again in the future.

Offline

#11 2021-03-28 14:31:39

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Additional info:

Head_on_a_Stick wrote:

That's far too vague. What were the *exact* commands that you used?

To fix the calloc error:

mount /dev/sda1 /boot/EFI
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=GRUB --recheck
grub-mkconfig -o boot/grub/grub.cfg

What I did as the first try to fix things, to be honest I am not really sure. Definitely used the same commands as above but mounted simply to /boot and maybe didn't use EFI directory in the installation.

Head_on_a_Stick wrote:

Use the set command to find where GRUB is looking for the configuration file.

Prefix is set to

(hd0,gpt3)/boot/grub
Head_on_a_Stick wrote:
lsblk -o name,mountpoint
sda    
├─sda1 /boot
├─sda2 [SWAP]
└─sda3 /
sdb    
└─sdb1 
Head_on_a_Stick wrote:
lefibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001
Boot0000* GRUB	HD(1,GPT,0df9ab53-3491-1343-9f29-734156689cda,0x800,0x200000)/File(\EFI\GRUB\grubx64.efi)
Boot0001* Hard Drive	BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........S.a.n.D.i.s.k. .S.D.S.S.D.H.I.I.4.8.0.G...................\.,.@.r.d.=.X..........A.............................................>..Gd-.;.A..MQ..L.4.1.6.4.1.4.0.4.4.0.4.7. . . . . . . . ........BO..NO..........W.D.C. .W.D.1.0.E.Z.E.X.-.2.2.M.F.C.A.0...................\.,.@.r.d.=.X..........A.............................................>..Gd-.;.A..MQ..L. . . . .W. .-.D.C.W.6.C.3.Y.H.D.5.Z.V.E........BO

Thanks for the reply, I am still kinda confused about the situation. Any advice would be much appreciated.

Last edited by Hitokage (2021-03-28 15:10:34)

Offline

#12 2021-03-28 14:36:23

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

lazarys wrote:

Where did this command came from?
...
One more thing, IIRC boards that require you to reinstall bootloader after bios update, tend to do that every time...

About the rm command I didn't know that the boot directory contains also other things aside the loader so I thought that it would simply allow me to start clean. Sorry and thanks to everyone for the warning! Now I wonder if there is a way to simply get rid of all the grub related stuff and install it again.
I did update BIOS before and this never happened on this board. I tried to clean CMOS as well before the grub fix attempt by the way.

Last edited by Hitokage (2021-03-28 14:38:54)

Offline

#13 2021-03-28 16:52:00

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

lazarys wrote:

boards that require you to reinstall bootloader after bios update, tend to do that every time (after you update bios), so you might take a note of how you fixed it this time, because you will most likely have to do it again in the future.

The OP can either copy grubx64.efi to /EFI/BOOT/BOOTX64.EFI on the EFI system partition or use the --removable option with the grub-install command to do that automatically. The firmware ("BIOS") should boot that even in the absence of any NVRAM entries.

Hitokage wrote:
├─sda1 /boot

If you have the ESP mounted under /boot then just declare that for the grub-install command:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --removable

But personally I would transfer /boot to the the root partition (/dev/sda3) and mount the ESP under /efi (or so). I also use the noauto option in /etc/fstab to prevent the ESP being mounted unless I want it so. The FAT filesystem isn't very robust.

Hitokage wrote:

I wonder if there is a way to simply get rid of all the grub related stuff

Delete the GRUB directories on the ESP (before running the grub-install command again).

You can also delete the current NVRAM entry to make sure you only have one for Arch:

# efibootmgr -b 0 -B

And for the record the calloc error means that the installed GRUB modules don't match the booted core.img (grubx64.efi) version.

Last edited by Head_on_a_Stick (2021-03-28 16:52:17)

Offline

#14 2021-03-28 17:15:44

Hitokage
Member
Registered: 2019-08-03
Posts: 6
Website

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Head_on_a_Stick wrote:

If you have the ESP mounted under /boot then just declare that for the grub-install command:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --removable

Thank you so much and also thanks to everyone else who replied here. It's fixed!
Just to help other people, recap of all steps I did:

mkdir mnt
mount /dev/sda3 mnt/
mount /dev/sda1 mnt/boot/
arch-chroot
rm /boot/EFI/GRUB  -rf
rm /boot/EFI/EFI  -rf
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable --recheck
grub-mkconfig -o boot/grub/grub.cfg
efibootmgr -b 0 -B

My boot directory now:

/boot/
├── EFI
│   └── BOOT
└── grub
    ├── fonts
    ├── locale
    ├── themes
    │   └── starfield
    └── x86_64-efi

Last edited by Hitokage (2021-03-28 17:16:40)

Offline

#15 2022-08-19 15:17:37

Art3mk4
Member
From: Russia
Registered: 2014-06-17
Posts: 3

Re: [SOLVED] Resolved booting after BIOS update but GRUB can't load config

Hitokage wrote:
Head_on_a_Stick wrote:

If you have the ESP mounted under /boot then just declare that for the grub-install command:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --removable

Thank you so much and also thanks to everyone else who replied here. It's fixed!
Just to help other people, recap of all steps I did:

mkdir mnt
mount /dev/sda3 mnt/
mount /dev/sda1 mnt/boot/
arch-chroot
rm /boot/EFI/GRUB  -rf
rm /boot/EFI/EFI  -rf
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable --recheck
grub-mkconfig -o boot/grub/grub.cfg
efibootmgr -b 0 -B

My boot directory now:

/boot/
├── EFI
│   └── BOOT
└── grub
    ├── fonts
    ├── locale
    ├── themes
    │   └── starfield
    └── x86_64-efi

Thank you very much, you helped me a lot!

Offline

Board footer

Powered by FluxBB