You are not logged in.

#1 2015-06-12 09:51:04

khouli
Member
Registered: 2014-12-14
Posts: 70

[SOLVED] Detect packages that are not being used

Suppose, ahem, that "someone" had strayed a bit from The Arch Way and now and then had installed packages just because well.... they sounded useful or simply really interesting and surely this someone would find the time to try them out and see how they tick. Sometimes the will is weak and a good pkgdesc is just too tempting.

Is there a good way for this someone to identify and remove packages that are going unused? I don't just mean packages that no longer satisfy a previous dependency, I also mean packages with executables that just aren't being used.

Ultimately this someone probably should audit the full list of installed packages. Is there a good way to get that process started by generating a list of non-essential packages that might be going unused?

Last edited by khouli (2015-06-20 11:26:17)

Offline

#2 2015-06-12 10:00:35

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [SOLVED] Detect packages that are not being used

In general: No. In the end it's only you who defines what "unused" means.
Take a look at https://wiki.archlinux.org/index.php/Pacman_tips. There might be some useful hints. I recommend using pacman -Qe and stepping through this list step by step. As long as you do not break your system you can easily reinstall any package you miss later.

Offline

#3 2015-06-12 11:26:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Detect packages that are not being used

When I install packages I want to test, I add their package names to my notes. Then it's just a matter of e.g. weekly revision and running 'pacman -Rns <paste package list here>'.

Offline

#4 2015-06-12 11:51:25

progandy
Member
Registered: 2012-05-17
Posts: 5,205

Re: [SOLVED] Detect packages that are not being used

You could watch the file access in /usr/bin for a week, then exclude that list from the directory tree and analyze the packages of the remaining ones.
You can do that with inotifywait, somewhere in early boot start as root:

find /usr/bin -executable -not -type d | inotifywait -m --fromfile - -e access >> /var/log/binaccess.log

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2015-06-16 16:01:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Detect packages that are not being used

See also https://bbs.archlinux.org/viewtopic.php … 5#p1292205

Edit: I think if you install a new version of th package, it updates the date, so if you update a package you don't use, it will show up as "recently used" anyway.

Last edited by karol (2015-06-16 16:03:27)

Offline

#6 2015-06-16 16:07:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,572
Website

Re: [SOLVED] Detect packages that are not being used

Thanks for dredging that up Karol, I have a revision to SidK's command that only checks binaries from explicitly installed packages that are not required by any other packages:

stat $(pacman -Qetlq | grep "^/usr/bin/[A-Za-z0-9]") | awk ' /^  File:/ {n=$2} /^Access: 2/ {d=$2 ; print d "\t" n}' | sort -rn

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2015-06-16 17:20:07

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Detect packages that are not being used

stat can format output, so e.g.

stat --format "%n %x" /usr/bin/* /usr/local/bin/* | awk '{ print $2 " " $1 }' | sort -nr

could be used instead of the original (SidK's) command. Feel free to incorporate it into yours.
I've noticed that /usr/bin/vendor_perl/ - a directory - was included too.

Offline

Board footer

Powered by FluxBB