Package Details: grub-hook 2.1-1

Git Clone URL: https://aur.archlinux.org/grub-hook.git (read-only, click to copy)
Package Base: grub-hook
Description: Pacman hook to update GRUB after a kernel update
Upstream URL: https://wiki.archlinux.org/index.php/Pacman#Hooks
Licenses: GPL
Submitter: runnytu
Maintainer: runnytu
Last Packager: runnytu
Votes: 19
Popularity: 0.23
First Submitted: 2013-08-25 22:38
Last Updated: 2020-02-23 13:40

Latest Comments

1 2 Next › Last »

chrisjbillington commented on 2020-02-23 19:33

Thanks @runnytu, however I'm getting an error when the post_upgrade function runs:

$ sudo pacman -U grub-hook-2.1-1-any.pkg.tar.zst 
loading packages...
warning: grub-hook-2.1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) grub-hook-2.1-1

Total Installed Size:  0.00 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Running pre-transaction hooks...
(1/1) pacaudit-pre.hook
:: Processing package changes...
(1/1) reinstalling grub-hook                       [######################] 100%
error: command failed to execute correctly
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

I don't think the functions are supposed to give a nonzero exit code, which they do by running /usr/bin/false as their last command.

In any case since it's been several years, I think it would be ok to drop the .install file rather than fix it.

runnytu commented on 2020-02-23 13:40

@chrisjbillington, It's for people with older versions, I adjust it for only show the text if they have the old files with the same version to avoid users to upgrade again.

chrisjbillington commented on 2020-02-22 17:54

Thanks @runnytu! One more suggestion: The .install script is printing messages during removal: Please remove 'grub' to the HOOKs array in /etc/mkinitcpio.conf.. This seems no longer relevant to existing installs. Should the .install script be removed?

runnytu commented on 2020-02-22 13:10

@chrisjbillington, Done, it's functional again.

chrisjbillington commented on 2020-02-19 19:04

As of the kernel packaging changes a few months ago, this hook is no longer functional. This is because the packages no longer install kernels directly to /boot - instead this is done by mkinitcpio in a postinstall hook. This hook should look for the same files that trigger the mkinitcpio hook instead. The following should do it (also the call to a shell is unnecessary - just call /usr/bin/grub-mkconfig by its full name):

[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/lib/modules/*/vmlinuz

[Action]
Description = Updating grub configuration ...
When = PostTransaction
Exec = /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg

Also, since this hook is installed by a package and is not intended to be user-editable, it should go in /usr/share/libalpm/hooks/ where other packages put their hooks, instead of in /etc/pacman.d/hooks/.

runnytu commented on 2016-11-20 12:53

@QuartzDragon, it seems to haven't installed the bash package (base), in terminal execute /bin/sh, if fails, install or reinstall the bash package, if not please execute sudo /bin/sh -c 'grub-mkconfig -o /boot/grub/grub.cfg', and attach the output errors.

QuartzDragon commented on 2016-11-20 04:27

After kernel upgrades, grub-hook fails with:

(3/3) Updating GRUB Config
call to execv failed (No such file or directory)
error: command failed to execute correctly

Not sure what the issue is?

runical commented on 2016-08-16 23:27

All right, the first one is a good reason. I hadn't thought of that. As for the second, I swear it worked, but you are correct. On further testing, my solution didn't work. Sorry about that :S

And glad I could help make the hook a bit more elegant :)

runnytu commented on 2016-08-16 20:06

Bump to new version 2.0-5.

@runical:

First, it's necessary if you want to update the number of kernel version in config file of grub in every kernel upgrade, this is the reason for create this hook, if you don't want it, you can comment the upgrade line during the build process of package.

Second, Ok but your config doesn't work, because the file target refers to a file in the package you're installing/upgrading/removing, not in a file in your local directories, my new config concerning to file vmlinuz works Ok.

Third, Ok i include the command in the hook file instead of sh file.

runical commented on 2016-08-12 08:40

I can't help but notice that the current hook is quite unwieldy. How about using something like [1]?

Let me explain the though process.

First off, you do not need to update the grub config with every update to the kernel. The new kernel image has the same name as the old kernel image, so the grub entries do not change.

Second, listing all of the possible kernels is inefficient (and unwieldy, it requires you to know all possible kernel packages), so we would like to find something that all kernel updates have in common. That is that a new kernel image is generated on the /boot partition. So we trigger the hook on any change to the image files on /boot.

And lastly, you do not need a separate grub.sh since you can include the command in the hook itself.

I tested the hook on my system and it works, so maybe you'd like it as well.

[1] https://gist.github.com/ec6abd92bd974e4729d0bbad5b0e08c0