You are not logged in.
Short of manually (or by script) removing individual packages from the pacman cache, I do not see a way to blacklist specific packages from the pacman cache using paccache. Am I the only one who does not see a good reason to store backup copies for programs not essential to basic system operation?
Has adding such a feature ever been considered for paccache?
Last edited by zpg443 (2021-10-14 03:11:18)
Offline
It should be trivially easy to maintain your own list of packages either to keep or to purge (see paccache's '-i' flag). But I don't see how this could be automatically built in aside from just inheriting someone else's lists. There is no objective metric for what is "essential" - that's vague / subjective. In order for a process to be automated it first needs to be defined.
Last edited by Trilby (2021-10-13 16:00:11)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
As I understand it, paccache's i flag allows you to retain cache copies (by ignoring their removal). The existing mechanism for purging is to remove all of the cache, except for core-related programs identified with the i flag. As you stated, it is difficult to determine what is "essential".
It is for this practical reason (the need to exclude a handful of large packages, such as libreoffice, clearly not required to run Arch) that it would be better for paccache to have a flag to explicitly skip for retention to the cache, specified packages as comma separated values.
Offline
If you're proposing an option for the inverse behavior of the '-i' flag, that sounds reasonable and is well defined enough to potentially go to the bug tracker as a feature request (nevermind: see edit 2)
But scripting this is pretty trivial:
rm $(pacman -Sp $package-list | sed -n 's|file://||p')
EDIT: I suppose this only removes the current version from the cache - but if you do this regularly that'd be all that was there. And if you are using paccache to remove old packages, it'd eventually remove any stragglers anyways.
EDIT 2: wait, what you want is the default behavior: if you have the list of packages you don't want in the cache, just specify them: no new flags needed:
paccache -rk0 $package-list
Last edited by Trilby (2021-10-13 17:41:56)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Since I kept a record of basic installation packages, I decided to go with the basic '-i' approach for simplicity, and did these steps:
Remove all packages in the cache:
# paccache -rk0
Re-download without reinstalling using a custom list of 'basic install packages' (one package name per line):
# pacman -Sw $(cat ~/cache_include_list | cut -d' ' -f1)
Following each system upgrade, use paccache with the '-i' flag to ignore the removal of all packages in the list, but remove all other cache files:
# paccache -rk0 -i - < ~/cache_include_list
Revised after feedback from Trilby (#6).
Last edited by zpg443 (2021-10-14 03:10:58)
Offline
Only one of those three attempts actually follows the syntax for the -i flag, but none of them do for the other flags which is the actual cause of the error that has nothing to do with the attempted use of the -i flag as you'd get the same error. What you should use is:
paccache -rk0 -i - < ~/cache_include_list
But why are you using the -i flag now, I thought your goal was for the opposite (i.e., default) behavior listing packages to remove.
Last edited by Trilby (2021-10-13 23:58:00)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I do not want to, but I am using the '-i' flag because there is not currently a reverse flag.
Until then, go with the basic '-i' approach although I am not sure I have a good answer on which packages to retain if downgrading is needed.
Thanks for pointing out the missing '-' on rk0. I will revise post #5 to reflect the corrected syntax.
Offline
There is no reverse flag as that behavior is the default as noted in post #4.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
There is no reverse flag as that behavior is the default as noted in post #4.
Will check that again for user error on my part. It did not work when I tried it before.
Offline
Checked it again and found it still did not work. First, I created a file (test_cache) with two random packages, each on a new line:
kbreakout
kpat
After checking the pacman cache dir (/var/cache/pacman/pkg/) to ensure both packages were there, placed the test file in the home directory, then:
# paccache -rk0 $~/test_cache
The result was:
==> no candidate packages found for pruning
It will work with each package name on the command line with a space between:
# paccache -rk0 kbreakout kpat
==> finished: 2 packages removed (disk space saved: 6.2 MiB)
Last edited by zpg443 (2021-10-14 17:53:29)
Offline
It will work with each package name on the command line with a space between:
Yes, because that's how the command takes arguments. Your other attempt is pretty nonsensical - I'd suggest you spend a bit of time learning how command shells (aka bash) work. I really like the first two tutorials here. Frankly I find it quite odd that you could be using arch linux for 5 years and apparently not know the basics of how the shell processes command line arguments - your time with arch will be much better if you study up on this.
In this case, if you'd like to have packages to purge saved one-per-line in a file, you can use the following command:
paccache -rk0 $(cat /path/to/package_list)
If you are using bash, you can use the following bashism which is slightly simpler:
paccache -rk0 $(< /path/to/package_list)
Last edited by Trilby (2021-10-14 19:31:07)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks for the tutorials. I am comfortable with bash scripting, but not so much with sed, grep, redirecting and piping. And, it is not something I do every day.
Last edited by zpg443 (2021-10-14 20:18:21)
Offline