Grub and Dracut Question

I think that, by now, I should know the answer to this question, but I don’t. Rather than make a mistake, I thought I’d ask. I apologize if this is answered elsewhere that I missed, or otherwise…

My system is a relatively recent, EnOS standard install. It boots from the grub menu, but uses dracut during normal yay updates.

I notice that there is a new grub update that will install to my system when I update. My question: Is there still a need to run the old sudo grub-install … and sudo grub-mkconfig … commands post-update?

Thanks for your guidance!

– Barry

Dracut doesn’t really have any impact to this question either way. The answer is the same if you run dracut or mkinitcpio.

The answer is not one everyone agrees on.

My answer is, yes, you should.

Thanks, @dalto. I simply didn’t know whether running those commands or not would adversely impact my system. I appreciate and certainly will take your guidance on this!

Edit to update result: I updated with yay and ran the above two commands. Everything went smoothly into this fresh and uneventful boot. Again, thanks!

1 Like

Hi Barry,

I wrote this support note which will help you create a hook to automatically update the grub configuration, everytime the grub packages is updated. I think this might help you with your system maintenance:

Create a System Hook to update Grub

When the Grub Boot Manager package is updated, you are required to manually execute the “grub-install” and then update configuration “grub-mkconfig -o /boot/grub/grub.cfg” commands manually. By creating the below system hook, anytime the grub package is updated it will self update.

  1. Create Hook in “/etc/pacman.d/hooks” called “update-grub-config.hook”.
sudo nano /etc/pacman.d/hooks/update-grub-config.hook
  1. Define service to execute if Grub package is updated:
[Trigger]
Operation = Upgrade
Type = Package
Target = grub

[Action]
Description = Reinstall Grub when the package is updated
When = PostTransaction
Exec = /bin/sh -c "/usr/bin/grub-install --no-nvram && /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg"
  1. Edit /etc/pacman.conf. Uncomment “HookDir = /etc/pacman.d/hooks/” configuration line.

Source:

Thank you! I remembered that post, and I was just looking for it!

The following paths are commented out with their default values listed.
If you wish to use different paths, uncomment and update the paths.

#HookDir = /etc/pacman.d/hooks/

Unless you change the hooks directory from the default, ther is no need to uncomment the line.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.