How Zypper Handles Repositories in openSUSE

This article provides an overview of how the Zypper package manager configures, prioritizes, and synchronizes software repositories within openSUSE Linux. It covers the underlying configuration file structure, the role of metadata caching and the SAT solver library, repository prioritization rules, and the essential command-line operations used to manage package sources efficiently.

Repository Configuration Files

Zypper relies on the libzypp engine to manage software sources. Repositories are defined using standard .repo files located in the /etc/zypp/repos.d/ directory. Each file contains INI-style configurations detailing:

Repository Prioritization and Vendor Stickiness

Zypper enforces strict rules regarding package origins to maintain system stability:

  1. Priority Ranking: Repositories can be assigned a priority value between 1 (highest priority) and 99 (default priority). When multiple repositories provide the same package, Zypper always chooses the version from the repository with the highest priority, regardless of whether a newer version exists in a lower-priority repository.
  2. Vendor Stickiness: By default, Zypper adheres to vendor stickiness. Once a package is installed from a specific vendor (such as the official openSUSE build service or the Packman repository), Zypper will not automatically switch that package to a version provided by a different vendor during general system updates. Cross-vendor upgrades require explicit administrative confirmation or specific flags, such as zypper dup --allow-vendor-change.

Metadata Synchronization and Libsolv

To manage dependencies quickly, Zypper delegates dependency resolution to libsolv, a library that utilizes Boolean satisfiability (SAT) algorithms.

When a repository is refreshed (via zypper refresh or automatic background checks), Zypper downloads repository metadata—typically repomd.xml and associated XML data files—and compiles them into a binary cache format called .solv files. These files are stored in /var/cache/zypp/solv/. Because .solv files contain pre-computed dependency structures, Zypper can resolve complex dependency trees and detect package conflicts in fractions of a second without re-parsing raw XML files on every query.

Common Management Operations

Zypper handles repository administration through specialized subcommands: