You are not logged in.

#1 2017-10-27 12:32:56

ozzyofpi
Member
From: Ireland
Registered: 2016-02-06
Posts: 7

[SOLVED] Broken Pacman Hooks

I have a custom Pacman hook to remove cached packages older than two versions after an upgrade.

[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = Removing cached packages older than two versions
When = PostTransaction
Exec = paccache -rk2

When I run

pacman -Syu

the hook failes to run with the following error. As you can see, other Pacman hooks are running fine.

:: Running post-transaction hooks...
(1/8) Removing cached packages older than two versions
call to execv failed (No such file or directory)
error: command failed to execute correctly
(2/8) Updating GIO module cache...
(3/8) Compiling GSettings XML schema files...
(4/8) Probing GTK3 input method modules...
(5/8) Updating icon theme caches...
(6/8) Creating temporary files...
(7/8) Arming ConditionNeedsUpdate...
(8/8) Updating the desktop file MIME type cache...

Last edited by ozzyofpi (2017-10-27 13:11:58)

Offline

#2 2017-10-27 12:37:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: [SOLVED] Broken Pacman Hooks

The message notes that execv fails.  See `man execv` and note the difference between execv and execvp and adjust your Exec line appropriately.

EDIT: it seems the documentation in the wiki gives examples with the command basename only suggesting that path lookup in included.  But I'd still suggest first trying the full path to paccache.

I'm also not sure if you can run pacman commands from a pacman hook - that was my initial suspicion, but the execv error led to me to the path idea (it lead me down the wrong path! wink )

EDIT 2: the wiki page I found seems outdated, it uses a different format.  All current hooks on my system do indeed use full paths in the Exec line.

Last edited by Trilby (2017-10-27 12:44:17)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-10-27 12:49:29

ozzyofpi
Member
From: Ireland
Registered: 2016-02-06
Posts: 7

Re: [SOLVED] Broken Pacman Hooks

This is the pacman hook documentation I used.
Using the full path still gives an identical error. I even tried making a hook with a different command(echo), using the full path and nothing changed.

EDIT: Sorry, I made a mistake when testing that. Using the full path solves my problem. Thanks Trilby.

Last edited by ozzyofpi (2017-10-27 13:07:36)

Offline

#4 2017-10-29 02:55:09

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Broken Pacman Hooks

Trilby wrote:

I'm also not sure if you can run pacman commands from a pacman hook - that was my initial suspicion, but the execv error led to me to the path idea (it lead me down the wrong path! wink )

Sure you can, you'll just get ugly errors from pacman saying the database is locked. tongue

And if your name is Manjaro Linux, you might even "fix" this by deleting the lockfile first. On that note, do not ever look at their post-install scriptlet for their "manjaro-system" package, you will regret it. big_smile

...

Fortunately, paccache is not a pacman command, and it is exceedingly unlikely that deleting cached package files in a post-transaction hook will cause any harm, especially if you keep several versions around in case you need to emergency-revert something. It certainly won't clobber pacman's database lock.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB