Score:0

Difference between zypper and rpm for installed packages

co flag
dan

I'm looking at a reliable way to find how many installed packages I have on my OpenSUSE Leap 15.3 system. I tried:

# number of available packages in the repos
vm-admin:~ # zypper se -s | wc -l
55800

# number of installed packages from the repos
vm-admin:~ # zypper se -si | wc -l
1490

# number of installed packages?
vm-admin:~ # rpm -qa | wc -l
1091

# number of available packages?
vm-admin:~ # pkcon get-packages | grep Available | wc -l
51058

# number of installed packages?
vm-admin:~ # pkcon get-packages | grep Installed | wc -l
1086

What's the difference between these commands commands?

us flag
You basically answered your question already. For example, `zypper se` searches for all available packages and all versions including patches. So those 55800 packages include all avaible versions of all packages. While `zypper se -si` checks all installed packages. The `rpm -qa | wc -l` only reports the actually installed rpms. Compare the outputs without the `wc -l`, then you'll see what the difference is.
dan avatar
co flag
dan
I'm more curious about the installed packages being different from a command to another.
us flag
So did you compare the outputs without `wc -l` as I suggested?
dan avatar
co flag
dan
Unsure how that's relevant but here you go. Zypper: https://www.toptal.com/developers/hastebin/raw/urexipabub RPM: https://www.toptal.com/developers/hastebin/raw/uxiwoxutox
dan avatar
co flag
dan
There are 326 "Update repository with updates from SUSE Linux Enterprise 15" in Zypper that don't show up with RPM since it's redundant. As for the 71 other installed packages in the differential... I'm not sure.
Score:1
us flag

To summarize, zypper is much more verbose than rpm. Just to show the difference on one example on one of my VMs:

ses7-host1:~ # zypper se -si ceph-common
Loading repository data...
Reading installed packages...

S  | Name                | Type    | Version                        | Arch   | Repository
---+---------------------+---------+--------------------------------+--------+---------------------------------------------
i+ | ceph-common         | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SLE-Module-Basesystem15-SP2-Updates for x86_64
i+ | ceph-common         | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SUSE-Enterprise-Storage-7-Updates for x86_64 SP2
i  | python3-ceph-common | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SLE-Module-Basesystem15-SP2-Updates for x86_64
i  | python3-ceph-common | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SUSE-Enterprise-Storage-7-Updates for x86_64 SP2

The package ceph-common is available from two different repositories, but is listed as installed from both since the versions are exactly the same. But rpm can only intall one package, of course:

ses7-host1:~ # rpm -qa | grep ceph-common
ceph-common-15.2.14.84+gb6e5642e260-3.31.1.x86_64
python3-ceph-common-15.2.14.84+gb6e5642e260-3.31.1.x86_64

Then you also should have noticed that with zypper se -si you see more than just installed packages but also schemas, patches and patterns, maybe even sources if you want to compile packages yourself. The output of rpm -qa is a subset of zypper se -si.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.