2

As a typical debian user I install some packages over time for several reasons:

  1. I want to test the package
  2. I want to use it for a short time
  3. I mis-spelled its name
  4. I copy/pasted a long apt install command from Internet, but I only need some of the packages.

Is there any (intelligent) tool to find packages installed previously and probably no longer needed?

This tool should guess the need to the package from current behavior and probably should use some kind of artificial intelligence. I don't expect that tool to be accurate, it only suggests.

I already know about deborphan and apt autoremove but they are useless in this scenario.

  • I'd look at access times in /usr/bin, and pick off the less-recently used programs, ranked by package size. That would require some scripting work (ymmv). – Thomas Dickey Nov 24 '18 at 17:37
  • thanks, this is good idea. but doesn't work for packages that have services installed. – gopy Nov 24 '18 at 17:40
  • nor for packages that doesn't have binary files. – gopy Nov 24 '18 at 17:48
  • Have you looked in /var/log/apt/history* to see what you installed when? – doneal24 Nov 24 '18 at 17:59
  • Yes I know about that file, but this method is completely manual and is not practical for systems with thousands of package installations. – gopy Nov 24 '18 at 18:11
2

popularity-contest is a debian tool which help the Debian developer to improve future versions of the distribution it can be used to achieve your goal. the popcon-largest-unused command will list the unused packages.

The popularity-contest package sets up a cron job that will periodically anonymously submit to the Debian developers statistics about the most used Debian packages on this system.

man popularity-contest

The popularity-contest command gathers information about Debian packages installed on the system, and prints the name of the most recently used executable program in that package as well as its last-accessed time (atime) and last-attribute-changed time (ctime) to stdout.

apt install popularity-contest
popularity-contest > /var/log/popularity-contest
popcon-largest-unused

DESCRIPTION: popcon-largest-unused

Based on the list of unused packages reported by popularity-contest, this program extract the package size from the APT cache, and list the unused packages sorted by size.

  • Thanks, its an interesting tool, but not intelligent enough. – gopy Nov 24 '18 at 18:40
  • what if I install apache and do not use http port for a long time? popularity-contest can't detect that. same is true for library packages and documentation packages. – gopy Nov 25 '18 at 7:01
  • @gopy As the manpage say the debian tool will track the used executable program to generate the list. – GAD3R Nov 25 '18 at 16:33
-1

Yes, this is an existing project, called deborphan.

Description: program that can find unused packages, e.g. libraries

   deborphan  finds  packages that have no packages depending on them. The
   default operation is to search within the libs, oldlibs and  introspec‐
   tion sections to hunt down unused libraries.
  • "I already know about deborphan". – Weijun Zhou Nov 24 '18 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.