Grub Updated Seamlessly

UPDATE

Another thread on how to do it automatically through hook. Grub Hook to grub-install and grub-mkconfig?
Thanks to everybody who assisted me to do it.
Since then I never had a problem with Grub.

Hi guys,
I believe there was a Grub update a few minutes ago.

What I currently have installed is:

1 core/grub 2:2.06.r334.g340377470-1 (6.8 MiB 33.0 MiB) (Installed)

I believe I could read it right as the Arch website shows the same number grub 2:2.06.r334.g340377470-1 and date of today and time currently an hour ago!

I am posting this mainly to thank @manuel for his assistance about the script I was trying to do. And of course to thank @dalto for his guidance about the Grub issue and hope this will be of any help.

:warning:BUT as usual I have to say use at your own risk. I am just a noob, I am not a developer. So it is up to you. :warning:

If anybody took the risk please let me know how it went.

Continuing the discussion from Grub 2:2.06.r322.gd9b4638c5-1 won't boot and goes straight to the BIOS after update:

Another reason for posting, is hoping this can help.
What I did was making the script above and created a .desktop file I called sysupdate.desktop and added it as a button to my toolbar (I am on KDE Plasma)

I stopped completely using yay -Syu to update the system and update only through the script by pressing the button on the toolbar.

I am glad to report back that I just updated and noticed there was a Grub update, it appears to me that it updated Grub then according to the if statement (that I did not know how to do it) the 2 commands that should be run after a Grub update ran automatically and I rebooted normally.

This script succedded in making the Grub update or system update in general as smooth as before without need of me doing anything.

I still remember @dalto suggested better use “hook” to do it. Still I need to do my homework on how to do it.

I hope this helps anybody who cares about Grub and was worried about breaking.

Anybody updated? Grub update? Issued the 2 commands after update? I hope you booted safely.

I believe it is OK now.

Update, reboot

[tomdoe@latitude-e7240 ~]$ grub-install -V
grub-install (GRUB) 2:2.06.r334.g340377470-1
[tomdoe@latitude-e7240 ~]$

No grub-install or grub-mkconfig executed.
No problem so far.

1 Like

WOW!
I understood that you have to do both commands after Grub update! Maybe I got it wrong. Maybe not all updates. I do not know. So, still the script above not tested yet.

The command you did was not a normal

yay -Syu

Sorry, I am not that techie!

Of course, why would it not update seamlessly?

4 Likes

What I understood from the other thread that whenever Grub updates you have to do the 2 commands to be sure Grub will work properly. Or was this only in the case of updating only from the old version to the new version that caused the issue?

No, you don’t have to “do the 2 commands to be sure Grub will work properly”. It is well known what exactly caused the issue with Grub late last August.

3 Likes

Do you mean this was only a one-time thing?
That is I can just ignore this script and update normally using

yay -Syu

and just reboot without doing the 2 commands. Any time whatever what update comes in the future?

You should probably use grub-install --no-nvram

You shouldn’t do this via a script because you can’t guarantee that grub will be updated via your script. That is why hooks are better.

Although it has only happened once, one of the things that came to light during this situation is that the grub devs expect grub-install to be run every time grub is updated. So issues could occur at any time in the future as well.

Also, if you don’t run grub-install after a grub update, you would won’t be getting the benefits to bug and security fixes in that part of the code. Since security issues with grub are pretty common, this is something worth considering depending on your risk model.

2 Likes

This is now the stated Arch recommendation:

(1/1) installing grub 
:: Install your bootloader and generate configuration with:
     $ grub-install ...
     $ grub-mkconfig -o /boot/grub/grub.cfg

It means they recommend running grub-install if you

  • also run grub-mkconfig
    and/or
  • update grub
1 Like

This is I am updating Grub in particular!
The problem happens (and will happen) when the update comes through a normal system update through yay -Syu, right?
So in this case we still need to run the 2 commands.

Maybe @TomDoe didn’t need to do them because he did

not yay -Syu

yay
is what I did.
:wink:

Edit @limotux I did grub-install -V to check current version.

Thank @manuel
So I understand that getting the Grub update through a yay -Syu still requires the 2 commands.

Two things:

  • First, it doesn’t happen every time grub is updated. It can happen when grub is updated.
  • Second, a package can be updated via other means, such as being pulled in as a dependency so it isn’t only when you run updates.
1 Like

That just returns the version of the grub-install command.

Recommending doesn’t mean requiring… :wink:

2 Likes

This issue happened because EndeavourOS had a hook that run grub-mkconfig automatically when there was a kernel update. Which is fine, but…

A Grub update introduced a new feature that, when you’ve regenerated the config with an old version of grub (the one you’ve previously installed with grub-install), caused the bootloader to not work properly. At the same time, there was an update to the kernel, so, the hook in EndeavourOS just regenerated the Grub config, but the new version of Grub wasn’t installed with grub-install.

3 Likes

I understand “recommending” in such case is a nice word in place of “you must do this else your system won’t boot”, because if it is not done the system won’t boot, in best case “probably won’t boot”

I feel lost here. I am no techie by any means.
It is OK with me anyway.

Just let me hope I will not need to do another fresh install because of a Grub update (or whatever update).

You also didn’t have to do a fresh install because of the August issue. The precise instructions how to fix that issue were posted an hour or so after the update was pushed. You only had to do that.

2 Likes

I think it wouldn’t hurt if you run grub-install (with proper parameters!) and grub-mkconfig after updating grub.
At least this is what Arch devs are saying.

1 Like

Could this differ from the grub version?