Concerns about a non-working pacman hook

I run yay casually today and I saw a GRUB update so I went ahead and did it. If I’m not mistaken, @dalto helped me create a pacman hook to automate the grub-install and grub-mkconfig command running, but the hook (apparently) failed and I ran these manually.

Here’s the output I got:

(12/15) Reinstall GRUB on update...
call to execv failed (No such file or directory)
error: command failed to execute correctly
(13/15) Updating icon theme caches... # Also this failed as it seems
gtk-update-icon-cache: The generated cache was invalid.
error: command failed to execute correctly

And here’s the hook itself:

[Trigger]
Operation = Upgrade

Type = Package
Target = grub

[Action]
Description = Reinstall GRUB on update...
When = PostTransaction
Depends = grub
Exec = sh -c "grub-install --no-nvram && grub-mkconfig -o /boot/grub/grub.cfg"

Is it a pacman or yay issue or did I do something wrong?

Two things. First, it looks like you have multiple commands failing. Can we see the full output from the update instead of just that snippet?

You could also try replacing sh with /usr/bin/sh in the Exec line

Of cource!

:: Synchronizing package databases...
 endeavouros is up to date
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 chaotic-aur                                                                                           2.1 MiB  1941 KiB/s 00:01 [------------------------------------------------------------------------------] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (14)             Old Version               New Version               Net Change  Download Size

chaotic-aur/beautyline   1:20221127-1              1:20221209-1                0.17 MiB       3.94 MiB
core/grub                2:2.06.r380.g151467888-1  2:2.06.r403.g7259d55ff-1    0.01 MiB       6.81 MiB
multilib/lib32-systemd   252.2-1                   252.3-1                     0.00 MiB       0.64 MiB
extra/libfontenc         1.1.6-1                   1.1.7-1                     0.00 MiB       0.02 MiB
extra/libice             1.1.0-1                   1.1.1-1                     0.00 MiB       0.08 MiB
extra/libxau             1.0.10-2                  1.0.11-1                    0.00 MiB       0.01 MiB
extra/libxkbfile         1.1.1-1                   1.1.2-1                     0.00 MiB       0.07 MiB
extra/libxshmfence       1.3.1-1                   1.3.2-1                     0.00 MiB       0.01 MiB
core/mkinitcpio          33-1                      34-2                        0.01 MiB       0.05 MiB
extra/protobuf           21.10-1                   21.11-1                     0.00 MiB       2.01 MiB
extra/qt5-declarative    5.15.7+kde+r24-1          5.15.7+kde+r25-1            0.00 MiB       4.83 MiB
core/systemd             252.2-3                   252.3-1                     0.05 MiB       7.42 MiB
core/systemd-libs        252.2-3                   252.3-1                     0.00 MiB       0.63 MiB
core/systemd-sysvcompat  252.2-3                   252.3-1                     0.00 MiB       0.01 MiB

Total Download Size:    26.51 MiB
Total Installed Size:  109.01 MiB
Net Upgrade Size:        0.24 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 protobuf-21.11-1-x86_64                                                                               2.0 MiB  1693 KiB/s 00:01 [------------------------------------------------------------------------------] 100%
 beautyline-1:20221209-1-any                                                                           3.9 MiB  3.19 MiB/s 00:01 [------------------------------------------------------------------------------] 100%
 lib32-systemd-252.3-1-x86_64                                                                        653.1 KiB  1799 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 systemd-libs-252.3-1-x86_64                                                                         642.1 KiB  1703 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 libice-1.1.1-1-x86_64                                                                                78.5 KiB   461 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 libxkbfile-1.1.2-1-x86_64                                                                            75.3 KiB  1031 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 mkinitcpio-34-2-any                                                                                  47.4 KiB   323 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 qt5-declarative-5.15.7+kde+r25-1-x86_64                                                               4.8 MiB  2.18 MiB/s 00:02 [------------------------------------------------------------------------------] 100%
 libfontenc-1.1.7-1-x86_64                                                                            15.4 KiB   220 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 libxau-1.0.11-1-x86_64                                                                               10.9 KiB   233 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 systemd-sysvcompat-252.3-1-x86_64                                                                     6.1 KiB   122 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 libxshmfence-1.3.2-1-x86_64                                                                           5.7 KiB  77.2 KiB/s 00:00 [------------------------------------------------------------------------------] 100%
 grub-2:2.06.r403.g7259d55ff-1-x86_64                                                                  6.8 MiB  2.71 MiB/s 00:03 [------------------------------------------------------------------------------] 100%
 systemd-252.3-1-x86_64                                                                                7.4 MiB  2.93 MiB/s 00:03 [------------------------------------------------------------------------------] 100%
 Total (14/14)                                                                                        26.5 MiB  10.3 MiB/s 00:03 [------------------------------------------------------------------------------] 100%
(14/14) checking keys in keyring                                                                                                 [------------------------------------------------------------------------------] 100%
(14/14) checking package integrity                                                                                               [------------------------------------------------------------------------------] 100%
(14/14) loading package files                                                                                                    [------------------------------------------------------------------------------] 100%
(14/14) checking for file conflicts                                                                                              [------------------------------------------------------------------------------] 100%
(14/14) checking available disk space                                                                                            [------------------------------------------------------------------------------] 100%
:: Processing package changes...
( 1/14) upgrading beautyline                                                                                                     [------------------------------------------------------------------------------] 100%
( 2/14) upgrading systemd-libs                                                                                                   [------------------------------------------------------------------------------] 100%
( 3/14) upgrading grub                                                                                                           [------------------------------------------------------------------------------] 100%
:: To use the new features provided in this GRUB update, it is recommended
   to install it to the MBR or UEFI. Due to potential configuration
   incompatibilities, it is advised to run both, installation and generation
   of configuration:
     $ grub-install ...
     $ grub-mkconfig -o /boot/grub/grub.cfg
( 4/14) upgrading systemd                                                                                                        [------------------------------------------------------------------------------] 100%
New optional dependencies for systemd
    libbpf: support BPF programs [installed]
( 5/14) upgrading lib32-systemd                                                                                                  [------------------------------------------------------------------------------] 100%
( 6/14) upgrading libfontenc                                                                                                     [------------------------------------------------------------------------------] 100%
( 7/14) upgrading libice                                                                                                         [------------------------------------------------------------------------------] 100%
( 8/14) upgrading libxau                                                                                                         [------------------------------------------------------------------------------] 100%
( 9/14) upgrading libxkbfile                                                                                                     [------------------------------------------------------------------------------] 100%
(10/14) upgrading libxshmfence                                                                                                   [------------------------------------------------------------------------------] 100%
(11/14) upgrading mkinitcpio                                                                                                     [------------------------------------------------------------------------------] 100%
(12/14) upgrading protobuf                                                                                                       [------------------------------------------------------------------------------] 100%
(13/14) upgrading qt5-declarative                                                                                                [------------------------------------------------------------------------------] 100%
(14/14) upgrading systemd-sysvcompat                                                                                             [------------------------------------------------------------------------------] 100%
:: Running post-transaction hooks...
( 1/15) Creating system user accounts...
( 2/15) Updating journal message catalog...
( 3/15) Reloading system manager configuration...
( 4/15) Updating udev hardware database...
( 5/15) Applying kernel sysctl settings...
( 6/15) Creating temporary files...
( 7/15) Reloading device manager configuration...
( 8/15) Arming ConditionNeedsUpdate...
( 9/15) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 6.0.11-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [resume]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 6.0.11-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [resume]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
(10/15) Reloading system bus configuration...
(11/15) Check if user should be informed about rebooting after certain system package upgrades.
==> INFO: Reboot is recommended due to the upgrade of core system package(s).
(12/15) Reinstall GRUB on update...
call to execv failed (No such file or directory)
error: command failed to execute correctly
(13/15) Updating icon theme caches...
gtk-update-icon-cache: The generated cache was invalid.
error: command failed to execute correctly
(14/15) Checking which packages need to be rebuilt
(15/15) Updating the info directory file...
:: Searching databases for updates...
:: Searching AUR for updates...
 -> Missing AUR Packages:  grub2-theme-endeavouros
 -> Flagged Out Of Date AUR Packages:  conky-lua
 there is nothing to do

Try using the full path to sh in the hook as described above.

1 Like

Done, now I’ll have to wait for another update I guess

sudo pacman -S grub