OpenBSD pkg tools¶
- ID
pkg-tools- Home page
- Platforms
🅱️ BSD (OpenBSD only)
- Operations
installed·orphans·search·install·upgrade·upgrade_all·remove·cleanup- purl types
pkg:pkg-tools- CLI name
pkg_info- Extra search paths
/usr/sbin- Issues and PRs
- Source
OpenBSD’s pkg tools are the base system’s package suite, spanning three binaries: pkg_info (queries), pkg_add (install/upgrade) and pkg_delete (remove/cleanup).
Parsing notes, verified against the pkg_add/pkg_info/pkg_delete man pages (man.openbsd.org), the OpenBSD FAQ 15, and the OpenBSD::PkgInfo/Update Perl source:
None of the three binaries has a version flag (-V and -v mean progress/verbose): the suite ships with the base system and is versioned with the OS, so the version probe runs
uname -rinstead (like “7.7”).Package names fuse “stem-version” with OpenBSD’s pN patch suffix and optional flavor tails (unzip-6.0p17, unzip-6.0p17-iconv): the version capture starts at the last dash before a digit and absorbs any flavor tail.
Packages are located through /etc/installurl, configured by default on modern OpenBSD: there is no local index to refresh, hence no sync operation. Outdated is omitted too:
pkg_add -u -n -vinterleaves progress meters and can list several candidates per package, which defeats per-line parsing.-I forces non-interactive mode on every mutating call (the default is interactive on a terminal). Mutations need root: OpenBSD’s base convention is doas, but mpm’s escalation runs through sudo (available as a package).
What mpm adds to pkg-tools¶
Through mpm, pkg-tools gains --exact and --extended search, to narrow to exact names or match descriptions.
Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover pkg-tools alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.
Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.
Your pkg-tools commands, in mpm¶
You already know pkg-tools: each operation maps one-to-one onto mpm, in an interface shared by every manager.
To… |
With |
With |
|---|---|---|
List what’s installed |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
List orphaned dependencies |
|
|
Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.
Operations¶
Operation |
Supported |
Notes |
|---|---|---|
|
✓ |
|
|
||
|
✓ |
|
|
✓ |
exact and extended search backfilled by |
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
||
|
✓ |
|
|
Selecting and configuring pkg-tools¶
Deselect pkg-tools for a single run with --no-pkg-tools, or persist the choice in your configuration:
[mpm]
pkg-tools = false
Keep it enabled but tune how mpm drives it with a per-manager override:
[mpm.managers.pkg-tools]
timeout = 900
mpm config-template pkg-tools prints every overridable attribute as a ready-to-paste block.
Recipes¶
A few jobs you would otherwise script around pkg-tools, one mpm command each:
Snapshot and clone a machine:
mpm --pkg-tools dump pkg-tools.toml, thenmpm restore pkg-tools.tomlon the next one.Export a compliance SBOM:
mpm --pkg-tools sbom(CycloneDX by default,--spdxfor SPDX).
Privilege escalation¶
System-wide manager: mpm wraps its privileged operations in sudo out of the box. Instead of letting the tool prompt mid-run, mpm primes the credential cache up-front, with a single branded password prompt at most. Turn escalation off for rootless setups with --no-sudo or the per-manager sudo override.
Root is required for its cleanup_orphan, install, remove, upgrade, upgrade_all operations.
See privilege escalation for the full policy.
Cooldown¶
State of OpenBSD pkg tools’s release-age gating, from the cooldown support table:
Status: ❌ None (OpenBSD, per-release curated)
A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:
Registry: Distro binary archives (
pkg:deb,pkg:rpm,pkg:alpm,pkg:apk)Retraction: Index revert: removal is an archive operation and the mirror is rebuilt without the package. Debian, for one, requires filing an
RM:bug againstftp.debian.org(developers-reference)Publish date: ❌ the version string is the distro maintainer’s build, carrying no upstream publication date
With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.
Version probe¶
The version is probed by running:
$ uname -r
7.7
and extracted with:
r"^(?P<version>[\d.]+)"
Reference traces¶
Raw native outputs captured in the bundled definition: the reference mpm’s parsers were written against. If you know OpenBSD pkg tools well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ pkg_info -I -a
unzip-6.0p17 Extract files from ZIP archives
lunzip-1.14p0 Lzip decompressor
$ pkg_delete -a -I -n
autoconf-2.71p2: ok
automake-1.16.5: ok
$ pkg_info -Q {query}
lunzip-1.14p0
unzip-6.0p17 (installed)
unzip-6.0p17-iconv
Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --pkg-tools installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.
Changelog¶
7.4.0(2026-07-25)Their cleanup commands, both orphan sweeps (
cave purge,pkg_delete -a), are re-declared ascleanup_orphan:cleanup --orphansnow reaches them andcleanup --cacheleaves them alone.Plain
cleanupno longer removes orphaned packages: their native sweeps moved behindcleanup --orphans. This also stopsemerge’s cleanup from triggering its pre-depclean world upgrade unless--orphansis given.
7.2.0(2026-07-09)Add OpenBSD’s pkg tools (
pkg_add/pkg_info/pkg_delete) withinstalled,search,install,upgrade,removeandcleanupsupport; a bundled configuration-defined manager.