Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios

Packaging Software

Single-page view · as markdown

Packages

Peios / Developing for Peios / Packaging Software

A package is how software is shipped on Peios: a set of files, symbolic links, and directories with a name, a version, and an architecture. ppk stores a package as a list of its paths and the content of each file, and names every piece by a hash of its content. That design explains why a packed version can never change and why files shared between packages take no extra space.

Manifests and blobs #

A package has two kinds of part:

  • Blobs. A blob is the content of one file, named by its SHA-256 hash. It doesn't record the file's path or name.
  • The manifest. A manifest names the package and lists every path in it. Each path is a file, given by its blob and whether it is executable; a symbolic link, given by its target; or an empty directory.

A directory that contains anything is implied by its contents, so the manifest lists only empty ones, and those with security metadata of their own. Of a file's permissions, the manifest keeps only whether it is executable.

The manifest for a package holding one program and one document looks like this:

name = "dev.peios.hello"
version = "1.0-1"
arch = "noarch"

[files]
"bin/hello" = { blob = "sha256:de7a5d81f4ab0680f55966b56e7bebfd5da26f4f45d8cd6e2e22c6a0e523c37f", exec = true }
"share/doc/hello/README" = { blob = "sha256:c90139667a35e240080ae250c1f99a5df3a6d509b0aa65b3d5550f87e20cb3a4" }

Paths are relative to /usr, where everything Peios ships lives, including the configuration it ships in /usr/etc. This package's bin/hello is /usr/bin/hello. A package can't ship anything outside /usr: a machine's own configuration and state live outside it, and stay the machine's. An absolute symbolic link target is read from the root of the system, so a link to /usr/lib/libz.so.1 names a file in the same or another package.

A package's identity #

A package's identity is the SHA-256 hash of its manifest, written as sha256: followed by the hash in hexadecimal. The manifest names every blob by its hash, so the identity covers the content of every file as well as the paths, names, and versions.

ppk writes a manifest in exactly one way: entries in a fixed order, with fixed spacing and quoting. The same directory therefore always produces the same manifest and the same identity. You can rebuild a package and compare identities to check that the result is identical.

Package identifiers #

You name a package with an identifier of this form:

<name>@<version>[?arch=<arch>]

<name> and <version> are the package's name and version. <arch> is the processor architecture its content is built for, such as x86_64 or aarch64. Use noarch for a package whose content runs anywhere, such as documentation or scripts.

If you leave out ?arch=, the architecture is the one ppk itself was built for. Give it explicitly for any package built for another machine, and always for noarch packages. The characters an architecture can contain are listed in ppk(1).

Package names #

A package's name is reverse-DNS: the domain of whoever owns the software, backwards, then the product. ppk refuses any other name, wherever one reaches it, including in a fetched manifest.

SoftwareNameExample
Peios's owndev.peios.<product>dev.peios.hello
A testing-only Peios productdev.peios.testing.<product>dev.peios.testing.fixture
Anyone else'sThe upstream project's domainorg.gnu.bash, io.github.eudev-project.eudev
Part of a split packageThe complete name of the base, with a suffixorg.gnu.glibc-devel

Use the upstream project's own domain for software that Peios only packages. A name doesn't rename anything: a program keeps its own executable, service, and other externally defined names.

A name has at least three labels, separated by dots, and at most 64 characters. Each label holds lowercase ASCII letters, digits, +, and -, starts with a letter or digit, ends with a letter, digit, or +, and has no --. The first label holds only letters, as a top-level domain does, and neither of the first two holds a +.

ppk can only check a name's form. It can't tell whether a domain is the right one for the software, or whether a split keeps its base's name, so those are for whoever writes the package.

Package versions #

A version has three parts, written [<epoch>:]<upstream>-<revision>:

  • Upstream version. The version the software's own project gave it, such as 2.44 or 1.0-rc.1. It holds ASCII letters, digits, ., +, -, and ~, and starts with a letter or digit.
  • Revision. Which packaging of that upstream version this is, starting at 1. Pack a new revision when the package changes but the software doesn't. Every version has one: 2.44-1, never 2.44.
  • Epoch. An optional number before a colon, as in 1:0.5-1, that's raised only when an upstream project's versions go backwards, so that the new ones sort after the old.

Versions sort by epoch, then upstream version, then revision. Upstream versions compare a run of digits or letters at a time, with digits as numbers, so 2.10 comes after 2.9. A pre-release sorts before its release: anything after a ~, and dev, alpha or a, beta or b, pre, and rc, in that order, so 1.0~rc1-1 and 1.0-rc.1-1 both come before 1.0-1. This is the order of PSPU 5.6, the same as the earlier Peios package tools used.

What else a manifest says #

Besides its files, a manifest can record what the package needs and offers, and describe it:

PartWhat it records
[dependencies]Other packages this one needs, each with the versions it can use
[requires]Capabilities this one needs, such as the library libc.so.6 or a shell, sh
[provides]Capabilities this one offers, each at a version or none
[claims]Links this package provides besides its files, such as /usr/bin/sh
description, homepage, license, license_class, source_licenseWhat the package is and its terms
sourceThe package holding the source it was built from

They're part of the manifest, so they're part of the package's identity, and like the files they have one spelling each. A package that records none of them has the same manifest it would have had without them. To record them, see Recording Dependencies and Metadata.

Security metadata #

A file or directory can carry security metadata in its manifest entry:

  • A security descriptor, which replaces the one it would otherwise get, so that, for example, only one service can run a program or write a directory.
  • A signature, for a file. The kernel reads it from the file's security.peios.sig attribute and checks it before it gives the file to a device as firmware. The signature is stored as a blob, and the entry names it by its hash.

These entries, with the descriptor shortened, are from a package that gives one content both ways:

"bin/server" = { blob = "sha256:07f7ab476bc3a83fad639d34a012cb4a5f859441f0d24c11627ca96696839012", descriptor = "0100048014000000…" }
"lib/firmware/acme/fw.bin" = { blob = "sha256:07f7ab476bc3a83fad639d34a012cb4a5f859441f0d24c11627ca96696839012", signature = "sha256:ec87928fa1c24dacf5ebe2eaf8f7adf473de9ef65f8b7648ead92e9f7672155b" }

The metadata is part of the entry, so it's part of the package's identity. A file with security metadata is stored as a file of its own that carries it, and every hard link to that file carries it too. Two files with the same content and different metadata are two stored files, and two packages can't give one path different metadata. A package with no security metadata has the manifest it would have had without it.

On Peios, ppk gives each file and directory its metadata as it creates it. On another system, such as a Linux host that builds packages, it writes the attributes only where that system lets it, which usually needs privilege, and otherwise warns that it couldn't. The manifest records the metadata either way. To give files security metadata, see Giving Files Security Metadata.

The artifact directory #

ppk stores packages in an artifact directory, which is /system/artifacts unless you name another. It holds these kinds of file:

PathContents
blobs/sha256/<hash>The content of one file that isn't executable
blobs/sha256/<hash>.execThe content of one executable file
blobs/sha256/<hash>.<entry>The content of one file with security metadata, which it carries
manifests/sha256/<hash>One manifest, named by its hash
refs/<name>/<version>/<arch>The identity of the package with that name, version, and architecture

A blob is stored in the form its manifest entries need: plain, executable, or both if the same content is shipped both ways. A file with security metadata has a form of its own, named by the SHA-256 hash of its entry as the manifest writes it. The form is part of the stored file, not of the blob's name, so a package's identity doesn't depend on it.

A ref is an index. It lets you find a package by name, but every manifest records its own name, version, and architecture, so the manifests remain the authority.

Because a blob is named by its content, a file that appears in several packages, or in several versions of one package, is stored once. Packing a new version adds blobs only for the files that changed.

An artifact directory is also where other machines get packages from. ppk fetch copies a package out of one artifact directory into another, checking every hash on the way; see Fetching a Package.

Packed versions never change #

Once a package is packed, its name, version, and architecture always mean the same content. Packing the same version again with identical content succeeds and changes nothing. Packing it with any change to its files is refused, so that a version means one thing everywhere it is used. To ship a change, give it a new version.

Every file in the artifact directory is read-only for the same reason: a blob, manifest, or ref that changed after it was written would stop matching what refers to it.

Who can read a package #

Everyone on a machine can read and run what's in its artifact directory. ppk gives every file it stores a security descriptor that grants Everyone read and execute, and SYSTEM and Administrators full control. The directories it creates there grant the same, so any user can reach the packages. A file or directory that a package gives a descriptor of its own has that one instead, wherever it's placed.

A package is the same on every machine it's installed on, because its content is named by hash. It can't hold anything that belongs to one machine or one user, and anything in it is readable by every user of every machine that stores it.

Important

Never put a secret, such as a key or a password, in a package. Keep secrets in the machine's own configuration instead.

Closures

Peios / Developing for Peios / Packaging Software

A closure is a set of packages composed into one directory tree: the contents of a /usr. Mounted at /usr, each package's files are at their ordinary paths, such as /usr/bin/hello, so software runs from a closure without any changes to where it looks for its files. Different closures can hold different versions of the same package side by side.

A tree of hardlinks #

Unless you ask for copies, every package file in a closure is a hardlink to its blob in the artifact directory: the same file on disk, not a copy. Building a closure therefore copies no file content, and a file that several closures share is stored once.

A hardlink shares everything about the file except its name, including whether it is executable. That's why the artifact directory stores an executable form of each executable blob, as described in Packages. For the same reason, everything in the artifact directory is read-only: a change made through one closure would change the file in every closure that links it.

Symbolic links and directories aren't shared. ppk closure creates them afresh in each tree. The root of the tree grants everyone read and execute, and the directories and links inside it inherit that, so any user can reach and run what a closure holds. Its files have the access their blobs grant, described in Packages.

Why each package is there #

Each closure records why it holds each package, in its inventory: a file at the top of its tree, visible as /usr/inventory when it's mounted. ppk compose-env writes the same file in the root's usr. It's a line format:

closure sha256:9c41…
org.openssl.libssl@3.5.8-1?arch=x86_64 sha256:… [se.curl.curl libssl.so.3]
se.curl.curl@8.22.0-1?arch=x86_64 sha256:… [* >=8.22]

The first line names the closure. Each other line is a package: its full ID, its identity, and a bracket for each thing that wants it.

  • Who wants it: * for a request made of the closure itself, such as a package named after ppk run -p or in a profile, or the name of another package in the closure.
  • What it asked for: a capability, such as a library's soname, if the package wasn't asked for by name.
  • Where from: # and an index or channel, such as #stable, for a request that named one.
  • Which versions would do: one token per expression of the constraint, such as >=8.22, or none for any version.

A package is wanted by every request, dependency or requirement it satisfies. Every package in a closure must be wanted by something, and every request satisfied. Lines are sorted by package ID, and brackets by who wants the package, * first.

This generated file has mode 0444 and inherits the tree's security descriptor, like directories without manifest metadata.

Naming a closure #

A closure's identity is the SHA-256 hash of its inventory without the first line. So the same packages, asked for the same way, always make the same closure, whatever order you name them in. The same packages asked for differently, such as * asking for curl exactly in one and only through another package in the other, are two closures.

Closures are kept in the closures directory of the artifact directory unless you name another. The tree is closures/<hash>/, and its manifest, the same lines as the inventory without the first, is closures/<hash>.manifest.

Because the name is known before anything is built, ppk closure reuses a closure that already exists. It builds a new tree in a temporary directory and moves it into place only when it's complete, so a closure that exists is never half-built.

A closure can also be given a name of your own with ppk name:

ppk name SYSTEM sha256:9c41…   # SYSTEM now names that closure
ppk name SYSTEM                # print the closure SYSTEM names
ppk name                       # list every name
ppk name --remove SYSTEM       # remove the name; the closure stays

A name is a symbolic link beside the closures, replaced by renaming, so it always names one closure or another. An installed system names the closure that is its /usr SYSTEM, and the one its initramfs is built from INITRAMFS.

Identifying the mounted closure #

ppk list checks that the inventory's identity is the hash of its other lines before printing the packages. This checks the recorded packages and requests; it doesn't authenticate the package IDs or verify the files in the tree.

Run ppk list to print the current closure's full package IDs in byte order, one per line. No artifact directory is needed. Run ppk list --all to list every package indexed by the store's refs, also sorted by full ID. A package whose ID and identity are both in the current closure has * before its ID; other packages have a space there, so every ID starts in the same column.

A missing inventory makes ppk list fail with an explanation. With --all, a missing inventory leaves every package unmarked. A malformed inventory or mismatched closure identity makes either command fail.

An existing closure without an inventory is reused unchanged as a closure built by an older ppk. To obtain an inventory, compose a fresh root or use a separate closure directory. Reusing a closure keeps requiring only read access to its tree.

Conflicts #

Packages in a closure share one tree, so they have to agree about every path in it. Building a closure fails, before anything is written, when:

  • Two packages give one path different contents. Two packages can ship the same file only if it is identical, such as a shared license text.
  • A path lies beneath another package's file or symbolic link. One package can't put files inside something another package ships as a file. This also means a closure is never written through a symbolic link to somewhere outside it.

A package can put files in an empty directory that another package ships.

The same mount #

A hardlink can't cross from one mount to another, even between two mounts of one filesystem, as the bind mounts of a build sandbox often are. So the closure directory must be on the same mount as the artifact directory, and ppk closure fails with nothing left behind if it isn't.

Copied files #

To build a closure on another mount, ask for copies with --copy-files. The tree then has the same paths, content, and permissions, and the same identity, but each file is a file of its own. ppk copies a file only when you ask, rather than whenever a link fails, because a copy differs from a hardlink in ways you should choose:

  • It takes space. A copy is stored once per closure, not once per store.
  • It has a security descriptor of its own. A hardlink has its blob's one descriptor, so the store controls access to every closure that links it. A copy gets the store's descriptor when it's made, so it grants what a hardlink would, but a later change to the store's descriptors doesn't reach it.
  • It is checked. A copy has to read the blob, so ppk hashes it as ppk fetch does, and a blob that doesn't match its hash stops the build. Hardlinking reads no content, and checks none.

A closure is named by its packages, not by how its files got there, so ppk closure reuses an existing closure whichever way it was built.

Environments

Peios / Developing for Peios / Packaging Software

An environment is a view of the filesystem in which a closure is /usr. Everything Peios ships lives under /usr, so a program in an environment finds the exact set of packages the closure holds, while everything else, such as the machine's own configuration, its state, and your home directory, stays where it was. Different programs can run side by side with different closures as their /usr.

What changes and what doesn't #

An environment starts from the filesystem as the process that creates it sees it, and replaces only /usr with the closure. Directories such as /lcl, /var, /home, and /run are the same ones, so a program in an environment reads the machine's configuration and shares /run with the rest of the machine.

Packages are laid out relative to /usr for this reason: a package's bin/hello is /usr/bin/hello in any environment that includes it, and a package can't place anything outside /usr.

Kept to its own processes #

An environment is a mount namespace: a private copy of the table that says which filesystem is mounted where. ppk run creates one, mounts the closure at /usr in it, and starts the command there. The command and every process it starts see the closure; nothing outside sees any change, and when the last of them ends, the environment ends with it.

Each ppk run creates a new environment, even for the same closure. The closure itself is built once and reused.

Laid out as files #

An environment can also be laid out as a directory, as the whole root of a filesystem, for a tool such as an image builder to take. ppk compose-env does this. There is no running system around such a root to borrow the rest of the filesystem from, so what lies outside /usr, such as links and mount points, is given when the root is composed. It belongs to the environment, not to any package.

Described by a profile #

An environment profile is a TOML file that describes an environment, so that it can be named and reused rather than spelt out on the command line each time:

dirs = ["proc", "sys", "tmp"]

[packages]
"net.busybox.busybox" = "1.37.0-1"
"dev.peios.prelude" = ">= 0.0.7"

[symlinks]
"init" = ":sbin/prelude"

packages maps each package the environment asks for to the versions that will do, as a constraint. A bare version asks for exactly that version, and "" for any. "#stable" asks for the version a repository's stable channel holds, and "#stable >= 1.36" for that version if it satisfies the constraint; see Publishing a Repository. A profile holds the requests, not their answer: composing it resolves them, choosing a version of each package they need, and the closure's inventory records what was chosen. The same requests against the same packages always resolve the same way. A profile that asks for exact versions of everything, as ppk resolve writes one, always describes the same environment. symlinks and dirs are what the root holds outside /usr, besides any links its packages claim there, and a leading : in a link's target stands for usr. include_artifacts = true gives a composed root its packages in an artifact directory of its own. Every key is optional. arch sets the architecture of every package, the one ppk was built for by default.

A profile can include other profiles, called fragments, so that what several environments share, such as the layout of a root, is written once:

include = ["root-layout.toml"]

[packages]
"net.busybox.busybox" = "1.37.0-1"

Each path is relative to the file that names it, and a fragment can include others. The profile holds everything its fragments hold. Where two of them hold the same thing, it's held once, and where they disagree, as with two versions of one package or two targets for one link, it's an error naming both files. Nothing decides which one wins: you change one of them.

ppk compose-env and ppk run both take profiles, and several given together merge as fragments do. A run keeps the rest of the filesystem as it is, so it uses only the profiles' packages.

Who can create one #

Any process can create a mount namespace of its own and mount a closure in it, so ppk run needs no privilege. Building a closure needs write access to the closure directory, but running one that already exists only reads the store, so an ordinary user can run any closure an administrator has built.

The closure is mounted as it is, not read-only: making a mount read-only needs a privilege that ordinary users don't hold. Its files are protected by their security descriptors instead, which grant everyone read and execute and nothing more.

Creating a Package

Peios / Developing for Peios / Packaging Software

Packing turns a directory of files into a package in an artifact directory. Do this when you have built software and want to ship it as a named, versioned package. For what a package contains, see Packages.

Before you start #

The top-level name inventory is reserved for ppk's closure inventory. Do not include a file, directory, or symbolic link with that name in the package's input tree, or claim /usr/inventory or a path beneath it. ppk pack refuses these paths before writing to the store.

  • Install ppk.
  • Choose the package's version, the architecture its content is built for, and its name, which must follow the rules for package names.
  • Have write access to the artifact directory. The default is /system/artifacts; to use a directory of your own, pass --artifact-dir.

Pack a directory #

  1. Stage the package's files in a directory, laid out as they will appear under /usr. For example, a program installed as /usr/bin/hello goes at hello/bin/hello.

  2. Make sure each program in the directory is marked executable. The package records which files are executable and nothing else about their permissions.

  3. Run ppk pack with the package's identifier and the directory:

    ppk pack 'dev.peios.hello@1.0-1?arch=noarch' hello --artifact-dir artifacts
    

    Quote the identifier, because some shells treat ? as a wildcard. ppk prints the package's identity:

    sha256:73a137f612f39b8ee1ffcbb7f51b7b9dc370b8662323d72b9e6b73b9d54413f8
    

Check the result #

Read the package's ref, which is named by its name, version, and architecture:

cat artifacts/refs/dev.peios.hello/1.0-1/noarch

It holds the identity that ppk pack printed:

sha256:73a137f612f39b8ee1ffcbb7f51b7b9dc370b8662323d72b9e6b73b9d54413f8

The manifest is artifacts/manifests/sha256/ followed by the same hash. It lists every path in the package.

Packing for another architecture #

If the content is built for a particular processor, name its architecture in the identifier:

ppk pack 'dev.peios.hello@1.0-1?arch=aarch64' hello-aarch64 --artifact-dir artifacts

Without ?arch=, ppk uses the architecture it was built for itself. The same name and version can be packed once for each architecture.

Shipping a change #

A packed version never changes. If you pack the same version again with different files, ppk refuses and exits with status 1:

ppk: dev.peios.hello@1.0-1?arch=noarch: already packed as sha256:73a137f612f39b8ee1ffcbb7f51b7b9dc370b8662323d72b9e6b73b9d54413f8; a packed version cannot be replaced

Pack the changed files as a new version instead, such as dev.peios.hello@1.1-1?arch=noarch. Only the files that changed are stored again. Packing a version again with identical files succeeds and prints the same identity.

Recording Dependencies and Metadata

Peios / Developing for Peios / Packaging Software

A package's manifest can say what the package needs, what it offers, and what it is, as well as listing its files. Record these when you pack it, so that whatever builds an environment from packages can choose the ones that work together. For what a manifest holds, see Packages.

Before you start #

  • Be able to pack the package, as Creating a Package describes.
  • Know what the package needs at run time that isn't in its own files and that its programs don't link: the packages and commands it runs by name or loads itself. ppk pack finds the libraries its programs link, as What ppk pack finds in the files describes.

Record what the package needs and offers #

Give ppk pack an option for each thing to record. The options that take two values take them as two separate arguments, so neither value needs a separator. An empty value means "any version" for a dependency or requirement, and "no particular version" for something provided:

ppk pack 'org.git.kernel.dash@0.5.13.5-1?arch=x86_64' dash --artifact-dir artifacts \
  --depends org.gnu.glibc '>= 2.44' \
  --provides sh '' \
  --claims /usr/bin/sh dash
  • --depends <name> <constraint> records a dependency on another package, by its name.
  • --requires <name> <constraint> records a need for a capability rather than a particular package: a name such as the shell sh, or pkgconfig(zlib), which any package can provide. A library that a program links is found for you.
  • --provides <name> <version> records a capability this package offers.
  • --claims <path> <target> records a link at an absolute path that the package provides besides its files, with the link's target. Use it for a name that one of several packages answers, such as /usr/bin/sh.

Give each option once for each package, capability or path. A name given twice is an error.

What ppk pack finds in the files #

ppk pack reads each ELF program and library in the files, and adds what they need and offer to what the options give:

  • Each library a program or library links (its DT_NEEDED) becomes a requirement, such as libtinfo.so.6. A library the package itself provides isn't required.
  • Each library's own name (its DT_SONAME) becomes a capability the package provides.
  • For glibc's libraries and libgcc_s.so.1, the requirement has a floor: the newest symbol version the programs use. A program using GLIBC_2.38 requires libc.so.6 >= 2.38. The package providing the library provides it at its own version, such as 2.44-1.
  • For libstdc++.so.6, each symbol version is a capability of its own, such as elfver(libstdc++.so.6:GLIBCXX_3.4.21).

Files under src/ and symbolic links aren't read, nor is anything that isn't ELF.

Where an option names a capability that the files also give, the option's entry is kept. The floors are the exception: they come only from the files, so don't write them yourself. A floor written by hand tends to record what the package was built against, not what it needs, and it would keep the package off a system with an older glibc that would run it. To require a newer glibc for a reason the symbols don't show, depend on the glibc package with --depends and say why in the recipe.

The rules in full are under DERIVATION in ppk(1).

Write a constraint #

A constraint is one or more expressions, separated by commas, that a version must all satisfy:

ConstraintSatisfied by
>= 2.442.44 and later, whatever the revision: 2.44-1, 2.44-3, 2.45-1
>= 2.44-32.44-3 and later, but not 2.44-2
>= 1.0, < 2.01.0 and later, before 2.0
= 2.44-1 or 2.44-1Exactly 2.44-1
!= 2.43Anything but upstream version 2.43
EmptyAny version

The operators are =, >, >=, <, <=, and !=, and a version without one means =. A version in a constraint can leave out its revision, and the revision then isn't compared. That's usually what you want: repackaging the same upstream version shouldn't change whether a dependency is met. Versions compare as Package Versions describes.

Describe the package #

Add the descriptive options to the same command:

  --description 'POSIX-compliant shell' \
  --homepage https://git.kernel.org/pub/scm/utils/dash/dash.git \
  --license BSD-3-Clause \
  --license-class free
  • --description is one line of printable ASCII.
  • --homepage is an http or https URL.
  • --license is the package's license, conventionally an SPDX expression, and --source-license the license of the source it was built from, where that differs.
  • --license-class is free, firmware, proprietary, or unknown, the default.
  • --source names the package holding the corresponding source the package was built from, as a package ID with its architecture, such as org.git.kernel.dash-source@0.5.13.5-1?arch=noarch. A package built from no source of its own, such as device firmware, leaves it out.

Check the result #

ppk pack prints the package's identity. Its manifest, in artifacts/manifests/sha256/ followed by that hash, records everything you gave and everything found in the files, in one fixed order:

name = "org.git.kernel.dash"
version = "0.5.13.5-1"
arch = "x86_64"
description = "POSIX-compliant shell"
homepage = "https://git.kernel.org/pub/scm/utils/dash/dash.git"
license = "BSD-3-Clause"
license_class = "free"

[claims]
"/usr/bin/sh" = "dash"

[dependencies]
"org.gnu.glibc" = ">= 2.44"

[provides]
"sh" = ""

[requires]
"libc.so.6" = ">= 2.38"

[files]
"bin/dash" = { blob = "sha256:e4a76dc6517a94c9f1abde8582aa3909a1315e28a66a5c9f304c5a697b74c638", exec = true }

The requirement on libc.so.6 comes from bin/dash, which uses symbols as new as GLIBC_2.38. Each constraint is written in one form, whatever spacing you gave it, and anything that wasn't given or found is left out.

When an option is refused #

ppk pack checks everything before it writes anything. Anything that breaks a rule is a usage error, with exit status 2, and nothing is packed. A dependency must name a package, so a capability given to --depends is refused:

ppk: dependencies: invalid package name 'sh': use a reverse-DNS name such as dev.peios.hello, of at most 64 characters, with at least 3 dot-separated labels of lowercase ASCII letters, digits, - and +

Use --requires for it instead. A constraint that doesn't parse names its option:

ppk: --depends org.gnu.glibc: constraint '>=2.44,' has an empty expression

A floor on one of glibc's libraries or libgcc_s.so.1 fails, with exit status 1, because only the files can say what it is. The message names what you wrote and what the files need:

ppk: requires libc.so.6: the written floor '>= 2.44' is refused, and the payload needs '>= 2.38' (bin/dash); a floor on libc.so.6 comes only from the payload's symbol versions

An ELF file that ppk pack can't read fails in the same way, naming the file.

The full rules for each value are in ppk(1).

What ppk does with them #

The dependencies, requirements, capabilities and claims you record are part of the package and its identity, and ppk checks them when it reads a manifest.

  • ppk resolve follows dependencies and requirements to choose the packages an environment needs, as Choosing Packages for an Environment describes. A requirement is met by a package of that name or one that provides the capability; a dependency only by a package of that name.
  • Composing creates each claimed link: under /usr in the closure, and elsewhere, such as /init, in a composed root. Two packages in one environment can't claim the same path. A closure is only /usr, so ppk run creates only the links claimed there.

Changing any of them changes the package, so it needs a new version, as a change to its files does.

Giving Files Security Metadata

Peios / Developing for Peios / Packaging Software

Most files in a package get the security descriptor that ppk gives everything it stores. Some need one of their own: a program that only one service can run, or a directory that only one service can write. Firmware needs a signature, which the kernel checks before it gives the firmware to a device. Record both when you pack the package, and ppk gives each file and directory its metadata wherever it places it. For what a manifest holds, see Security metadata.

Before you start #

  • Be able to pack the package, as Creating a Package describes.
  • Have each descriptor as a self-relative security descriptor in hexadecimal, with an owner, a group, and a DACL. ppk takes the descriptor's bytes, not SDDL.
  • Have each firmware file's signature: the 3310-byte file that a signer writes beside the file, named with .peios.sig added.

Give a file or directory a descriptor #

Give ppk pack the --descriptor option with the path, as the manifest lists it, and the descriptor. The two values are separate arguments:

ppk pack 'dev.peios.gxwi@1.0-1?arch=x86_64' gxwi --artifact-dir artifacts \
  --descriptor bin/gxwi-server 010004801400000020000000000000002c000000...

The descriptor is shortened here. Give the option once for each path. The path is relative to /usr, so bin/gxwi-server is /usr/bin/gxwi-server.

  • A file keeps its descriptor in every closure and environment, because each placed file is a hard link to a stored file that has it, or a copy given it.
  • A directory with a descriptor is listed in the manifest even if it has contents. It's created with its descriptor before anything inside it, so what's created in it inherits from that descriptor.
  • A symbolic link can't have a descriptor of its own.

Sign a file #

Put each signature in the directory you pack, beside the file it signs, with .peios.sig added to the file's name:

gxwi/lib/firmware/acme/fw.bin
gxwi/lib/firmware/acme/fw.bin.peios.sig

ppk pack doesn't pack the signature as a file. It records it in the signed file's entry, and the file gets it as its security.peios.sig attribute wherever it's placed. A signature must be exactly 3310 bytes and start with the version byte, 1. The file it signs must be a regular file in the same package, and not an ELF file: an ELF file carries its signature in its own .peios.sig section. No other path can end in .peios.sig.

ppk doesn't check what a signature signs. That's the kernel's job, when it loads the file.

Check the result #

ppk pack prints the package's identity. In its manifest, in artifacts/manifests/sha256/ followed by that hash, each file and directory with security metadata has it in its entry, after its blob or dir:

"bin/gxwi-server" = { blob = "sha256:07f7ab476bc3a83fad639d34a012cb4a5f859441f0d24c11627ca96696839012", exec = true, descriptor = "010004801400000020000000000000002c000000..." }
"lib/firmware/acme/fw.bin" = { blob = "sha256:07f7ab476bc3a83fad639d34a012cb4a5f859441f0d24c11627ca96696839012", signature = "sha256:ec87928fa1c24dacf5ebe2eaf8f7adf473de9ef65f8b7648ead92e9f7672155b" }

The descriptor is written in lowercase, whatever case you gave it, and is shortened here. The signature is named by its hash, and stored as a blob.

Packing on a system other than Peios #

On Peios, ppk gives each stored file, copy, and directory its metadata as it creates it, and fails if it can't. On another system, such as the Linux host that builds packages, it writes the security.peios.sd and security.peios.sig attributes only where that system lets it, which usually needs privilege. Where it can't, it packs the files without them and warns:

ppk: warning: 2 files and directories lack security metadata this system would not let ppk give; their manifests record it

The package is still complete: its manifest records the metadata, and ppk fetch on Peios gives each stored file what its entry records. ppk closure, ppk compose-env, and ppk run warn in the same way when they place files that lack it.

Note

On Peios, a stored file's descriptor can't be read back as it was given, so ppk doesn't give a descriptor to a stored file that was stored elsewhere without one. Fetch the package on Peios, or copy its files with --copy-files, so that each gets its descriptor as it's created. A missing signature is given whenever the file is placed.

When something is refused #

ppk pack checks everything before it writes anything. A descriptor that isn't hexadecimal, or isn't a whole self-relative descriptor, is a usage error, with exit status 2:

ppk: --descriptor bin/gxwi-server: security descriptor has no owner or no group

These fail with exit status 1, and nothing is packed:

  • A descriptor for a path that isn't a file or directory of the package, or for a symbolic link.

  • A signature that isn't 3310 bytes, or doesn't start with version 1.

  • A signature beside nothing, or beside a symbolic link, or an ELF file:

    ppk: "bin/tool.peios.sig": signs "bin/tool", an ELF file, which carries its signature in its .peios.sig section
    
  • Anything else whose name ends in .peios.sig.

ppk closure and ppk compose-env refuse two packages that give one path entries that differ only in their security metadata, as they refuse any other two different entries. A stored file whose signature attribute isn't the one its entry names is an error, because it isn't the file its name says. The full rules are under SECURITY METADATA in ppk(1).

Fetching a Package

Peios / Developing for Peios / Packaging Software

Fetching resolves a package and everything it needs from another artifact directory, or from a repository served over HTTP, then copies the chosen packages into yours and checks them on the way. Do this to use a package that was packed somewhere else, such as on a build machine whose artifact directory you can read, or one a repository publishes.

Before you start #

  • Install ppk.
  • Have read access to the source: an artifact directory, as a local path, or a repository's URL.
  • Have write access to your artifact directory. The default is /system/artifacts; to use a directory of your own, pass --artifact-dir.
  • Know the package's name, such as org.figlet.figlet.

Fetch the package #

Run ppk fetch with the name and the source:

ppk fetch org.figlet.figlet --from shared --artifact-dir artifacts

ppk chooses the newest version that satisfies the request, follows its dependencies and requirements, and fetches every chosen package. It prints one identity per package fetched, in package-name order:

sha256:73a137f612f39b8ee1ffcbb7f51b7b9dc370b8662323d72b9e6b73b9d54413f8

To constrain the version, quote the name and constraint, for example 'org.figlet.figlet >= 2.2'. A full ID such as 'org.figlet.figlet@2.2.5-1?arch=x86_64' pins that exact package, including the version's spelling. Its dependencies are still resolved. Unqualified requests choose for ppk's own architecture; --arch selects another. All packages in one resolution must be for the same architecture. A full ID with an explicit architecture can select that architecture on its own.

Resolution is greedy, as ppk resolve is. Missing dependencies, missing capability providers and conflicting constraints fail with an error naming what is needed, before copying starts.

To copy exactly one package without resolving anything it needs, pass --no-deps and a full ID. This mode accepts IDs, with an optional ?arch=…, rather than bare names or constraints:

ppk fetch --no-deps 'dev.peios.hello@1.0-1?arch=noarch' --from shared --artifact-dir artifacts

--from also takes the URL of a repository served over HTTP, such as https://pkgs.peios.org/. --from takes no identity, so ppk checks every file against its hash but can't check who signed the repository. To check that too, add the repository with its identity, using ppk repo add.

Check the result #

Compare the identity with the one ppk pack printed where the package was made. Because the identity is the hash of the manifest, and the manifest names every file by its hash, the same identity means the same package, byte for byte.

Fetch from configured repositories #

A machine keeps a list of the repositories it fetches from, each a file in /conf/ppk/repositories/. Add one with ppk repo add, giving the identity its pointer file must be signed under, and the channel it follows:

ppk repo add peios /mnt/peios-repo --identity pkgs.peios.org --track stable

ppk accepts the signature only if a root it was built with vouches for the chain that made it. A repository whose publisher has no such chain signs under a top-level certificate of its own, which you enable on the machine first. Add that repository with --unrooted, and optionally with --anchor and the top-level's hash, to accept that top-level and no other:

ppk repo add tools https://pkgs.example.com/ --identity pkgs.example.com --unrooted

That writes /lcl/conf/ppk/repositories/peios.toml, which /conf/ppk merges with whatever the system ships. Then fetch without --from:

ppk fetch se.curl.curl

A repository served over HTTP is added by its URL instead of a path. Give more than one URL to try them in order, such as a cache on your network first and the repository's own server after it:

ppk repo add peios http://cache.lan/peios/ https://pkgs.peios.org/ \
    --identity pkgs.peios.org --track stable

If a URL can't be reached or doesn't have a file, ppk tries the next one. ppk keeps the tree nodes and manifests it reads from a repository served over HTTP in /var/cache/ppk, so it reads each of them only once. Pass --cache-dir to keep them somewhere else.

A request for a bare name, or a name with a constraint, follows the channel its repository tracks, so this fetches the version stable holds, and what it needs from stable too. Naming an index, as in se.curl.curl#leading, or an exact version, takes that instead.

Each package name belongs to one repository. If two of them publish one, for something you asked for or something it needs, ppk refuses rather than choose. A repository's pointer file goes up in sequence each time it's published, and ppk keeps the highest it has seen of each in /var/state/ppk, refusing a repository that offers an older one. A mirror might still be behind; ppk repo list shows when each was signed:

peios /mnt/peios-repo #stable (sequence 42, signed 2026-11-13T13:11:46Z, signature checked)

What fetch checks #

ppk fetch trusts nothing it reads from the source:

  • The manifest must hash to the identity in the source's ref.
  • Its form must be exactly what ppk pack writes, naming the package you asked for, with every path relative and inside the package's root.
  • Each file's content must hash to the name the manifest gives it.

If a check fails, ppk fetch stops with an error and doesn't record the package. Only the files missing from your artifact directory are copied, so fetching a new version transfers only what changed.

These checks prove that the package is the one the source's ref names. They don't prove who published it, so fetch only from sources you trust. A configured repository with an identity proves that too: a package must be in the catalog its signed pointer file leads to, at the identity the catalog gives, so a package it didn't publish, or a ref changed since, is refused.

A repository served over HTTP has no refs that ppk can list, so its catalog says which packages it has. To choose packages, ppk reads only the catalog's entries for the names it needs and each version's summary: the start of its manifest, which says what the package needs and provides but not what files it holds. A catalog also lists what provides each capability, so finding a library by its soname reads no more than that. ppk reads a manifest only when it fetches the package, and refuses one that doesn't begin with the summary it chose the package by.

ppk checks every file it reads from the repository against its hash before using it, and checks the pointer file's signature. A file that fails its check is an error: ppk doesn't try the next URL, because a server that sends the wrong file is broken or hostile. A file that fails its check is never stored.

A repository can keep its blobs compressed, as an export does, and its pointer file says so. ppk decompresses each blob as it fetches it and checks what it decompresses to, so your artifact directory always holds the files uncompressed.

When the package is already present #

By default, a chosen package already present with the same identity is skipped without writes or output. Its dependencies are still resolved and fetched if missing. With --no-deps, fetching it checks the package, copies any missing files, and prints its identity as before. If your artifact directory has a different package under the same name, version, and architecture, ppk fetch refuses to replace it:

ppk: dev.peios.hello@1.0-1?arch=noarch: already present as sha256:73a137f612f39b8ee1ffcbb7f51b7b9dc370b8662323d72b9e6b73b9d54413f8, but other has sha256:453a10dad4cb1902912919527452fa61c6420ae9152c1f02b57c1421a6d9d57b

A packed version never changes, so two different packages under one version mean the two artifact directories disagree. Find out which one is right before you use the package.

Replace a package in a bootstrap's directory #

A bootstrap builds its first packages with another system's tools, then rebuilds them with its own at the same versions. Its artifact directory isn't published until every package has been rebuilt, so nothing relies on the first builds yet. To replace one, pass --replace --no-deps with its ID:

ppk fetch 'dev.peios.hello@1.0-1?arch=noarch' --from rebuilt --artifact-dir bootstrap --replace --no-deps

The ref then names the fetched package. The replaced manifest and its files stay in the directory. Replacement requires --no-deps so that it affects only the named package. Every check above still applies. Don't use --replace on an artifact directory anything has fetched from: that breaks the rule that a version never changes.

Building a Closure

Peios / Developing for Peios / Packaging Software

Building a closure composes packages into one directory tree, the contents of a /usr. Do this when you want a set of packages together in one place, for example to check that they fit together without conflicts. For how closures work, see Closures.

Before you start #

  • Install ppk.
  • Have every package in your artifact directory, by packing it with ppk pack or fetching it with ppk fetch.
  • Have write access to the artifact directory. The default is /system/artifacts; to use a directory of your own, pass --artifact-dir.

Build the closure #

Run ppk closure with the identifier of each package:

ppk closure 'dev.peios.hello@1.0-1?arch=noarch' 'dev.peios.greetings@2.0-1?arch=noarch' --artifact-dir artifacts

ppk prints the closure's identity:

sha256:fe5cf307f0b70379e1ec36b0d8dca659782446b0d13e7140c1257cd855ba61c4

Check the result #

The closure's tree is in the closures directory of the artifact directory, named by the hash in the identity:

ls artifacts/closures/fe5cf307f0b70379e1ec36b0d8dca659782446b0d13e7140c1257cd855ba61c4/bin

The tree holds the files of every package, laid out as they appear under /usr:

hello

The closure's manifest, which lists its packages and what wants each, is beside the tree with the same name and a .manifest suffix. Running the same command again reuses the closure and prints the same identity. ppk closure asks for each package you name exactly.

The tree also holds inventory, the same lines with the closure's identity first. When mounted at /usr, this file lets ppk list identify the closure without an artifact directory. For its format, see Why each package is there.

Resolving a conflict #

If two packages give the same path different contents, ppk closure refuses and names both packages:

ppk: "bin/hello": dev.peios.hello@1.0-1?arch=noarch and dev.peios.clash@1.0-1?arch=noarch provide different entries

Nothing is written. Decide which package should provide the path, and build the closure without the other one, or change one of the packages so that the two don't overlap and pack it as a new version.

Using another closure directory #

To keep closures somewhere other than the artifact directory, pass --closure-dir. The directory must be on the same mount as the artifact directory, because the closure's files are hardlinks to its blobs. If it isn't, ppk closure refuses and leaves nothing behind:

ppk: closures: not on the same mount as the artifact directory artifacts; use --copy-files

To build the closure there anyway, such as in a sandboxed build step that has the artifact directory as a read-only input, copy its files:

ppk closure 'dev.peios.hello@1.0-1?arch=noarch' --artifact-dir artifacts --closure-dir closures --copy-files

ppk checks each blob against its hash as it copies. To see what a copy changes, including for security descriptors, see Copied files.

Running a Command in an Environment

Peios / Developing for Peios / Packaging Software

ppk run runs a command in an environment whose /usr is the closure of the packages you request and everything they need. Do this to use a set of packages without changing /usr for anything else on the machine. For how environments work, see Environments.

Before you start #

  • Install ppk.
  • Have every package in the artifact directory. If their closure doesn't exist yet, you also need write access to the closure directory; to run an existing closure you need only read access.

Run the command #

Run ppk run with the packages after -p, then --, then the command and its arguments:

ppk run -p org.figlet.figlet -- /usr/bin/figlet Peios

One -p takes every request after it, up to the next option. Requests accept bare names, quoted names with constraints such as 'org.figlet.figlet >= 2.2', and exact IDs such as 'org.figlet.figlet@2.2.5-1?arch=x86_64'. ppk resolves them against the artifact directory, including dependencies and capability requirements. It does not fetch missing packages: use ppk fetch first. Unqualified requests use ppk's own architecture, or --arch if given. An explicit architecture in a full ID selects that architecture when all requests are qualified. One resolution holds one architecture.

To use the packages of an environment profile, give the profile first. Its requests are resolved together with any after -p, with what they need, and a request the others can't satisfy fails before composition. The closure's inventory records every request, so ppk list and /usr/inventory show what was asked for as well as what was chosen. A run keeps the rest of the filesystem as it is, so a profile's links and directories don't apply:

ppk run env.toml -p dev.peios.extra -- /usr/bin/hello

The command runs with the chosen packages at /usr.

To compose exactly the IDs you name, pass --no-deps. This mode accepts full IDs with an optional architecture, as before; names and constraints are not accepted. A profile used with it must ask for one exact version of each package:

ppk run --no-deps -p org.figlet.figlet@2.2.5-1 -- /usr/bin/figlet Peios

If the named packages omit the program's loader or libraries, execution can fail with No such file or directory even when the program itself exists. The default resolution includes providers for the package's requirements.

Everything after -- is the command, so its own options aren't read as ppk's. A command without a / is looked up through PATH inside the environment.

Start a shell instead #

Leave out -- and the command, and ppk run starts /usr/bin/sh in the environment:

ppk run -p net.busybox.busybox@1.37.0-1

The shell is the closure's own, not yours, so one of the packages must provide bin/sh. Commands you run from it share its environment.

Check the result #

ppk run exits with the command's own exit status. If the command can't be started, the status is 127 when it isn't found and 126 when it isn't executable, and ppk says why:

ppk: /usr/bin/nothing: No such file or directory

Outside the command, /usr hasn't changed.

The mounted closure includes its own /usr/inventory, so ppk list inside the command reports that closure's packages. Include ppk and its runtime packages if you want to run it there. ppk list --all reads the store in the caller's root and marks membership in the mounted closure. A closure is named by its requests as well as its packages, so a closure built by an older ppk, named by its packages alone, is never mistaken for a new one.

Choosing Packages for an Environment

Peios / Developing for Peios / Packaging Software

ppk resolve chooses an exact version of every package an environment needs, from what you ask for and the packages in one or more artifact directories, and writes them as a profile. It follows each package's dependencies and requirements, as Recording Dependencies and Metadata records them. Composing a profile resolves its requests anyway, so use ppk resolve when you want the answer fixed: a profile of exact versions always composes the same environment, whatever else the artifact directories come to hold. Compose it as Composing an Environment describes.

Before you start #

  • Install ppk.
  • Have every package the environment could need in one or more artifact directories. ppk resolve only reads them.

Write the profile #

Name the packages you need after -p, and the capabilities after -c. Each request is one argument: a name, then optionally a constraint. Quote a request with a constraint, so that the shell passes it whole. Give the artifact directories after --from:

ppk resolve -p org.gnu.make 'org.gnu.gcc >= 16' -c sh --from stage1 --out root.toml

root.toml then holds one version of each package chosen:

arch = "x86_64"

[packages]
"org.git.kernel.dash" = "0.5.13.5-1"
"org.gnu.gcc" = "16.1.0-1"
"org.gnu.glibc" = "2.44-1"
"org.gnu.make" = "4.4.1-1"

Without --out, the profile goes to standard output. Like -p, -c and --from take every argument after them, up to the next option. The packages are for the architecture ppk was built for unless you give --arch.

The profile holds only packages. To give it a root layout, include a fragment that has one, or give both to ppk compose-env, as Share a layout between profiles shows:

ppk compose-env root.toml layout.toml --artifact-dir stage1 --out root

How it chooses #

  • A package you name, or that a chosen package depends on, is chosen by its name, at the newest version that satisfies the constraint.
  • A capability, requested or required, is met by a package of that name, at its own version, or by one that provides it, at the version it provides. A capability provided without a version meets any constraint.
  • Packages are settled before capabilities, at every step. So if you name a package that provides a capability, it's the one that meets it, wherever the request appears.
  • Once chosen, a package is never reconsidered. Everything later that needs it must accept the version chosen.

Because nothing is reconsidered, the order matters when two things need different versions of one package. A constraint you give on the command line is settled before what the packages need, so naming the package with a tighter constraint is how you steer the choice.

If ppk refuses #

ppk resolve writes nothing when it refuses. When something needs a version of a package other than the one already chosen, it names both, and says whether another version would have satisfied both:

ppk: org.example.b@1.0-1 depends on org.example.c < 2, but org.example.c@2.0-1 was chosen for org.example.a@1.0-1 depends on org.example.c >= 1; org.example.c@1.5-1 would satisfy both, but finding it needs backtracking, which ppk doesn't do

Request the version that would satisfy both, here -p 'org.example.c < 2', or change a constraint.

When packages of several names provide a capability, ppk doesn't pick one for you. Request the one you want by name:

ppk: org.gnu.make@4.4.1-1 requires sh, but net.busybox.busybox, org.git.kernel.dash all provide it; request one of them by name

It also refuses when no version satisfies a request, when no package provides a capability, and when one package is different in two of the directories. A version can be spelt two ways, such as 1.0~a-1 and 1.0~alpha-1. No constraint can tell those apart, so if the version it would choose has both, it refuses and asks you to remove one.

Composing an Environment

Peios / Developing for Peios / Packaging Software

ppk compose-env lays out an environment's whole root in a new directory: the closure of the packages you name as its usr, and whatever else you give it outside usr. Do this when a tool needs the environment as files, such as an image builder making an initramfs from it. For how environments work, see Environments.

Before you start #

  • Install ppk.
  • Have every package in your artifact directory.
  • Choose a directory for the root that doesn't exist yet. Every file in the root is a hard link to its blob, so the directory must be on the same mount as the artifact directory, unless you compose on another mount.

Compose the root #

  1. Describe the environment in a profile, such as env.toml. For the format, see Environments:

    arch = "noarch"
    
    [packages]
    "dev.peios.hello" = "1.0-1"
    "dev.peios.greetings" = "2.0-1"
    
  2. Run ppk compose-env with the profile and --out:

    ppk compose-env env.toml --artifact-dir artifacts --out root
    

ppk resolves the profile's requests against the artifact directory, with the packages they depend on or require, and prints the identity of the closure of the packages chosen:

sha256:fe5cf307f0b70379e1ec36b0d8dca659782446b0d13e7140c1257cd855ba61c4

root/usr holds the packages' files, and the links they claim under /usr, such as dash's /usr/bin/sh. Nothing is written to the artifact directory.

root/usr/inventory records the closure identity, and each package's full ID and identity and what wants it. List them without a store:

ppk list --root root

To list a store and mark the packages in this root, run:

ppk list --all --root root --artifact-dir artifacts

Each line has * for a package whose ID and identity are in this root, or a space otherwise, then a space and the full ID. Both commands sort by full ID. For validation and missing-inventory behavior, see Identifying the mounted closure.

To add packages to the profile's, or to compose without a profile, name them after -p. One -p takes every package after it, up to the next option, so the profile must come first:

ppk compose-env env.toml -p dev.peios.extra@1.0-1 --artifact-dir artifacts --out root
ppk compose-env -p dev.peios.hello@1.0-1 dev.peios.greetings@2.0-1 --artifact-dir artifacts --out root

These packages are all for the architecture ppk was built for. To name another, give it in the package, as dev.peios.hello@1.0-1?arch=noarch, or give arch in the profile.

Add what lies outside usr #

A package can only place files under /usr. The one exception is a link it claims elsewhere, such as /init, which the root holds because the package is in it. Anything else the root needs comes from the profile or the command line:

  • A link, from the profile's symlinks or --symlink <path>:<target>. The target is written as given, unless it starts with a colon in the profile, or a second colon on the command line, which stands for /usr: "bin" = ":bin" and bin::bin both link bin to usr/bin.
  • An empty directory, such as a mount point, from the profile's dirs or --dir <path>.
  • The packages themselves, from the profile's include_artifacts = true or --include-artifacts, in the root's own artifact directory, system/artifacts, as hard links, so that ppk inside the environment finds them.
  • --copy-artifacts does the same with copies, checking every manifest and blob as ppk fetch does, and wins over hard links.

Paths are relative to the root. The options add to what the profile gives:

ppk compose-env env.toml --artifact-dir artifacts --out root --symlink bin::bin --dir tmp --include-artifacts

The root then holds bin, a link to usr/bin, an empty tmp, the packages' artifacts in system/artifacts, and usr.

For a live image, ppk-live-root composes the root from the medium's profile and store, then runs skeleton apply on it. That applies the root skeleton file in the root's own /usr/share/skeleton, which dev.peios.fsbase ships, so the root gets its directories outside /usr and the /lib64 link. Without the file the hook warns and continues. It then copies the medium's /lcl tree into the root if present. The copy preserves modes and a copy failure fails the boot. This carries image policy, including registry seed queues and executable autorun scripts, outside /usr. peinit applies the common and live seed queues after registryd starts; an installer owns promotion of the install queue.

Share a layout between profiles #

When several environments need the same root layout, write it once as a fragment, such as layout.toml:

dirs = ["proc", "sys", "dev", "tmp"]

[symlinks]
"bin" = ":bin"
"lib64" = ":lib"

Then include it from each profile. The path is relative to the profile's own directory:

include = ["layout.toml"]

[packages]
"dev.peios.hello" = "1.0-1"

You can also give several profiles to ppk compose-env, which merges them in the same way, so a profile that names only packages can be composed with a layout:

ppk compose-env packages.toml layout.toml --artifact-dir artifacts --out root

If two of them disagree, ppk names both files and composes nothing:

ppk: other.toml links "bin" to "usr/sbin", but layout.toml links it to "usr/bin"

Compose on another mount #

A hard link can't cross a mount, even between two mounts of one filesystem. To compose a root on another mount than the artifact directory, such as a fresh tmpfs, or in a sandboxed build step that has the artifact directory as a read-only input, copy what would be linked:

  • If the root has no artifact directory of its own, pass --copy-files. root/usr then holds a copy of each file, checked against its hash, and the root holds nothing else from the store:

    ppk compose-env env.toml --artifact-dir artifacts --out root --copy-files
    
  • If it needs one, pass --copy-artifacts, which copies the packages into the root's system/artifacts. usr then hard links to that.

To see what a copy changes, including for security descriptors, see Copied files.

If ppk refuses #

ppk compose-env leaves nothing behind when it refuses. It checks all but the hard links before it writes anything. It refuses a root that already exists:

ppk: root: already exists

It refuses a path under a link you also gave, because creating it would follow the link out of the root:

ppk: "bin/extra": under "bin", which is a symlink

It refuses another version of a package the profile holds, since an environment holds one version of each:

ppk: dev.peios.hello@2.0-1?arch=x86_64: the environment holds dev.peios.hello@1.0-1?arch=x86_64 already

It refuses two packages that claim one path, even as links to one target, since a claim says which package provides the name. Choose one of them:

ppk: "/usr/bin/sh": claimed by both org.git.kernel.dash@0.5.13.5-1?arch=x86_64 and net.busybox.busybox@1.37.0-1?arch=x86_64

It refuses a claimed link outside usr that the profile or the options also give as a link or a directory, or that a path given lies under:

ppk: "init": claimed by org.git.kernel.dash@0.5.13.5-1?arch=x86_64, but the environment links it

It also refuses packages that conflict, in the same way as ppk closure, including a claimed link that is a path in a package's files, and any path that is usr or lies under it.

Publishing a Repository

Peios / Developing for Peios / Packaging Software

A repository is an artifact directory that says what it publishes. Its catalog lists every version it holds. Its indexes each hold one version of each package for each architecture: leading always holds the newest, and a snapshot holds a release, unchanged for ever. Its channels, such as stable, each follow an index or another channel.

One file, the pointer file, says what the catalog, each index and each channel are, and it is the only file that is signed. Everything else is named by its hash, from there.

Before you start #

  • Have the packages in an artifact directory, as Creating a Package and Fetching a Package describe.

  • Have a signing certificate that holds the Repository warrant, and its secret key. The pso command issues both. The certificate's Name warrant has to cover the name your repository signs as, its identity, such as pkgs.example.com.

  • Write a signer file that names them:

    identity = "pkgs.example.com"
    certificate = "signer.cert"
    key = "signer.key"
    carry = ["intermediate.cert"]
    

    A path that isn't absolute is beside the signer file. carry lists the certificates above the signing certificate, in order upward, so that a machine reading your repository for the first time has the whole chain. Leave it out if the signing certificate was issued by a top-level.

    If the key is sealed under a passphrase, as pso makes keys unless told otherwise, add passphrase-file, a file whose first line is the passphrase. Without it, ppk asks for the passphrase on the terminal, and fails if there isn't one. Keep the passphrase file with the same care as the key: together they sign.

    Keep the key out of the repository and out of version control. Every ppk repo command that publishes reads the signer file from --signer, or from $PPK_REPO_SIGNER.

Publish #

Run ppk repo update:

ppk repo update --artifact-dir artifacts --signer signer.toml

It writes the catalog and leading, signs the pointer file, and prints it:

sequence 1
signed 2026-11-13T13:11:46Z
catalog sha256:09cc9d05541917d9894cb2fc71a05373509789c0218b9ca5b7284ed6cca28619
provides sha256:f6ca384d90eb3223b077a93785c13ea3a9fb5ee53957f489e93cbd3b959e8015
index leading sha256:f5e090f9de6441810fab9e15909770d071687375e9f35c35d73244302c877ab6

The sequence goes up by one each time you publish. Run ppk repo update again after adding packages.

Besides the catalog, ppk repo update writes each version's summary, the part of its manifest that says what it needs and provides, and the catalog's provides tree, which lists what provides each capability. A machine choosing packages from the repository over HTTP reads those for the names it needs, not every manifest the repository holds. A repository published by an earlier ppk gets them the next time you run ppk repo update, with the same packages.

leading holds only what can be installed from it. A package whose dependencies or requirements leading can't satisfy is left out, with a warning naming what it lacks, and so is anything that then lacks it. To make that an error instead, pass --strict.

Make a release #

Take a snapshot of leading as the release's index, then point channels at it:

ppk repo snapshot 2026.10.0 --artifact-dir artifacts --signer signer.toml
ppk repo channel 2026.10 2026.10.0 --artifact-dir artifacts --signer signer.toml
ppk repo channel stable 2026.10 --artifact-dir artifacts --signer signer.toml
ppk repo channel unstable leading --artifact-dir artifacts --signer signer.toml

A snapshot never changes, so its name must be new. To fix a release, take a new snapshot, 2026.10.1, and move the release's channel to it. When a release gets no more fixes, mark its channel ended, so that a machine following it can tell:

ppk repo channel 2026.10 2026.10.1 --ended --artifact-dir artifacts --signer signer.toml

Take a version back #

To stop new resolutions choosing a version, yank it. Anything that asks for exactly that version still gets it:

ppk repo yank 'org.example.tool@1.2-1?arch=x86_64' --artifact-dir artifacts --signer signer.toml

--undo restores it. To remove a version altogether, delete it, giving a reason:

ppk repo delete 'org.example.tool@1.2-1?arch=x86_64' --reason 'legal takedown' \
    --artifact-dir artifacts --signer signer.toml

That removes its ref, its manifest, and every file of it that no other package shares. The catalog keeps a tombstone with the reason, so that anything still asking for it can say why it's gone. Snapshots that hold it aren't changed; publish a new one without it to keep a release installable.

Install from a repository #

Anything that resolves packages from a repository can ask for what an index or channel holds, with # after the name:

ppk fetch 'se.curl.curl#stable' --from artifacts
ppk run -p 'se.curl.curl#2026.10.0' -- /usr/bin/curl --version

The version the index holds is chosen, and so is everything it depends on or requires: a request for a release takes the release's versions of what it needs too. A constraint after the index, as in 'se.curl.curl#stable >= 8', must also hold. A closure records the index of each request that named one, so its inventory shows what it was asked for from where.

A yanked version is chosen only by a request for exactly it, such as 'org.example.tool = 1.2-1'. A request that only a deleted version would satisfy fails, giving the reason it was deleted.

Export a compressed copy #

Most of a repository is its blobs, the content of its packages' files. The repository itself keeps them uncompressed, because machines and builds that read it directly link them into closures. To serve it, export a copy whose blobs are compressed:

ppk repo export --artifact-dir artifacts --to export --signer signer.toml

ppk repo export writes export as the repository as it was last published, with each blob compressed with zstd under its own name, and prints the pointer file it signed, which says blobs zstd. Nothing else is compressed, and every package keeps its identity. ppk decompresses each blob as it fetches it and checks it against its hash before storing it.

Run ppk repo export again after each ppk repo update. It compresses only the blobs the export doesn't hold yet, and removes anything you deleted from the repository. Compression uses zstd level 12 unless you pass --level, from 1, the fastest, to 22, the smallest.

Serve the repository over HTTP #

Every file of a repository but repository and repository.pso is named by its hash and never changes. A static web server can serve the repository's directory, or its export, as it is, with no other software. Machines then fetch from it by its URL, the URL of that directory:

ppk repo add peios https://pkgs.peios.org/ --identity pkgs.peios.org --track stable

ppk reads each file at the URL followed by the file's path in the directory, such as https://pkgs.peios.org/repository for the pointer file. It doesn't need the server to list directories or answer range requests.

A copy of the repository on another server, such as a cache on your own network, serves machines the same way. A cache can keep every file but repository and repository.pso for ever. A machine given the cache's URL before the repository's own tries the cache first and falls back to the repository for anything the cache can't serve. Because every file is checked against its signature or its hash, a cache never has to be trusted for what it sends.

Check what a repository publishes #

ppk repo show prints the pointer file. Give the repository's identity to check its signature too:

ppk repo show --artifact-dir artifacts --identity pkgs.example.com

The check succeeds only if a root this build of ppk holds vouches for the chain that signed the repository. For a repository whose top-level you enabled yourself, add --unrooted.

--artifact-dir also takes the URL of a repository served over HTTP, to check what a server is publishing.

For the files a repository holds, see ppk(1).

Peios Learn — documentation for Peios software.

Built with Trail.