✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Package Selection and Policy

Package Selection and Policy defines how Linux systems choose and manage software packages, ensuring consistency, security, and compliance across environments.

Package Selection and Policy defines the rules, criteria, and mechanisms by which packages are chosen, prioritized, installed, held, or excluded within a Linux package management ecosystem. This policy governs how package versions, origins, architectures, dependencies, and installation reasons influence package management decisions, ensuring system consistency, security, and performance. It integrates repository priorities, version pinning, vendor preferences, and other controls to tailor package selection to the system administrator’s goals and system requirements.


Candidate Package Selection

Candidate package selection determines which package version from the available sources is chosen for installation or upgrade. This process evaluates all available versions of a package across configured repositories, considering version numbers, repository priorities, and pinning rules. The candidate must satisfy dependency requirements and policy constraints. The selection mechanism aims to pick the most appropriate version that maintains system stability and compatibility.

Version Comparison and Ranking

Packages are ranked primarily by their version number, with higher versions generally preferred. However, additional metadata, such as release date or upstream version, may influence selection. The package manager applies a deterministic algorithm to compare versions, typically using semantic versioning or distribution-specific version formats.

Dependency and Conflict Resolution

Candidate selection respects dependency chains and conflict declarations. A candidate that breaks dependencies or introduces conflicts is discarded or deprioritized. This ensures that installing or upgrading a package does not compromise the integrity of the system.

Multi-Version Considerations

In some cases, multiple versions of a package may coexist (e.g., interpreters or libraries). The policy defines when such multi-version installations are allowed and how candidate selection handles these scenarios.


Repository Priorities

Repository priorities control the precedence of packages from multiple sources. Each repository can be assigned a priority value, influencing candidate selection when multiple repositories offer the same package.

Priority Levels and Effects

Higher priority repositories override lower priority ones. For example, a local or security repository may have a higher priority than a general-purpose or third-party repository. This prevents inadvertent downgrades or installation of untrusted packages.

Interaction with Pinning and Preferences

Repository priorities interact with version pinning and preferences to finely tune package selection. While priorities define coarse-grained source preference, pinning allows per-package or per-version control.


Version Pinning and Preferences

Version pinning enables system administrators to fix packages at specific versions or ranges, preventing automatic upgrades beyond those constraints. Preferences allow flexible rules to influence package selection without strict blocking.

Pinning Syntax and Configuration

Pinning rules are defined in configuration files, specifying package names, versions, origins, and priorities. These rules use selectors to match packages and apply a pin priority value, influencing candidate selection.

Use Cases for Pinning

  • Preventing upgrades of critical packages during system testing or stability periods.
  • Holding back packages with known bugs until fixed versions are available.
  • Maintaining compatibility with specific software stacks by locking versions.

Preferences for Flexible Control

Preferences allow assigning relative priorities to package versions or origins without strictly forbidding upgrades. They enable smooth policy enforcement while allowing overrides when necessary.


Package Holds and Locks

Package holds and locks are mechanisms to prevent installation, upgrade, or removal of specified packages regardless of other policy rules.

Types of Holds and Locks

  • Hold: Blocks upgrades but allows removal.
  • Lock: Prevents any change, including removal or downgrade.

Implementation and Use

Holds and locks are applied via command-line tools or configuration files. They are essential in maintaining system stability by protecting critical packages or customized versions.


Package Inclusion and Exclusion

This policy aspect controls which packages are permitted or forbidden for installation on the system.

Inclusion Rules

Defined lists or patterns specify packages that must be included in the system, often as part of metapackage collections or required dependencies.

Exclusion Rules

Exclusion lists prevent installation or upgrade of specified packages or package families. This is useful to avoid conflicting software, deprecated packages, or those with licensing issues.


Origin and Vendor Preference

Packages may originate from various vendors or sources. Preference policies prioritize packages based on their origin or vendor attributes.

Origin Identification

Packages carry metadata indicating their source repository, vendor, or maintainer.

Vendor Preference Policies

Policies may prefer packages from trusted vendors or official repositories over third-party or community sources to ensure security and compatibility.


Architecture and Variant Selection

Package selection policies consider CPU architecture and package variants (e.g., debug, minimal, language-specific builds).

Architecture Matching

Packages incompatible with the system’s architecture are excluded from candidate selection.

Variant Preferences

When multiple variants exist, policies define which variant is preferred based on system role, resource availability, or user choice.


Package Installation Reasons

Packages may be installed for different reasons, such as user-requested, automatically installed dependencies, or as part of metapackage collections.

Importance for Policy Decisions

The installation reason influences automatic removal policies and upgrade behaviors. For example, automatically installed packages may be candidates for removal when no longer needed.

Tracking Mechanisms

Package managers record installation reasons to support policy enforcement and cleanup operations.


Automatic Dependency Tracking

Automatic dependency tracking ensures that dependencies of installed packages are managed consistently.

Dependency Tree Maintenance

Packages installed as dependencies are tracked separately from user-requested packages to enable safe removal and upgrades.

Handling Orphaned Packages

Packages no longer required by any installed package are identified as orphaned and can be safely removed unless explicitly held.


Package Collections and Metapackages

Collections and metapackages group multiple packages to simplify installation of related software sets.

Role in Selection

Installing a metapackage triggers the installation of its associated package collection, influencing candidate selection to satisfy the collection.

Policy Implications

Policies govern how collections are maintained, upgraded, and pruned to avoid package bloat or dependency conflicts.


Virtual Provider Selection

Virtual packages represent abstract capabilities provided by one or more real packages.

Selection Criteria

When multiple providers are available, policies dictate which provider is selected based on priority, version, origin, or user preference.

Use Cases

Virtual provider selection enables flexibility and modularity in package management, allowing replacement of implementations without changing dependencies.


Multi-Version and Install-Only Policy

Some packages permit multiple versions to be installed simultaneously.

Policy Rules

Policies define which packages support multi-version installations and how conflicts are avoided.

Use Cases

This is common for language runtimes, libraries, or tools where different applications require different versions concurrently.


Together, these elements form a comprehensive framework that guides the package manager in making consistent, secure, and efficient decisions about package installation, upgrade, removal, and maintenance within a Linux system. The Package Selection and Policy ensures system integrity, user requirements, and operational goals are met through fine-grained, configurable rules and mechanisms.

Content in this section