You are not logged in.

#1 2023-12-15 11:47:03

citrus
Member
Registered: 2018-07-04
Posts: 13

[SOLVED] Reinstalling GRUB following an update

Hi, this is a general question about pacman hooks with a specific focus on GRUB.

At this point, I have been a happy arch user for over 5 years. Over that time I have come to familiarize myself with many concepts, including update hooks in pacman. My understanding is that their purpose is to pick up on changes in specific parts of the system made by installing/updating packages, and respond to them appropriately. A good example is for instance rebuilding the font cache after installing a new typeface in /usr/share/fonts.

I recently experienced a baffling incident related to this, which I would like to discuss here. It was caused by upgrading GRUB to 2:2.12rc1-7 during a regular weekly update, which broke my boot at the UEFI stage. From user perspective, it seemed like the bootloader was loaded but crashed soon after printing the "Welcome to GRUB" message, locking the system in an endless restart loop. After some digging around I found that the update may have modified /etc/default/grub, which triggered a hook that re-ran grub-mkconfig to synthesize a new version of /boot/grub/grub.cfg. For some reason, however, this hook did not touch the EFI firmware, resulting in a state where old version of the firmware was reading a new version of grub.cfg, likely crashing due to some new unrecognized options or configuration syntax. Once I confirmed this was the case, I corrected the problem by booting a fresh archiso, mounting and chrooting my system, and re-installing GRUB to /boot/efi, which is where my EFI partition is mounted. Once the versions of GRUB and grub.cfg were consistent again, the bootloader ran properly and I was again able to run my system without any difficulties.

I am happy that in solving this issue I learned something about EFI boot sequence in arch, and became way more comfortable with chroot and friends. That being said, I do not understand the motivation behind the GRUB pacman hook. Why does it run grub-mkconfig but not grub-install? Is that not a time bomb guaranteed to always lead to a state where EFI firmware version does not match the version of grub.cfg? From my naïve point of view, it would stand to reason to run either both of these commands or neither, but not just one of them, which seems to be the current state.

Last edited by citrus (2023-12-16 13:43:02)

Offline

#2 2023-12-15 11:56:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,173

Re: [SOLVED] Reinstalling GRUB following an update

The GRUB pacman hook is not a thing that exists by default on an Arch install (look at the file list https://archlinux.org/packages/core/x86_64/grub/ there's no alpm hook). You either set that up yourself (or via the AUR https://aur.archlinux.org/packages/grub-hook ), or are not running Arch Linux. Manjaro and Endeavour OS are popular candidates that do this by defaut, which is one of the many reasons they are not supported here

Last edited by V1del (2023-12-15 12:07:48)

Offline

#3 2023-12-15 12:17:03

citrus
Member
Registered: 2018-07-04
Posts: 13

Re: [SOLVED] Reinstalling GRUB following an update

V1del wrote:

You either set that up yourself (or via the AUR https://aur.archlinux.org/packages/grub-hook )

You are correct. I must have set it up myself several years ago, back when I did not really understand what I was doing all that well.

Just to check my reasoning, would you say my analysis makes sense: to either run both grub-mkconfig and grub-install, or neither?

Offline

#4 2023-12-15 17:18:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,173

Re: [SOLVED] Reinstalling GRUB following an update

I'd say so, yes.  Though the "need" for both is somewhat "arbitrary" and due to the fact GRUB hasn't had a formal release in years and due to Arch moving to some rc's here to fix a bunch of CVEs , it's likely that incompatible changes within GRUB would normally be appropriately marked as such when official releases containing breaking changes happen.

Offline

#5 2023-12-16 13:42:47

citrus
Member
Registered: 2018-07-04
Posts: 13

Re: [SOLVED] Reinstalling GRUB following an update

Great, thanks for helping me understand this. Have a good rest of the week!

Note: Marking this as solved.

Offline

Board footer

Powered by FluxBB