0

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?

dan
  • 83
  • 7
  • 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. – eblock Feb 23 '22 at 13:29
  • I'm more curious about the installed packages being different from a command to another. – dan Feb 25 '22 at 03:25
  • So did you compare the outputs without `wc -l` as I suggested? – eblock Feb 25 '22 at 07:28
  • 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 Feb 25 '22 at 22:42
  • 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. – dan Feb 26 '22 at 02:08

1 Answers1

1

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.

eblock
  • 215
  • 1
  • 4