OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • Preserve the First Failure
        • Identify the Running System
        • Inspect the Package Source
        • Distinguish the Failure Class
          • No Installation Candidate
          • Missing Shared Library or Version Mismatch
          • Snapshot Mirror Lag
          • Signature or Checksum Failure
          • Interrupted or Partial Package
        • Restore the Normal Update Sequence
        • Check the Package Database After an Interruption
        • Verify Recovery

        Troubleshoot Package Installation and Update Failures

        Synopsis #

        OpenBSD packages are built for a specific architecture and base-system branch. Most pkg_add(1) failures result from an unsupported release, an unexpected package source, a base/package mismatch, temporary snapshot lag, an unavailable package or flavor, or an interrupted transaction.

        Start by recording the first error, then check the installed branch and package source before choosing a repair. It does not use force flags, unsigned repositories, database deletion, or manual library copying as general remedies.

        Preserve the First Failure #

        Run the failing command once with verbose output and record the complete result. Repeated retries can replace the useful first diagnostic with dependency or partial-package errors.

        doas pkg_add -v PACKAGE_STEM
        

        Replace PACKAGE_STEM with the requested package stem. Do not publish output that contains private mirror credentials, internal hostnames, or repository tokens.

        Identify the Running System #

        Record the kernel, architecture, and complete base-system identity:

        uname -a
          # Record the running kernel and architecture
        sysctl kern.version
          # Record the complete kernel build identity
        arch -s
          # Record the package architecture token
        

        A release system, a -stable system, and a -current snapshot do not select packages in the same way. The kernel and base userland must also belong to the same supported system state. If an upgrade was interrupted, complete the official base-system upgrade procedure before repairing packages.

        Inspect the Package Source #

        The default package source derives from installurl(5) :

        cat /etc/installurl
          # Display the configured mirror base URL
        env | grep -E '^(PKG_PATH|TRUSTED_PKG_PATH)='
          # Detect environment variables that override the default source
        

        An empty second command is normal. A stale PKG_PATH can silently select another release, a local directory, or an incomplete repository. Remove an unintended override from the calling environment or automation policy; do not rewrite /etc/installurl merely because one mirror request failed.

        Test name resolution and the configured mirror independently. ftp(1) reports HTTP, TLS, DNS, and connection failures without changing package state:

        ftp -o /dev/null https://cdn.openbsd.org/pub/OpenBSD/
        

        A successful general request does not prove that a specific release and architecture directory still exists. Supported-release status and snapshot publication remain separate checks.

        Distinguish the Failure Class #

        No Installation Candidate #

        Search the selected repository with pkg_info(1) :

        pkg_info -Q PACKAGE_STEM
        

        No result can mean that the stem is wrong, the package is unavailable on that architecture, the package moved or was removed, or the selected release no longer has a repository. Search by a shorter functional term and consult the current ports index. Do not download a package from another release or architecture.

        When several branches or flavors match, select one of the choices reported by the current package tools. Do not copy a versioned filename from an older article.

        Missing Shared Library or Version Mismatch #

        A missing base library can mean that an installation set was omitted or that the base and package states differ. A missing package library can mean that only part of a dependency set was updated.

        Review the system upgrade state and the installed package that owns the dependency. Do not create a compatibility symlink or copy a library from another host. On a release system, follow the release-specific upgrade page and then update all packages. On -current, update the base snapshot and packages as one coordinated maintenance event.

        Snapshot Mirror Lag #

        During a -current snapshot transition, the base snapshot and packages on a mirror can be temporarily out of sync. The official package FAQ recommends waiting for mirrors to catch up when that is the cause. Switching repeatedly among mirrors cannot create a package set that has not finished building.

        Signature or Checksum Failure #

        Stop on a signature failure. Confirm the system date, the exact repository, the installed package-signing keys, and whether a mirror transfer was incomplete. Do not bypass signature or checksum verification to install the package.

        Interrupted or Partial Package #

        List partial registrations without deleting them:

        pkg_info | grep '^partial-'
        

        The package FAQ explains that a later successful installation can complete an interrupted package, or the partial package can be removed deliberately. Preserve the original error and confirm no dependent operation is still running before either action.

        .libs-* packages retain shared libraries needed by installed or running software. They are not equivalent to abandoned temporary files and must not be removed by filename pattern.

        Restore the Normal Update Sequence #

        After the base system, architecture, and package source are correct, update the complete installed package set:

        doas pkg_add -u
        

        Then retry the requested package by stem. Managing Software: Packages and Ports describes normal installation, removal, and dependency cleanup. Updating and Upgrading OpenBSD describes the required base-system sequence.

        The -U option updates dependencies while adding a new package and can leave a partially updated set. It is not a substitute for restoring a consistent base and package branch.

        Check the Package Database After an Interruption #

        pkg_check(8) checks installed package registrations and can propose repairs:

        doas pkg_check
        

        Read every proposed change. Back up /var/db/pkg before accepting a repair that changes registrations, and preserve the command output. Do not delete /var/db/pkg, edit packing lists by hand, or use pkg_add -D failsafe controls without first understanding which safety check is being bypassed.

        Verify Recovery #

        After the repair:

        pkg_info PACKAGE_STEM
          # Confirm the intended package is registered
        doas pkg_add -u
          # Confirm the complete package set has no pending update failure
        doas pkg_check
          # Confirm package registrations and files are consistent
        

        Review package messages and restart only the services whose updated packages require it. Record whether the root cause was release support, source override, snapshot timing, package availability, an interrupted transaction, or an incomplete system upgrade so the same failure does not recur in automation.

        Report a bug
        • Synopsis
        • Preserve the First Failure
        • Identify the Running System
        • Inspect the Package Source
        • Distinguish the Failure Class
          • No Installation Candidate
          • Missing Shared Library or Version Mismatch
          • Snapshot Mirror Lag
          • Signature or Checksum Failure
          • Interrupted or Partial Package
        • Restore the Normal Update Sequence
        • Check the Package Database After an Interruption
        • Verify Recovery