Arch Linux Pacman
Clearing Package Cache¶
Packages downloaded by Pacman are stored in "/var/cache/pacman/pkg". The downloaded packages are not cleared over time even when a package is uninstalled.
With the use of "paccache" script provided by the "pacman-contrib" package, it allows for deletion of all cached versions of installed and uninstalled packages. By default the most recent 3 cached versions will be kept.
Solution: Manual¶
- First install the required package.
# pacman -Sy pacman-contrib
- Remove all except the most recent 3 cached versions.
# paccache -r
- Remove all except the most recent 2 cache versions with verbose output.
# paccache -rk2v
- Remove all cached versions for uninstalled packages.
# paccache -ruk0
Solution: Automatic¶
Default behaviour is to run weekly to clear unused packages.
- Install required package.
# pacman -Sy pacman-contrib
- Edit interval as desired.
# nano /etc/systemd/system/paccache.timer
[Unit] Description=Discard unused packages weekly [Timer] OnCalendar=weekly AccuracySec=1h Persistent=true [Install] WantedBy=timers.target
- Enable paccache Timer
# systemctl enable paccache.timer
External Links¶
Last update: August 9, 2020