Pacman cache size issue

Maybe I’ve made something wrong but I’ve seen that I had a very huge pacman cache (more than 19 Gb) on my rpi system. On an 64Gb usb drive, it takes too much space in my opinion.

There is a timer (/usr/lib/systemd/system/paccache.timer) that should remove every week unused package (leaving only the last three but I had more than 15 versions on some specific packages).

On the arch wiki, dealing with Cleaning the pacman package cache, they give a tip to manage it by, for instance, using a hook or directly the package pacman-cleanup-hook. I don’t like the settings because I think it’s too “aggressive” to keep only the last two versions but I’ve implemented on my system.

Does anyone has the same size issue ? (meaning I didn’t mess up anything on my system)

du -h /var/cache/pacman/pkg

I’ve just discovered a file with an interesting name /var/lib/systemd/timers/stamp-pamac-cleancache.timer but It’s empty ! :pensive:

you can apply

sudo pacman -Sc 

Thx but I don’t want to erase all the cache.

I would prefer manage it nicely by keeping up to 3 or 4 versions.

My question was to know if I’ve inadvertently disabled anything or if it’s a “feature” :wink: to keep everything in cache.

$ paccache -rk3
keep in cache last 3 of each package

$ paccache -ruk3
keep in cache last 3 of each package uninstalled

man paccache

1 Like

We don’t enable this timer by default, so by default it saves all packages until you take action.
You can enable the timer with sudo systemctl enable paccache.timer, which should clean the cache every week.

1 Like

Check if timer is active (I doubt it’s enabled by default) and check .service when it was ran the last time. This should just work, unless you changed something yourself.

Good news then. If you don’t like it, you can change it easily. Put your own .hook in /etc/pacman.d/hooks. No need to use a package for that. Same goes for paccache.service. You can copy any .service to a proper /etc/systemd/... directory and edit it however you wish.

Everything that this hook or service does is just run paccache -rk<some number> command. So you literally have to change 1 character.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.