rpmorphan vs. zypper pa -n

I thought that both commands would list packages once installed as dependencies but currently not required by any packages. They give me different outputs however. What’s the exact definition of zypper’s “unneeded” packages anyway? Its manpage uses the term at several places but it doesn’t actually explain what it really is. So what’s the difference? Thanks.

I tried to understand the zypper man page and I tried

boven:~ # zypper pa -n
Unknown option '-n'
boven:~ #

So I have some questions about what you are doing, what you expected to happen and what happened (at least the last is clear from my case).

BTW this is from openSUSE 12.2, but as you did not tell what version of openSUSE you use, I just took one.

Whoops, I’ve upgraded to the latest 13.1 recently, sorry. It didn’t strike me there would be improvements in zypper, it always seemed to me as a never-changing component in the OS.

Anyway I wanted to clear my system from the unnecessary ballast after upgrade.
Next, some time back when I were occasionally removing packages I wouldn’t use the “-u” option nor having set “solver.cleandepsOnRemove = true” in zypp.conf so the dependencies were still staying in the system after removal of the packages which required them in the first place.
Next, when Installing a fresh new openSUSE few releases back the “solver.onlyRequires” was set to “false” so plenty of another recommended ballast was automatically installed and were being installed with target packages I was installing until I decided to have zypper install only required packages without the recommended ones.
And finally, In Arch I always use “pacman -R[csn] $(pacman -Qqtd)” command to remove “orphans” because there’s often changes in dependency relations among packages after the rolling updates and I like my system being nice and tidy.

I’ve already removed most of the packages in the both commands’ outputs but there’s still some distinction visible so this is what zypper gives me right now:

> LANG=en_US zypper pa -n
Loading repository data...
Reading installed packages...
 S | Repository        | Name                          | Version          | Arch  
i | Fonts             | adobe-sourcesanspro-fonts     | 1.050-14.10      | noarch
v | openSUSE-13.1-Oss | adobe-sourcesanspro-fonts     | 1.050-3.1.2      | noarch
i | Fonts             | cyreal-lobster-cyrillic-fonts | 1.4-7.9          | noarch
v | openSUSE-13.1-Oss | cyreal-lobster-cyrillic-fonts | 1.4-4.1.2        | noarch
i | Fonts             | lomt-junction-fonts           | 0.20121218-6.9   | noarch
v | openSUSE-13.1-Oss | lomt-junction-fonts           | 0.20121218-2.1.2 | noarch
i | Fonts             | lomt-script1-fonts            | 0.20121218-6.9   | noarch
v | openSUSE-13.1-Oss | lomt-script1-fonts            | 0.20121218-2.1.2 | noarch
i | openSUSE-13.1-Oss | xkeyboard-config-lang         | 2.9-6.1.3        | noarch

Whereas this is what rpmorphan gives me at the same time:

> rpmorphan

It is allways of value to mention which version of openSUSE. It will make it easier for others (your potential helpers) to use their own systems in trying to replay/check what you post. It will show othersthat you are willing to provide the maximum of information you have so helping can be done in the most efficient way. And the result will be that the first answers will not contain: which version, which DE??? but more to the point facts/answers/questions. Time is limited, even for volunteer helpers.

I checked with a 13.1 system. Indeed that -n option is there. But I also can not interprete what “unneeded” means. Unneeded for what? No idea.

BTW, I can understand that a tool can find what packages are installed and are not required by any other installed package. I am a bit less sure about the ability to know if a package not required by another package ever was required somewher back in the mist of history. Is that something that is realy taken note of in some installation history database? And how sure can we be that that database never was corrupted/repaired and/or lost and recreated during the whole history of the installations on a system?

I allways look with distrust to such lists. In the end you could remove Firefox because it is not required by any other package (but it is required by me!).

Oh, and about your list with amongst others libreoff packages, I would use YaST > Software > Software Managemnt and Search for libreoffice to see where these packages came from (repo) and if there are alternatives installed, etc.

…you could remove Firefox…

Yes, that is a concern for sure but that’s why I haven’t removed those LibreOffice packages, fonts, and others shown in the output. The user should always review what to remove in this kind of automated operations.
LibreOffice packages are from the Index of /repositories/LibreOffice:/Stable/openSUSE_13.1 repository, there are alternative version in the official OSS and UPDATE repositories of course but how does it help?

Not the user, the system manager :wink:

You decide which version you want to have on the system. The other one can then be removed imho.

BTW not many people take the trouble to recover a few MB by going deep into this. When you want to to remove old and unneeded stuff, a new install (e.g. when going to a new openSUSE version, instead of doing an upgrade/update of some kind) after a few years might be effective enough without much thinking. and checking.

The other one can then be removed imho

I have only one version of LibreOffice installed - when updating from other repositories, the older packages’ files will be overwritten plus i have set a bit higher priority for the community LibreOffice repo so they won’t be overwritten again by the version from the OSS/Update repo.

Not the user, the system manager

But the managers are ordinary people too! …I mean users.

not many people take the trouble…

I just experiment a bit and once I understand the difference between rpmorhpan and zypper pa -n and what's the zypper's concept of "unneeded" packages there won't be a problem to use in on a regular basis plus it isn't worth to do a fresh OS install just to recover a few MB. On the contrary it has its magic just to basically replace repositories, upgrade the distribution from the running system and having a new one after reboot, hasn't it? (...and clean unused dependencies later on)

I do not know if that priority thing is doing the trick. We normaly say from a repo that it should be used in prefernce for the packages that are there, but also on the system from another repo. The repo change. Then the system (zypper/YaST) will only use that repo for those packages in the future. It will not change repo, even if another repo has a higher numbered version. No priority difference needed.

The manager is not only human, he may even be the same human as one (or more) of the users. But it is still (s)he that manages and that has to decide when users may have contradictory wishes.

I do not suggest to specifically do a fresh install for covering some MB, for the same reason that I do suggest not to worry about a few packages hanging around only using some MB and doing nothing.
I only suggested that when going to a new openSUSE version, one of the things that could make you decide to go for a new install once a few years, is this clean-up, together with a gneral clean-up. IMHO usedfull every five years or so.

I do not know if that priority thing is doing the trick…

I don/t understand fully what you mean but if you talk about the “vendor stickiness” concept, I have already set “solver.allowVendorChange” to true in zypp.conf so the packages will get replaced even if they come from another vendor (repo) when doing regular update, and zypper dup does that witohout question - with no regard to the vendor stickiness.

I don’t fully understand what you mean but if you talk about the “vendor stickiness” concept I’ve already turned it of in zypp.conf so the regular update process updates packges even from different vendor (repo) when there’s a newer version (or higher priority). and zypper dup does that without question - even when “solver.allowVendorChange = false”.

I do suggest not to worry about a few packages…

That’s fine, I do not worry about it. Like I said, I just experiment with it a bit, you know - tinkering - it’s not like it was being done on a mission critical machine, just a home computer.

Yes, Vendor stickyness. I guess very few do as you by switching it off. They want e.g. to use Packman for several multi-media packages and not the (Update-)OSS ones. And want that to stay like that irrespective of the fact that the version string in one of them caan be interpreted as |newer" then the version string in the other.

But as you seem to have changed several configuration values from the default, when asking things here, it is better to report that with the question. Else everybody will start helping you taking it for granted you use the defaults as most here.

So better forget my advices at all. I may complete have misunderstood why you see what you see, thinking that you simply changed vendor and that you have vendor stickyness.

On 12/13/2013 08:16 PM, Atronach pecked at the keyboard and wrote:
> Hi,
> I thought that both commands would list packages once installed as
> dependencies but currently not required by any packages. They give me
> different outputs however. What’s the exact definition of zypper’s
> “unneeded” packages anyway? Its manpage uses the term at several places
> but it doesn’t actually explain what it really is. So what’s the
> difference? Thanks.

The correct option for zypper would “-o, --orphaned Show
packages which are orphaned (without repository).”

So in this context, rpmorphan and zypper pa -n would be most compatible
but not really showing “orphaned” packages but packages that are not
needed by any other package. This is my understanding. YMMV


The correct option for zypper would "-o…

I didn’t mention the “-o” option since it does completely different thing from what I want. It merely uses the term “orphan” but in another context that rpmorphan as you say, so it’s irrelevant here. Interestingly enough pacman from Arch uses the term “foreign” in this case so there’s some ehm…slight contradictions>:( in naming convention among different package managers.

rpmorphan and zypper pa -n would be most compatible

And that is my problem! Only compatible? My first expectation would be they should be exactly the same if they both list packages not required by others - but that probably is my misunderstanding of the “unneeded” package as stated by zypper.

ZYpp knows if a user explicitly requested a package from the history file (/var/log/zypp/history). It looks at the user field in there, which can be empty.
If you would consider “unneeded” any package that is not required by any other package in a recursive way you would end considering nothing is needed. So the history file is important, and used by solver.cleandepsOnRemove.

I didn’t know about the “zypper package --unneeded” option but I am going to guess it uses the same logic than cleandepsOnRemove, and so the history file. Since rpmorphan doesn’t know about the history file its results are different.
I didn’t look at rpmorphan in years. But IIRC it was broken by design because of the fact that it didn’t have access to anything saying if a user explicitly requested a package or if it was installed automatically as a dependency of a requested package. Since soft dependencies are an openSUSE extension to RPM rpmorphan probably also ignores them, which would make it even more broken.

Great I’ve explicitly reinstalled adobe-sourcesanspro-fonts and it disappeared from the zypper pa -n output whereas reinstalling libreoffice-kde4 haven’t made it dissapear from the rpmorphan output. So it kinda works like you say.
I’ll remove rpmorphan and use exclusively zypper then. Is there a command for packages automatically installed as dependencies to mark them as specifically installed by the user so I can selectively remove some packages I need from the zypper pa -n output without reinstalling them again?