You are not logged in.

#1 2020-12-23 02:29:30

erfanjoker
Member
From: Tabriz / Iran
Registered: 2017-03-26
Posts: 174
Website

[SOLVED] Pacman Hook fails for clearing cache

Hi, Due to pacman's caching for all packages, Im lazy enough to run pacman -Sc so i created a hook :

^^>>> cat /etc/pacman.d/hooks/clean_package_cache.hook                05:56:31 
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Cleaning pacman cache...
When = PostTransaction
Exec = /usr/bin/pacman -Sc --noconfirm

Now after every transaction it says :

:: Running post-transaction hooks...
(1/3) Reloading system manager configuration...
(2/3) Arming ConditionNeedsUpdate...
(3/3) Cleaning pacman cache...
error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck
error: command failed to execute correctly

There is an error line which says cant lock the database, which is right ! pacman is in use, so it cant be used again before it's lock get deleted
The nasty way of doing this could be  deleting the lockfile manually in the command, But im looking for better solution, what do you do for clearing pacman's package cache ?

Last edited by erfanjoker (2020-12-23 04:13:47)

Offline

#2 2020-12-23 02:56:55

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: [SOLVED] Pacman Hook fails for clearing cache

A little search in the wiki won't harm you..
https://wiki.archlinux.org/index.php/Pa … kage_cache

Offline

#3 2020-12-23 04:13:29

erfanjoker
Member
From: Tabriz / Iran
Registered: 2017-03-26
Posts: 174
Website

Re: [SOLVED] Pacman Hook fails for clearing cache

qinohe wrote:

A little search in the wiki won't harm you..
https://wiki.archlinux.org/index.php/Pa … kage_cache

Thanks a lot

Offline

Board footer

Powered by FluxBB