The purpose would be to have the equivalent of Ubuntu's "apt-get autoremove" functionality.

When you install package P, it might draw in dependancies D1, D2, ... Dn automatically.

When you later uninstall P, the dependancies D1, D2, ..., Dn might remain on your system.

If you keep installing and uninstalling packages, after a while your system remains cluttered with things you don't need.

The idea would be to mark all dependancies that were installed but not explicitely requested as "installed automatically". Then a command like "zypper autoremove" could remove them at once if they are not needed anymore.

Sorry in advance if this is already possible - I did not find.

Looking for mad skills in:


This project is part of:

Hack Week 15


  • almost 3 years ago: blarson started "autoremove" functionality for zypper
  • almost 3 years ago: blarson liked "autoremove" functionality for zypper
  • almost 3 years ago: randybb liked "autoremove" functionality for zypper
  • almost 3 years ago: mbrugger liked "autoremove" functionality for zypper
  • almost 3 years ago: pluskalm liked "autoremove" functionality for zypper
  • Show History


    • dmacvicar
      almost 3 years ago by dmacvicar | Reply

      There is zypper packages --unneeded which I am not sure if it takes into account /var/lib/zypp/AutoInstalled.

      In any case a worth project is to:

      • Fix the man page
      • Expose the functionality somehow present zypper packages --unneeded (only lists) and zypper rm -U foo (not usable without a package argument) into an usable command.

    • e_bischoff
      almost 3 years ago by e_bischoff | Reply

      Thanks Duncan. I did not know about the --unneeded flags.

      After searching a bit, I found it was described by


      I don't think that

        "packages which are not required by other packages and are not in wanted selections"

      match the list of "automatically installed" packages that I described, but it seems to address pretty much the same use case:

                 A typical use case: user installs an application which pulls in some
                 dependencies to test it, uninstalls the application shortly after or way later
                 but the dependencies stay unused installed on the system.

      In any case, turning this list of packages into a command currently requires quite a bit of sed/awk:


      so a "usable command" as you say it would make sense.

    • e_bischoff
      almost 3 years ago by e_bischoff | Reply

      My first tests show that once you remove packages listed with zypper packages --unneeded, new unneeded packages appear. This shows that the --unneeded feature does not explore the tree in depth, or said otherwise, it does not mark as unneeded the packages that would become unneeded if the "immediately" unneeded were removed.

      I also remarked that packages you installed explicitely but are not in "wanted selections" are marked as "unneeded". That one is bad.

      In short, this "unneeded" feature does not really work the same way as the "installed automatically" feature on Debian / Ubuntu.

    • mlandres
      almost 3 years ago by mlandres | Reply

      IMO prerequisite for any automatic cleanup is the ability to inspect and manipulate a packages 'autoinstalled' property. This is the base on which the resolver decides which packages can be cleaned and which are requested by the user. If you can not change this property, you can not influence the resolvers decision.

    • e_bischoff
      8 months ago by e_bischoff | Reply


      At the end I had not the time to work on this in Hackweek 17.

    • e_bischoff
      8 months ago by e_bischoff | Reply

      I meant Hackweek 15.

    Similar Projects

    This project is one of its kind!