Grub and Dracut Question

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: