By consulting “zypper help rm” there’s the “-u” option, but it demands a package (uninstalled package?) as argument.
Other distributions such as Debian, RedHat, and based on them, have the “autoremove” function in their corresponding package manager tools, which works quite well.
Is there not another way in openSUSE other than “zypper rm -u ”?
I just use Yast. If you select - yast / software management / view / package classification and then look under the orphaned & unneeded package groups, they are listed and can be remoced as required.
By opening the man pages of zypper and searching for “unneeded” you will get wiser. “orphaned” is another search term. This also applies for the forum with countless actual results…
If you didn’t use the “-u” option (“–clean-deps”) option when removing packages then you’ll have to search for packages which no longer have any “requires” or, “recommended” or, “suggested” package dependencies.
Please note that, packages tagged as being “unwanted” or, “orphaned” or, “dropped” are something else …
AFAICS, the only reliable method of cleaning out unused dependencies will be to use RPM in a script –
List all the installed packages and then –
For each installed package execute “rpm --query --whatrequires/recommends/suggests”.
Those packages which are not required (by) or, recommended (by) or, suggested (by) anything can be safely removed.
You’ll also have to search ‘/var/log/zypp/history’ for entries indicating what was also installed when you installed the package which you removed without cleaning up the dependencies – just to be on the safe side …
You could also reinstall the packages you removed and then, remove them again but, this time with the “–clean-deps” option …
And how would you detect such a thing that happened in the past?
You can now find out that a package is now not wanted by any other. But you do not know if it was some time in the past. Except when you keep all sorts of history/logs.
It sounds like the issue here is that it isn’t being tracked by the package manager.
Other package managers do track that so it is possible with those package managers.
If it is true that the package manager doesn’t track it, then the answer to the OP’s question may simply be it isn’t possible to do that on OpenSUSE as it is on many other distros.
It is (otherwise zypper remove --clean-deps were not possible), but there is no zypper command to do the equivalent of apt autoremove. The question pops up for years and I do not remember anyone actually submitting feature request.
My mistake – mea culpa, mea culpa, mea maxima culpa.
Digging further after I posted that suggestion, I stumbled across the following (note the use of a “normal” user with no system administration rights) –
> rpm --erase --test «PACKAGE NAME»
It’s rather nice – it checks which included objects have dependencies to other packages.
Please be aware that, the output of the RPM --erase command, is sent to standard error –
Meaning that, to check the complete system, a script is needed which writes the package name and the standard error output to a file, which then needs to be checked for packages which didn’t produce any information sent to standard error –
> rpm --erase --test aaa_base
error: Failed dependencies:
aaa_base is needed by (installed) google-poppins-fonts-4.003-6.3.1.noarch
aaa_base is needed by (installed) dmraid-1.0.0.rc16-3.26.x86_64
aaa_base = 84.87+git20180409.04c9dae is needed by (installed) aaa_base-extras-84.87+git20180409.04c9dae-150300.10.3.1.x86_64
aaa_base is needed by (installed) desktop-file-utils-0.26-150400.1.7.x86_64
aaa_base is needed by (installed) ghostscript-fonts-std-9.06-14.3.1.noarch
aaa_base is needed by (installed) parallel-printer-support-1.00-bp155.2.9.noarch
aaa_base is needed by (installed) patterns-base-base-20200505-lp155.10.5.x86_64
aaa_base >= 13.2 is needed by (installed) systemd-249.16-150400.8.28.3.x86_64
/etc/mime.types is needed by (installed) apache2-2.4.51-150400.6.11.1.x86_64
/sbin/chkconfig is needed by (installed) dhcp-4.3.6.P1-150000.6.17.1.x86_64
/usr/bin/get_kernel_version is needed by (installed) dracut-055+suse.366.g14047665-150500.3.6.1.x86_64
>
Well, it is a bit too late now, but proper system management includes taking notes of what you change on the system. When you would have written down what extra software you installed (and what it pulled in), then you would have known what to remove when you later decided against using it.
And when still using it, it is something that will help you at the next fresh installation to let you install those packages soon after the installation has finished.
Pen and paper are not that outdated as many think. And you can of course also type it on an unrelated computer as notepad.
As it is now, a fresh installation will clean up things. Something I did every few new openSUSE versions, but now mostly only when new hardware is taken into use.
Sorry that I can not transfer my ease of mind to you, but I do not worry.