You are not logged in.

#1 2024-01-08 12:02:36

Wild Penguin
Member
Registered: 2015-03-19
Posts: 321

[SOLVED] paccache.service fails with aur cache dir

Hi!

I'm using aurutils as my aur helper.

The paccache.service (activated via paccache.timer) from pacman-contrib fails with the custompkgs directory (as per the aur man page). I presume this is because the directory is owned by the user (me) who is using aurutils, and the fact the paccache.service drops unneeded priviledges and/or has protect-home activated.

Jan 08 13:41:38 ArkkiVille systemd[1]: Starting Remove unused cached package files...
Jan 08 13:41:38 ArkkiVille paccache[1090718]: ==> ERROR: cachedir '/home/custompkgs' does not exist or is not a directory
Jan 08 13:41:38 ArkkiVille systemd[1]: paccache.service: Main process exited, code=exited, status=1/FAILURE
Jan 08 13:41:38 ArkkiVille systemd[1]: paccache.service: Failed with result 'exit-code'.
Jan 08 13:41:38 ArkkiVille systemd[1]: Failed to start Remove unused cached package files.

(the error message is confusing; the directory is indeed there but not seen by the service, caused by how the unit file has been written).

$ ls -ld /home/custompkgs/
drwxr-xr-x 2 ville ville 303 Jan  7 02:08 /home/custompkgs/

Now, I'm a bit confused, as to:

  1. what would be the most sensible way to fix this? Perhaps I just should just set ProtectHome to no, and call it a day?

  2. Should I report this upstream (be that aurutils or pacman-contrib?), or is this just some quirk / edge case the user should deal with by themself?

I can confirm that solution 1. actually works for me, and I believe I can trust paccache it will not ruin my user home directories.

Last edited by Wild Penguin (2024-02-18 15:04:59)

Offline

#2 2024-01-08 13:06:57

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,961

Re: [SOLVED] paccache.service fails with aur cache dir

For clarity :

You added /home/custompkgs to Cachedir in pacman.conf ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2024-01-08 19:16:58

Wild Penguin
Member
Registered: 2015-03-19
Posts: 321

Re: [SOLVED] paccache.service fails with aur cache dir

Yes, as per aur man page.

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
[custom]
SigLevel = Optional TrustAll
Server = file:///home/custompkgs

This package repo directory is owned by a user (as aur is intended to run as a non-privileged user).

Last edited by Wild Penguin (2024-01-08 19:54:18)

Offline

#4 2024-01-09 11:08:50

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,961

Re: [SOLVED] paccache.service fails with aur cache dir

That doesn't answer my question, rephrasing .

Did you follow the CacheDir (optional) section and add /home/custompkgs to pacman.conf Cachedir variable ?

Please post your /etc/pacman.conf so your pacman setup is clear.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2024-01-10 08:55:44

Wild Penguin
Member
Registered: 2015-03-19
Posts: 321

Re: [SOLVED] paccache.service fails with aur cache dir

Ah, yes.  I though it is clear:

The paccache.service (activated via paccache.timer) from pacman-contrib fails with the custompkgs directory (as per the aur man page).

That code block is from my pacman.conf, I forgot to mention it.

Offline

#6 2024-02-14 18:31:41

PLeG
Member
Registered: 2023-07-23
Posts: 2

Re: [SOLVED] paccache.service fails with aur cache dir

Hi

I have a similar issue and would also like discuss possible solutions, so let see if we can get this conversation running again ;-)
Here are the relevant parts of my pacman.conf.

[options]
CacheDir    = /var/cache/pacman/pkg/ /home/xyz/aurutils/
--- snip ---
[custom]
SigLevel = Never TrustAll
Server = file:///home/xyz/aurutils

I am attempting a divide and conquer approach with a system service, a user service and a pair of related overrides.

Limit the system service to pacman's own cache:

# cat /etc/systemd/system/paccache.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/paccache -r -v -c /var/cache/pacman/pkg/

Make the service and timer available to users:

# ln -sv /usr/lib/systemd/system/paccache.{service,timer} /etc/systemd/user/
'/etc/systemd/user/paccache.service' -> '/usr/lib/systemd/system/paccache.service'
'/etc/systemd/user/paccache.timer' -> '/usr/lib/systemd/system/paccache.timer'

Hardcode the aurutils path and unset ProtectHome for the user service:

# cat /home/xyz/.config/systemd/user/paccache.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/paccache -r -v -c /home/xyz/aurutils
ProtectHome=no

The -v switch is only a matter on preference: the list of deleted files is sent to the journal.

The system service runs fine (some backlog, yes...):

paccache[pid]: ==> finished: 9980 packages removed (disk space saved: 80.61 GiB)

For the user service on the other hand, it starts fine, but I do not have enough history there yet for a functional test:

paccache[pid]: ==> no candidate packages found for pruning

The trade-off:
++ the security around the root user is kept up,
-- at the cost of a hard-coded path abandoned by all the beauty in the world,,
-- and some minor additional complexity due to the multiplication of services.

A simpler solution could be to move the aurutils directory somewhere out of /home.
- /aurutils is pretty much guaranteed not to interfere with anything, although it brings some mess to the root filesystem.
- /var/cache/pacman/aurutils would look tidy, but it is arguably more than a cache
- /var/local/aurutils ?

Or a mix, where the work directory stays where it is, but PKGDEST=/var/cache/pacman/aurutils in /etc/makepkg.conf...?

Offline

#7 2024-02-15 03:05:40

merlock
Member
Registered: 2018-10-30
Posts: 236

Re: [SOLVED] paccache.service fails with aur cache dir

This is my override:

/etc/systemd/system/paccache.service.d/override.conf

[Service]
ExecStart=
ExecStart=/usr/bin/paccache -rk2
ProtectHome=read-only
ReadWriteDirectories=/home/merell/git/packages

I did this back in 2022, and haven't had any problems at all.


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#8 2024-02-15 20:11:30

PLeG
Member
Registered: 2023-07-23
Posts: 2

Re: [SOLVED] paccache.service fails with aur cache dir

Ah yes, much better.
Thanks Merlock.

Offline

#9 2024-02-18 15:04:47

Wild Penguin
Member
Registered: 2015-03-19
Posts: 321

Re: [SOLVED] paccache.service fails with aur cache dir

Thanks for the suggestions, I believe merlocks solutions is the cleanest. I'm not sure if upstream is aware / should be notified (for a change in the man page?).

Marking as [SOLVED]!

Offline

Board footer

Powered by FluxBB