Running “zypper packages --unneeded” on Tumbleweed 20220802-0 revealed no unneeded packages. Upgrading to Tumbleweed 20220804-0 resulted in:
[FONT=monospace]**6700K:~ #** zypper packages --unneeded
Loading repository data...
Reading installed packages...
S | Repository | Name | Version | Arch
--+------------------------+-------------------------------+------------+-------
i | Haupt-Repository (OSS) | policycoreutils-lang | 3.4-4.1 | noarch
i | Haupt-Repository (OSS) | python310-aiosmtpd | 1.4.2-4.3 | noarch
i | Haupt-Repository (OSS) | python310-alembic | 1.8.1-1.1 | noarch
i | Haupt-Repository (OSS) | python310-authheaders | 0.14.1-1.3 | noarch
i | Haupt-Repository (OSS) | python310-falcon | 3.0.1-3.5 | noarch
i | Haupt-Repository (OSS) | python310-flufl.bounce | 4.0-2.1 | noarch
i | Haupt-Repository (OSS) | python310-flufl.i18n | 4.0-2.1 | noarch
i | Haupt-Repository (OSS) | python310-flufl.lock | 7.0-1.6 | noarch
i | Haupt-Repository (OSS) | python310-gunicorn | 20.1.0-2.7 | noarch
i | Haupt-Repository (OSS) | python310-importlib-resources | 5.4.0-1.5 | noarch
i | Haupt-Repository (OSS) | python310-lazr.config | 2.2.3-1.5 | noarch
i | Haupt-Repository (OSS) | python310-passlib | 1.7.4-4.6 | noarch
i | Haupt-Repository (OSS) | python310-zope.component | 5.0.1-1.7 | x86_64
i | Haupt-Repository (OSS) | python310-zope.configuration | 4.4.0-1.12 | noarch
**6700K:~ #**[/FONT]
Removing the above and their dependencies resulted in a clean upgrade:
**6700K:~ #** zypper packages --unneeded | grep ^i|cut -d '|' -f3|xargs zypper rm --clean-deps --no-confirm
Reading installed packages...
Resolving package dependencies...
The following 40 packages are going to be REMOVED:
libhiredis1_0_0 libmemcached11 memcached policycoreutils-lang python310-Beaker python310-Deprecated python310-Mako python310-PyNaCl python310-SQLAlchemy
python310-aiosmtpd python310-alembic python310-atpublic python310-authheaders python310-authres python310-bcrypt python310-dkimpy python310-falcon
python310-flufl.bounce python310-flufl.i18n python310-flufl.lock python310-gunicorn python310-hiredis python310-importlib-resources
python310-lazr.config python310-lazr.delegates python310-passlib python310-publicsuffix2 python310-pycryptodome python310-pylibmc python310-pymongo
python310-python-memcached python310-redis python310-scrypt python310-wrapt python310-zope.component python310-zope.configuration
python310-zope.hookable python310-zope.i18nmessageid python310-zope.schema redis
40 packages to remove.
After the operation, 52.2 MiB will be freed.
**Continue? [y/n/v/...? shows all options] (y): **y
( 1/40) Removing policycoreutils-lang-3.4-4.1.noarch ...............................................................................................[done]
( 2/40) Removing python310-Beaker-1.11.0-7.3.noarch ................................................................................................[done]
( 3/40) Removing python310-aiosmtpd-1.4.2-4.3.noarch ...............................................................................................[done]
( 4/40) Removing python310-alembic-1.8.1-1.1.noarch ................................................................................................[done]
( 5/40) Removing python310-authheaders-0.14.1-1.3.noarch ...........................................................................................[done]
( 6/40) Removing python310-bcrypt-3.2.2-1.4.x86_64 .................................................................................................[done]
( 7/40) Removing python310-falcon-3.0.1-3.5.noarch .................................................................................................[done]
( 8/40) Removing python310-flufl.bounce-4.0-2.1.noarch .............................................................................................[done]
( 9/40) Removing python310-flufl.i18n-4.0-2.1.noarch ...............................................................................................[done]
(10/40) Removing python310-flufl.lock-7.0-1.6.noarch ...............................................................................................[done]
(11/40) Removing python310-gunicorn-20.1.0-2.7.noarch ..............................................................................................[done]
(12/40) Removing python310-hiredis-2.0.0-1.3.x86_64 ................................................................................................[done]
(13/40) Removing python310-importlib-resources-5.4.0-1.5.noarch ....................................................................................[done]
(14/40) Removing python310-lazr.config-2.2.3-1.5.noarch ............................................................................................[done]
(15/40) Removing python310-passlib-1.7.4-4.6.noarch ................................................................................................[done]
(16/40) Removing python310-pycryptodome-3.15.0-1.1.x86_64 ..........................................................................................[done]
(17/40) Removing python310-pymongo-4.1.1-1.1.x86_64 ................................................................................................[done]
(18/40) Removing python310-python-memcached-1.59-5.2.noarch ........................................................................................[done]
(19/40) Removing python310-redis-4.3.3-1.1.noarch ..................................................................................................[done]
(20/40) Removing python310-scrypt-0.8.20-1.2.x86_64 ................................................................................................[done]
(21/40) Removing python310-zope.component-5.0.1-1.7.x86_64 .........................................................................................[done]
(22/40) Removing python310-zope.configuration-4.4.0-1.12.noarch ....................................................................................[done]
(23/40) Removing python310-pylibmc-1.6.1-3.5.x86_64 ................................................................................................[done]
(24/40) Removing python310-SQLAlchemy-1.4.39-1.1.x86_64 ............................................................................................[done]
(25/40) Removing python310-Mako-1.2.1-1.1.noarch ...................................................................................................[done]
(26/40) Removing python310-publicsuffix2-2.20191221-1.11.noarch ....................................................................................[done]
(27/40) Removing python310-dkimpy-1.0.5-1.10.noarch ................................................................................................[done]
(28/40) Removing python310-atpublic-2.3-2.3.noarch .................................................................................................[done]
(29/40) Removing libhiredis1_0_0-1.0.2-1.5.x86_64 ..................................................................................................[done]
(30/40) Removing python310-lazr.delegates-2.0.4-1.11.noarch ........................................................................................[done]
(31/40) Removing memcached-1.6.15-1.2.x86_64 .......................................................................................................[done]
Failed to stop redis@.service: Unit name redis@.service is missing the instance name.
See system logs and 'systemctl status redis@.service' for details.
Failed to stop redis-sentinel@.service: Unit name redis-sentinel@.service is missing the instance name.
See system logs and 'systemctl status redis-sentinel@.service' for details.
(32/40) Removing redis-7.0.4-1.1.x86_64 ............................................................................................................[done]
(33/40) Removing python310-Deprecated-1.2.13-1.5.noarch ............................................................................................[done]
(34/40) Removing python310-zope.hookable-5.1.0-1.6.x86_64 ..........................................................................................[done]
(35/40) Removing python310-zope.schema-6.1.0-1.6.noarch ............................................................................................[done]
(36/40) Removing python310-zope.i18nmessageid-5.0.1-3.6.x86_64 .....................................................................................[done]
(37/40) Removing libmemcached11-1.0.18-9.5.x86_64 ..................................................................................................[done]
(38/40) Removing python310-authres-1.2.0-1.11.noarch ...............................................................................................[done]
(39/40) Removing python310-PyNaCl-1.5.0-1.3.x86_64 .................................................................................................[done]
(40/40) Removing python310-wrapt-1.13.3-1.5.x86_64 .................................................................................................[done]
**6700K:~ #**
Removing unneeded packages results in more hassle-free maintenance. Host 6700K has some 3700 packages installed and runs “zypper dup” on a daily schedule. No problems were encountered during 3 months of operation.
That is interesting and leads to the question: Why does an upgrade pull in un-needed packages? Are those packages just “recommends”?
I gave it a try on one of my openSUSE Tumbleweed installations which was installed with “no-recommends” right from the start. First I removed all “un-needed” packages and then upgraded to the current snapshot.
After the upgrade there was a new “un-needed” package again!
So why was this package pulled in if it is not needed and should not be installed even if it is “recommended”?
Ran “zypper remove --clean-deps python38* python39*”. “zypper se -is python|grep ^i+” found several packages I never want to use. Removed them and their dependencies too.
“unneeded” presumably means package is not needed by any user installed package and isn’t a user installed package itself. Found several packages surprisingly flagged as “user installed” but which I don’t need and removed them too.
“zypper pa --unneeded (and similar category in YaST) is all packages that are not Required:, Recommended:, or Suggested: by any user-installed packages (those not in /var/lib/zypp/AutoInstalled, also patterns and products) directly or indirectly. If you remove them all dependencies of remaining packages will still be satisfied.”
/*
* Find all installed packages that are no longer
* needed regarding the current solver job.
*
* The algorithm is:
* - remove pass: remove all packages that could have
* been dragged in by the obsoleted packages.
* i.e. if package A is obsolete and contains "Requires: B",
* also remove B, as installing A will have pulled in B.
* after this pass, we have a set of still installed packages
* with broken dependencies.
* - add back pass:
* now add back all packages that the still installed packages
* require.
*
* The cleandeps packages are the packages removed in the first
* pass and not added back in the second pass.
*
* If we search for unneeded packages (unneeded is true), we
* simply remove all packages except the userinstalled ones in
* the first pass.
*/
I’m not sure that clarifies anything, at least with the state of my addled brain at the moment …
Haven’t checked on my TW installs, but this Leap 15.3 currently has 42 (arrgh! is that significant?) “unneeded” packages, they’re doing no harm and I just leave them.
I never have fully understood the definition of “unneeded”. I think it’s rather flexible though, dependent upon what action the software is taking, or what the user “expects”.
Based on the issues listed below I presume detection of unneeded packages works correctly. “zypper remove --clean-deps” uses it. “zypper dist-upgrade” has no such option. It performs cleanup of dependencies for each package to be removed, but it performs no global cleanup, thus causing the emergence of unneeded packages after completing the upgrade.
If you refer to the recent polkit/pkexec split, pkexec was brought in as a split provides. Because pkexec isn’t usually required, it is now unneeded and can be removed in solver view.
A quick check to man zypper clears any confusion:
Called as zypper inr --no-recommends, it restricts the command to just look for packages supporting available hardware, languages or filesystems. Usefull after having added e.g. new hardware or driver repos. This is also the default behavior if you have set [zypp.conf:solver.onlyRequires].