Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

Reference

Look up configuration, package references, file paths, command results, and troubleshooting steps.

Use these pages to look up configuration fields, package references, file paths, and script interfaces. For command syntax, see Commands or run sow help COMMAND.

Fields, defaults, validation rules, signing references, and publication targets in sow.yml.

Select packages by digest, coordinate, filename, or name. Resolve ambiguous matches.

Locate package files, indexes, private state, and publication output.

Interpret command results and choose the next action in scripts.

Read the sow.cli/v1 response and command result fields.

Find the next step for configuration, build, signing, and publication errors.

Example conventions

Command blocks omit the shell prompt so you can copy them. Uppercase words such as NAME and DIR in syntax descriptions are placeholders. Square brackets mean optional arguments; ... means repeatable arguments; | separates alternatives.

Output paths, IDs, hashes, timestamps, and counts depend on the workspace. Keep operation and generation IDs as strings; see JSON output.

1 - Troubleshooting

Find the next command for migration, pending builds, interrupted publication, locks, and integrity errors.

Start with the error message and the exit code. For Managed commands, specify the workspace and Repository so you inspect the intended state:

sow version
sow status -C /srv/sow -r pgsql
sow log -C /srv/sow -r pgsql

Replace /srv/sow, pgsql, and the target name prod below with your configuration.

The database needs migration

SOW 0.6.1 uses schema v13, as do 0.5.0 and 0.6.0. An upgrade from either version needs no schema migration. For a 0.3 or 0.4 workspace, stop writers and back up the complete workspace. Then run:

sow repo migrate pgsql -C /srv/sow
sow build -C /srv/sow -r pgsql
sow check -C /srv/sow -r pgsql

Repeat this for each Repository. Compatible read-only commands can still inspect an older schema, but they do not migrate it. See Upgrade.

Status shows pending changes

add --skip, rm --skip, and configuration edits can leave Desired state ahead of Built state. Apply the pending changes, then check the result:

sow build -C /srv/sow -r pgsql
sow check -C /srv/sow -r pgsql

A local build updates local indexes. To update a configured remote target, also run sow publish prod -C /srv/sow. See sow status for the state fields.

A command was interrupted

For Plain mode, resolve the reported input or filesystem issue, then rerun the original sow create command with the same Pigsty, timestamp, and signing options.

For an interrupted add, rm, Dist change, or build, inspect sow log and fix the reported cause. Run sow build for that Repository to complete recovery. Committed Desired changes remain part of the pending build. For interrupted init, repo new, or repo rm operations, rerun the corresponding lifecycle command to recover the workspace journal.

If recovery needs a protected signing key, supply its password source again. Journals do not save passwords. A supported recovery command can use --passfile PATH or SOW_GPG_PASSFILE; per-key configuration still applies. Keep sow.yml consistent with any pending workspace lifecycle journal. See Password files.

For an interrupted publication, restore access to its storage and public endpoint, then rerun the same target:

sow publish prod -C /srv/sow

SOW resumes the saved attempt. To abandon an attempt before commit intent, use sow publish prod --abort -C /srv/sow. After commit intent, rerun publication to finish it. See Publication recovery.

Errors after a committed change

Database commit and later maintenance are separate steps. A checkpoint or cleanup error can occur after package membership or a build has committed. SOW keeps the committed result in command output. It does not report those items as rolled back.

Read the result and sow status, then inspect the recorded operation with sow log. Resume the command named in the diagnostic. Keep original input files until you have confirmed the result.

Target configuration changed

Compare sow.yml with the target named in the error. If you intentionally changed its name, public_endpoint, or max_cache_ttl, accept the change with:

sow publish prod --rebind -C /srv/sow

A change to the Repository, provider, storage endpoint, region, bucket, or prefix requires a new target. Complete pending target maintenance before changing its TTL. See Target bindings.

A command waits for a lock

Another process is using the workspace or Repository. Let that command finish, or stop it through its normal process controls. Retry your command afterward.

For write commands that support lock options, use --no-wait to return immediately when the lock is busy, or --timeout 30s to bound the wait. These options do not apply to init or read commands. Shared-lock reads wait until the writer finishes or you cancel the command; status normally reports the lock state without waiting. Keep the lock files in place: SOW uses their stable paths to coordinate processes. See Global options.

A package, signature, or path fails validation

A signing key asks for a password or cannot unlock

With a binary that supports password files, use --passfile PATH, a per-key passfile, or SOW_GPG_PASSFILE, in that priority order. create also requires --sign-with; setting the environment variable alone does not enable signing.

  • Check the selected path first. CLI/environment paths start at the process working directory, regardless of -C; config paths start at the workspace root. An empty environment variable is not the same as an unset one.
  • Use a readable regular file without symlinks. The password is one nonempty UTF-8 line with an optional final LF or CRLF; spaces and tabs are significant. The file is not a shell script or NAME=value assignment.
  • An invalid selected source fails without fallback or prompting. External GPG needs agent support for loopback mode. A hardware key may still require its own confirmation.
  • config check unlocks metadata keys and probes external metadata GPG signing. RPM package preflight does not prove that a password is correct; verify an actual package-signing operation. check verifies public signatures without reading passwords.

Other validation failures

Use the named file and the check stage to narrow the cause:

Error Action
Same Pool path, different bytes Compare the input with the existing package. Give different content a new package version and file name. Moving it to another input directory does not change its Pool URL.
File name differs only by case Use the already recorded spelling. Case aliases cannot create another Pool URL.
Missing or altered Pool file Restore the original bytes from a matching backup, then rerun sow check.
Signing key unavailable Check the configured key, secret-key access, GPG agent, and current key validity. Retry the build after correcting them.
RPM does not match the trust policy Check the package signature and configured public keys. See Signing.
Public URL returns old content Check the HTTP root, URL prefix, cache, and max_cache_ttl, then retry publication.

sow check reports integrity errors; it does not rewrite damaged data. Keep the reported path and operation ID when investigating. The layout reference explains which files belong to the package Pool, generated indexes, and private state.

2 - sow.yml Reference

Workspace fields, defaults, validation rules, signing references, and publication targets.

sow.yml configures a Managed workspace. It declares repositories, Dists, package policy, signing, and publication targets. Plain sow create does not read it.

After editing the file, validate it and inspect the effective settings:

sow config check
sow config show --all

config check validates the YAML, compares it with initialized repository state, and resolves signing references. --all expands defaults in config show.

File rules

  • Use one YAML document and schema: sow/v3.
  • Unknown fields and duplicate keys are errors.
  • Keep the file at the workspace root as a regular file with one hard link, at most 16 MiB. A symlink is rejected.
  • init, repo new/rm, and dist new/rm update the file as part of their operations.
  • Edit policy, signing, and target settings in the file. Defaults are applied when read; reading does not rewrite the source.

Use repo migrate to upgrade an older repository database or layout.

Workspace

schema: sow/v3
architectures: [x86_64, aarch64]
repos: {}
targets: {}
Field Type Default Meaning
schema string Required Must be sow/v3
architectures string list [x86_64, aarch64] Architecture families allowed in this workspace
repos map Empty Repository names and settings
targets map Empty Publication target names and settings

Architecture aliases normalize as follows:

Input Canonical family
x86_64, amd64 x86_64
aarch64, arm64 aarch64

A specified architecture list must not be empty or contain duplicate families after normalization. noarch and all are package architectures, not configuration families. SOW includes those neutral packages in each applicable view.

Repository

repos:
  demo:
    protected: false
    signing: {}
    dists:
      el9:
        format: rpm
Field Type Default Meaning
protected boolean false Blocks repo rm, including -f
signing map Unsigned metadata; package mode never Repository signing settings
dists map Empty Dist names and settings

protected does not block package changes or Dist removal. To remove a protected repository, set it to false, validate the configuration, then run repo rm.

Repository, Dist, and target names must match [a-z0-9][a-z0-9._-]*. Reserved names are ., .., .sow, pool, dists, sow.yml, workspace.lock, workspace-ops, and repo-locks. Repository names must also have distinct private state paths; for example, db and db.db cannot coexist.

Dist

dists:
  el9:
    format: rpm
    architectures: [x86_64]
    limit: 2
    exclude:
      - kind: [debuginfo, debugsource, llvmjit]
Field Type Default Meaning
format string Required rpm or deb; cannot change after initialization
architectures string list Workspace list A nonempty subset of workspace families
limit integer 0 Newest versions to keep per binary name and canonical architecture; 0 keeps all
exclude rule list Empty Package exclusion rules

Adding an architecture makes the Dist dirty; run build to generate its view. Removing an architecture still referenced by membership or built state is rejected.

limit must be non-negative. RPM uses epoch-version-release ordering; DEB uses Debian version ordering. Neutral packages form a separate group. Relaxing policy does not restore removed members; add their package files again.

Exclusion rules

exclude:
  - kind: [debuginfo, debugsource, dbgsym, dbg, llvmjit]
  - name: ["test-*", "*-experimental"]
    arch: [aarch64]

Fields within one rule use AND. Patterns within one field use OR. Rules use OR. exclude runs before limit over the complete candidate membership of each selected Dist.

Field Matches
name Binary package name
source Normalized RPM SOURCERPM or DEB Source name
arch x86_64, aarch64, or neutral
kind RPM: debuginfo, debugsource, llvmjit; DEB: dbgsym, dbg; otherwise main
format rpm or deb

Patterns are case-sensitive strings or shell globs (*, ?, [...]). Empty rules, empty or untrimmed patterns, duplicates within one field, and invalid globs are errors. Pattern values are not checked against the possible package values; a typo can match nothing. kind comes from the corresponding package-name suffix.

See Membership policy for examples and result interpretation.

Signing

Signing applies to a repository. RPM packages, RPM metadata, and DEB metadata have separate settings:

signing:
  rpm:
    packages:
      mode: fill
      key: agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B
      passfile: /run/secrets/rpm-password
      trusted_keys: [keys/upstream.asc]
    metadata:
      key: keys/repo-signing.asc
      passfile: /run/secrets/metadata-password
  deb:
    metadata:
      key: keys/repo-signing.asc
      passfile: /run/secrets/metadata-password

RPM package settings

rpm.packages field Default Meaning
mode never without a key; fill with a key never, fill, or always
key None Signing-key reference; required for fill and always
passfile None Password-file path; requires key
trusted_keys Empty Additional public-key references accepted by fill

never preserves input bytes. fill preserves packages whose signatures verify with the current or trusted keys and signs the rest. always requires the current key, re-signing packages when needed. The public half of key is trusted automatically. Duplicate trusted-key reference strings are rejected.

Package signing calls the host rpm command on a staged copy. Its GPG environment must already contain the private key. A configured key file alone does not provision it.

Metadata settings

Both rpm.metadata and deb.metadata accept:

Field Default Meaning
key None Metadata signing-key reference
passfile None Password-file path; requires key
passphrase None Legacy password reference; mutually exclusive with passfile

RPM signing creates repodata/repomd.xml.asc. DEB signing creates InRelease and Release.gpg. Without a key, indexes are unsigned. DEB package files are not re-signed.

Key references

Form Example Value
Path keys/repo.asc OpenPGP key file; relative paths start at the workspace root
file:// file:///secure/repo.asc OpenPGP key file
env:// env://SOW_METADATA_KEY Variable containing armored key material, a file path, or a GPG key identifier
agent:// agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B Key in the local GPG environment

Environment names use [A-Za-z_][A-Za-z0-9_]*. A GPG key identifier is a 16-digit key ID or a 40- or 64-digit fingerprint. Hexadecimal letters are case-insensitive.

Key files accept ASCII-armored or binary OpenPGP data and must be regular files without symlinks, at most 16 MiB. Relative paths resolve from the workspace root. Metadata signing uses the supplied private-key material inside SOW. A GPG key identifier uses external gpg, whether supplied through agent:// or an environment variable.

A signing key reference must resolve to exactly one primary key. A trusted_keys file can contain several complete public keys, including consecutive armored blocks. SOW reads the complete bundle and rejects malformed or truncated input. It does not silently use only the first key.

Password files

This interface is part of the current development version (Unreleased). Check sow help create or sow help config check for support in an installed binary.

Use one password-file interface for RPM packages, RPM metadata, and APT metadata, including protected private-key files and agent:// keys. The sources are selected in this order, separately for each signing key:

  1. --passfile PATH: override every signing key used by this invocation.
  2. The key’s configured passfile, or its legacy passphrase reference.
  3. SOW_GPG_PASSFILE: default file path for keys without a configured source.
  4. Existing key/GPG/RPM credential handling when no source is set.

Configure passfile next to key under repos.<name>.signing.rpm.packages, signing.rpm.metadata, or signing.deb.metadata; it is not a top-level setting. An empty YAML passfile: "" is treated as unset. A CLI override does not bypass configuration validation: two nonempty passfile and passphrase values on the same metadata key are still rejected.

passfile takes a literal filesystem path, not a URL or an environment-variable name. CLI and environment paths are relative to the process working directory, even with -C. Config paths are relative to the workspace root. SOW does not expand ~ or $VARIABLE in config or environment values; the shell can expand them in CLI arguments. No default file is searched. Set SOW_GPG_PASSFILE to an absolute path to reuse a source across commands. An empty SOW_GPG_PASSFILE is an error if that source is selected when credentials are needed; CLI or per-key configuration can override it. Unset the variable to return to existing behavior.

Without a source, an encrypted metadata key file still needs a password reference. External metadata GPG can use an already unlocked agent key but runs with pinentry disabled; RPM retains its existing agent and macro behavior. An unprotected key does not require a password file. The environment variable only supplies a password source: Plain create still needs --sign-with to enable signing.

sow create ./packages -S 0123456789ABCDEF --passfile /run/secrets/gpg-password
export SOW_GPG_PASSFILE=/run/secrets/gpg-password
sow config check
sow build -r demo

The file contains the password itself, with these exact rules:

  • One nonempty UTF-8 line, without a BOM, at most 64 KiB including an optional terminator.
  • No final newline is required. Exactly one final LF or CRLF is removed.
  • No trimming: leading/trailing spaces and tabs are password bytes. Quotes, #, and backslashes are literal; there are no comments, escapes, or NAME=value syntax.
  • Empty files, an empty line, NUL, embedded CR/LF, a bare final CR, and extra blank lines are rejected. A password consisting only of spaces is not empty.
  • Use a readable regular file with no symlinks in its path. FIFOs, directories, and stdin (-) are not special sources. macOS system aliases /tmp, /var, and /etc are normalized to their /private locations.

Keep the file outside the repository and public document root, normally with mode 0600 and a private parent directory. SOW does not require exactly 0600, so a read-only secret mounted with suitable access controls also works. File paths do not hide the password from processes or users that can read the file.

SOW reads the selected source only for signing or a signing preflight. A missing, unreadable, or malformed selected source fails without trying another source or opening a password prompt. With an explicit source, external GPG uses batch loopback mode, which must be allowed by the agent; hardware keys that require interaction retain that requirement. No new raw-password flag or environment variable is provided.

The option is available on create (with --sign-with), init, config check, repo new/rm/migrate, dist new/rm, add, rm, build, and export rpm-leaf. add --skip can still sign packages; rm --check can render signed preview metadata. publish, local/target gc, and log prune also accept it because recovery of an interrupted mutation can need a signer. Query commands, config show, and signature verification with check do not read password files. retain does not accept --passfile. Recovery selects the source again from the current invocation and configuration; password values are never journaled.

Changing only a passfile path does not change a signing identity or make a Dist dirty. Password values never enter logs, config output, repository state, or public files. External metadata signing passes the password through a private descriptor. RPM signing uses a temporary 0600 file in a private /tmp/sow-gpg-pass-* directory because RPM may invoke GPG repeatedly. SOW removes it when the signing call returns; forced process termination can leave it behind.

Passphrase references

Existing metadata passphrase fields remain supported, including paths, file://, and env:// references. They now also work with GPG key identifiers. They take priority over SOW_GPG_PASSFILE; --passfile overrides them. Nonempty passfile and passphrase values on one key are a configuration error. New configuration should use passfile. Moving from passphrase to passfile can require one metadata rebuild, because historical configuration identities include the legacy reference.

Legacy references keep their byte-oriented behavior: at most 64 KiB, nonempty, no NUL, remove one final LF and then one final CR. In-process legacy keys retain support for other bytes; external GPG requires a single line. Legacy file paths resolve from the workspace root and use the same regular-file and no-symlink rules as keys.

For config check, reference syntax errors return 2; unresolved or unusable signing references return 6. Metadata key files are unlocked and checked for signing suitability; external GPG metadata keys also perform a signing probe. RPM package checks validate the selected password file’s format, the tools, and secret-key availability. They do not sign a package or prove its password is correct; actual RPM signing and verification happen when a package needs signing.

config show can include key_fingerprint even without --all. Active RPM package settings can also include key_snapshot_sha256, trusted_key_fingerprints, and trusted_key_snapshot_sha256s. Fingerprint and snapshot arrays are independently sorted; do not pair them by index. These fields describe public identities and are output fields, not accepted sow.yml keys.

See Signing for rotation and package reuse.

Publication targets

targets:
  mirror:
    repository: demo
    provider: filesystem
    endpoint: file:///srv/mirror
    prefix: demo
    public_endpoint: file:///srv/mirror/demo/
    max_cache_ttl: 0s
    authoritative_workspace: true
    single_writer: true
    exclusive_write_authority: true
Field Required Meaning
repository Yes Existing repository name
provider Yes filesystem or r2
endpoint Yes Canonical file:///absolute/path without a trailing slash, or https://host for R2
region R2 only Must be auto; forbidden for filesystem
bucket R2 only Lowercase DNS-safe bucket label; forbidden for filesystem
prefix No Relative storage prefix; empty uses the storage namespace root
credential R2 only env://NAME or file:///absolute/path; forbidden for filesystem
public_endpoint Yes Canonical verification URL ending in /; filesystem accepts HTTP(S) or file://, R2 accepts HTTP(S)
max_cache_ttl Yes Canonical non-negative Go duration, including explicit 0s
authoritative_workspace Yes Must be true
single_writer Yes Must be true
exclusive_write_authority Yes Must be true

The last three fields state that this workspace owns publication and is the only writer for the target namespace. Targets on the same storage cannot have overlapping prefixes. Filesystem targets cannot resolve to overlapping directories.

Use canonical durations such as 0s, 30m0s, or 24h0m0s; 24h is rejected. Durations are bounded below Go’s maximum duration to leave room for the cache-grace margin. Set this value to cover the longest cache lifetime used by the public service.

Create the filesystem endpoint directory before publishing. It must be a real canonical directory, not a symlink. SOW creates the prefix beneath it.

An R2 target adds storage and credential fields:

targets:
  prod:
    repository: demo
    provider: r2
    endpoint: https://0123456789abcdef.r2.cloudflarestorage.com
    region: auto
    bucket: packages
    prefix: demo
    credential: env://SOW_R2_CREDENTIAL
    public_endpoint: https://repo.example.com/demo/
    max_cache_ttl: 24h0m0s
    authoritative_workspace: true
    single_writer: true
    exclusive_write_authority: true

The referenced environment variable or file contains one JSON document:

{"access_key_id":"YOUR_ACCESS_KEY_ID","secret_access_key":"YOUR_SECRET_ACCESS_KEY"}

It can also contain session_token. Unknown fields, trailing data, missing credentials, and values larger than 64 KiB are rejected. Credential files must resolve to regular files; a symlink to a regular file is accepted. Credentials are not included in the public tree or configuration output.

The first publication binds the repository, provider, storage identity, and prefix. To change the target name, public_endpoint, or max_cache_ttl, use publish --rebind. Provider, endpoint, region, bucket, prefix, and repository identity cannot be rebound; configure a new target. Pending maintenance can block changes to cache TTL or the public endpoint until that maintenance completes.

Fixed settings

Repository paths are always <workspace>/<name>. APT components are always main. Architecture views are derived from Dist configuration and package headers. Generation retention is managed with retain, not a configuration count.

See Layout, Publication, and Exit codes.

3 - Package References

Select packages by digest, coordinate, filename, or name, and resolve ambiguous matches.

rm, show, and where accept package references. add accepts file or directory paths. Use sow ls to find a package coordinate or SHA-256, then pass it to another command.

sow ls -r demo -d el9
sow show 'rpm:example-0:1.0-1.x86_64' -r demo

Accepted forms

Form Syntax Matches
SHA-256 sha256:<64 lowercase hex digits> Stored package bytes
RPM coordinate rpm:<name>-<epoch>:<version>-<release>.<arch> Complete RPM identity, including epoch
DEB coordinate deb:<name>=<version>:<arch> Complete DEB identity
Filename example-1.0-1.x86_64.rpm Stored package filename
Bare name example Binary package name

SHA-256 values must be complete and lowercase. Abbreviations and uppercase digests are rejected with exit 6. The digest is for the stored bytes; Managed RPM signing can make it different from the input file’s digest.

RPM coordinates always include an epoch, using 0 when the package has none. A reference with the rpm: prefix is matched against the complete stored coordinate. Include every coordinate component to match the package.

DEB coordinates include the complete Debian version, with any epoch and revision, plus the native architecture. Use amd64, arm64, or all for DEB and x86_64, aarch64, or noarch for RPM. These values come from the package, not the configuration aliases.

sow where 'rpm:example-0:1.0-1.noarch'
sow where 'deb:example=2:1.0-1:amd64'

A filename is a convenience, not a unique identifier. Use a coordinate or full digest in scripts. References do not support paths, globs, regular expressions, or version ranges.

Name matching and ambiguity

Command Bare name matching several versions or architectures
rm Removes all matching memberships in the selected Dists
show Rejects the ambiguous reference and lists candidates
where Requires one package identity; returns all repository locations for that identity

Preview a name-wide removal before applying it:

sow rm example -r demo -d el9 --check

For show or where, select a coordinate or digest from the candidate list. where can return several repositories when they contain the same format, coordinate, and SHA-256. If repositories contain different versions or bytes for the reference, use -r or a more specific reference.

Other reference forms must identify one object within a repository. A missing or ambiguous reference returns exit 6.

Search scope

rm and where search Desired membership. Without -d, show searches all recorded package objects, including packages that no longer belong to a Dist. With -d, it searches Desired membership in those Dists. Unrecorded files are not query results.

Command Default scope Selection
rm Selected Dists of one repository -r; repeatable -d, or inferred Dist
show All recorded package objects in one repository -r; optional -d limits to Desired membership
where All repositories in the workspace Optional -r and -d

For rm, if the Dist cannot be inferred and the repository has several Dists, supply -d. Without -r, where -d NAME searches repositories containing that Dist name. It reports an error if the requested Dist name exists nowhere.

Coordinate conflicts

Within a repository, one coordinate identifies at most one content object. SOW rejects a different package with an existing coordinate and does not replace it silently. Changing only a signature still changes the exact-byte identity.

With active RPM signing, SOW can reuse an existing signed object when its coordinate, signature-neutral payload, and signing policy match. Otherwise, use a new release and filename for changed bytes. See Signing.

See rm, show, and where for command options.

4 - Repository Layout

Locate package files, repository indexes, private state, and publication output.

Serve the complete Managed repository directory: pool/ plus dists/. Keep workspace configuration and .sow/ state outside the web server’s document root.

Plain directory

/srv/offline/
├── example-1.0-1.x86_64.rpm
├── example_1.0-1_amd64.deb
├── repodata/
│   ├── <sha256>-primary.xml.gz
│   ├── <sha256>-filelists.xml.gz
│   ├── <sha256>-other.xml.gz
│   └── repomd.xml
├── Packages
├── Packages.gz
└── repo_complete                     # with --pigsty

sow create writes RPM metadata only when RPMs are present and DEB metadata only when DEBs are present. RPM locations use a bare basename; DEB locations use ./<basename>. A running build uses private .sow-plain-stage-* directories. Exclude them from serving and copying. A later create removes stale SOW temporary paths and rebuilds the indexes.

.sow-plain-rpm-history.json records the current and previous RPM metadata references. Keep it when copying a directory for further create runs. It does not belong in a client index and is not a recovery journal.

Managed workspace

<workspace>/
├── sow.yml                           # workspace configuration
├── .sow/                             # private state
│   ├── workspace.lock
│   ├── workspace-ops/
│   ├── repo-locks/<repo>.lock
│   ├── <repo>.db
│   └── <repo>/
│       ├── abandoned/                # retained migration stages
│       ├── stage/
│       ├── recovery/
│       ├── retained/
│       ├── transitions/
│       └── pending/
└── <repo>/                           # public repository root
    ├── pool/
    └── dists/

The database can have SQLite WAL and shared-memory sidecar files. .sow/ and pending directories are private (0700). Pending payload files use 0644 so they can be promoted to public paths without changing their mode.

SOW 0.6.1 uses database schema v13 and configuration schema sow/v3. These are separate version identifiers. Back up the complete workspace before repo migrate. Keep the database with its matching private and public state; do not edit its schema version or rebuildable cache by hand.

Package pool

pool/<prefix>/<source>/<filename>

source comes from the RPM SOURCERPM or DEB Source field, normalized to a source package name. If absent, SOW uses the binary package name. The prefix is the first character converted to lowercase. If the source starts with lowercase lib, use its first four characters, or the whole name when it is shorter, converted to lowercase.

Source Example path
postgresql-18 pool/p/postgresql-18/libpq5_18.3-1_amd64.deb
example pool/e/example/example-1.0-1.x86_64.rpm
libfoo pool/libf/libfoo/libfoo1_1.0-1_amd64.deb

Package objects are immutable. Membership removal leaves the bytes available to built, retained, recovery, and publication records. gc removes them when those records no longer need them. Each repository owns its own pool.

RPM Dist

dists/el9/
├── x86_64/repodata/
│   ├── <sha256>-primary.xml.gz
│   ├── <sha256>-filelists.xml.gz
│   ├── <sha256>-other.xml.gz
│   ├── repomd.xml
│   └── repomd.xml.asc                # with metadata signing
└── aarch64/repodata/
    └── ...

Architecture views contain metadata only. Each package location points back to the root pool:

<location href="../../../pool/e/example/example-1.0-1.x86_64.rpm"/>

Native packages appear in their matching architecture view. noarch packages appear in all configured views. Previous checksum-named metadata can remain alongside the current files; repomd.xml selects the active set.

For a self-contained directory with local package paths, use export rpm-leaf.

DEB Dist

dists/trixie/
├── Release
├── InRelease                         # with metadata signing
├── Release.gpg                       # with metadata signing
└── main/
    ├── binary-amd64/
    │   ├── Packages
    │   ├── Packages.gz
    │   └── by-hash/SHA256/<digest>
    └── binary-arm64/
        └── ...

Packages entries use root-relative archive paths such as Filename: pool/e/example/example_1.0-1_amd64.deb. Release contains SHA-256 manifests and Acquire-By-Hash: yes. Architecture all packages appear in each applicable index.

Publication paths

Both target providers receive the same public layout:

<prefix>/
├── pool/
└── dists/

An export has its own package files, metadata, manifest, and .sow-export.json completion marker. It is a separate delivery artifact and is not another Managed repository.

Names and case sensitivity

Repository, Dist, and target names use [a-z0-9][a-z0-9._-]*. Reserved names include ., .., .sow, pool, dists, sow.yml, workspace.lock, workspace-ops, and repo-locks.

A new pool path that differs only in case from a known full path is rejected, even for identical bytes. On a case-insensitive filesystem, source directories that differ only in case also conflict. On a case-sensitive filesystem those source directories can remain distinct, so check them before moving a repository to a case-insensitive volume.

See Views, Serving, and Platforms.

5 - Exit Codes

Exit codes 0–6 and interruption code 130, with meanings and examples.

Use exit codes in scripts and read the diagnostic for the specific cause. SOW uses the same code meanings across commands.

Code Meaning Next step
0 Success or no-op Read the result; no-op commands may report noop: true
1 Runtime I/O, package parsing, rendering, or other unclassified error Correct the reported input or environment problem, then retry
2 Invalid command, workspace discovery, or configuration Check sow help COMMAND, selection flags, and sow config check
3 Partial success Inspect the result to identify committed work and failed items
4 Write lock unavailable Retry later or use a longer --timeout
5 Integrity/recovery error, or repository not ready for delivery Inspect status and check; build a dirty repository or recover the recorded operation
6 Rejected operation Correct the conflict, package reference, architecture, signing setting, or protection setting named in the error
130 Command interrupted by SIGINT or SIGTERM Follow the recovery procedure for the interrupted operation

Success does not always mean ready

status returns 0 when it can report state, including dirty, recovering, or error. Its ready_to_copy field is a state summary, not a full byte check. Use check before delivery:

sow build -r demo
sow check -r demo

A dirty repository can have consistent old indexes and still fail check with code 5, because Desired state has not been built. Run build and check again. If the diagnostic reports corrupted bytes or conflicting recovery evidence, inspect that failure before retrying. See Troubleshooting.

Partial success

For add, code 3 means at least one input was accepted or reused and at least one failed. The JSON result retains per-input outcomes. Exclusion by policy is not a failed input. init can also return 3 after creating some declared objects and failing on a later one.

Capture both output and status before deciding whether to continue:

#!/usr/bin/env bash
set -uo pipefail

sow add ./incoming/ -r demo -d el9 --json > add-result.json
rc=$?
case "$rc" in
  0) ;;
  3) jq '.result.items[] | select(.status == "failed")' add-result.json
     exit 3 ;;
  4) echo 'Repository is busy; retry later.' >&2
     exit 4 ;;
  *) exit "$rc" ;;
esac

sow check -r demo || exit $?
sow publish mirror

mirror must be a configured target for demo. The script stops on partial success so you can inspect failed inputs before publishing.

Lock waits and interruption

-T 0 waits for a write lock without a time limit and is the default. -T 30s waits up to 30 seconds. -N tries once. Lock contention returns 4; -N combined with a nonzero -T returns 2.

Read-only commands do not accept these flags. Some take shared locks for a consistent snapshot; status reports repository writer-lock activity without waiting for that writer.

Ctrl-C or SIGTERM returns 130 when SOW handles the interruption. An internal timeout, such as an upload progress timeout, keeps its normal error class. Interruption does not undo work that already committed. Inspect the state and follow Transactions and recovery to resume the operation.

JSON errors

With --json, stdout contains the result envelope and stderr contains diagnostics. The errors array uses these classes:

Code JSON class
1 runtime
2 usage, discovery, or config
3 partial
4 lock
5 integrity
6 rejected
130 interrupted

Branch on the code or class, not message text. Plain create prints its domain error to stderr; its JSON message can include an extra CLI category prefix. Diagnostic and partial results remain available when ok is false.

See JSON output and Transactions and recovery.

6 - JSON Output

Look up JSON response fields, package and operation IDs, errors, and command results.

Use --json on data commands to read one newline-terminated JSON document from stdout. Diagnostics go to stderr. log export is the exception: it writes JSON Lines and does not accept --json.

sow status -r demo --json | jq '.result.status'

Envelope

Every JSON response has these seven fields:

Field Type Meaning
schema string sow.cli/v1
command string Command name, including subcommand, such as repo ls
ok boolean Command succeeded; false when errors are present
repository string or null Selected repository, when attached to the response
operation string or null Command-specific operation or publication identity
result object or null Command data, including useful partial or diagnostic results on failure
errors array Error objects with code, class, and message

Example of a successful configuration check:

{
  "schema": "sow.cli/v1",
  "command": "config check",
  "ok": true,
  "repository": null,
  "operation": null,
  "result": {"workspace": "/srv/repo", "repositories": 1, "dists": 2},
  "errors": []
}

The actual output occupies one line. Paths and counts depend on the workspace. A failure before meaningful work usually has result: null. A failed check and a partially successful add can still return useful results. Preserve them when ok is false.

A maintenance error after a database commit can also return committed results. Inspect the result, status, and the operation log before retrying. A nonzero exit does not mean that the transaction rolled back.

Errors

{"code":3,"class":"partial","message":"managed: batch partially succeeded"}

Branch on code or class, not message text. Classes are runtime, usage, discovery, config, partial, lock, integrity, rejected, and interrupted. See Exit codes for the mapping and next steps.

Identities

Keep operation and generation IDs as strings. Operation IDs can exceed JavaScript’s exact integer range. Generation IDs are 20-digit, zero-padded decimal strings:

{"operation":"8632724976452398569","built_generation":"00000000000000000004"}

This applies to generation, built_generation, base_generation, and generation-valued base fields. Desired revisions and counts remain JSON numbers.

The top-level operation field is set as follows:

Command Value
add, rm without preview, build, local gc Journal ID, if allocated
publish, publish --abort Publication attempt ID, if available
log ID Requested operation ID
Other commands null; log prune puts its ID in result.operation

A null operation does not mean the command is read-only. where keeps the top-level repository null and places repository names inside its locations.

Plain create

Result field Meaning
dir Absolute indexed directory
rpm, deb Indexed package counts
kept Sorted included filenames
removed Files removed by --pigsty
marker Whether the completion marker was produced
marker_sha256 Marker digest, present with the marker
noop No public changes were needed
recovered Always false; Plain mode has no journal recovery
signed, signer Signed filenames and signer identity, when available

Initialization and configuration

Command Result
init workspace, config_created, repositories_initialized, dists_initialized, existing
config check workspace, repositories, dists
config show Effective configuration: schema, architectures, repos, and targets when present

Resolved signing settings can contain public fingerprints and certificate snapshot hashes. Fingerprint and hash arrays are independently sorted and must not be paired by index. See Configuration.

Repositories and Dists

repo ls returns result.repositories[]. repo new and repo show return one repository object directly. Common fields are name, path, protected, dists, generation, desired_revision, status, packages, memberships, and config. dirty_reasons and recent_operation appear when available. An operation summary has id, kind, state, created_at, and updated_at, plus optional error_class. The same summary shape appears in status.pending_operation and status.recent_operation.

packages counts stored package objects; memberships counts Desired Dist memberships. One object in two Dists counts as one package and two memberships.

dist ls returns result.dists[]. dist new and dist show return one Dist object: name, format, architectures, desired_members, built_members, generation, dirty, status, effective_config_sha256, and config, with optional dirty_reasons.

Each architecture entry has family and ecosystem_arch. DEB uses canonical family x86_64 with ecosystem name amd64, for example.

repo rm and dist rm return name, removed, and noop. repo migrate returns repository, repository_id, from_layout, to_layout, schema_from, schema_to, phase, generation, grace_not_before, legacy_aliases, and complete, plus optional warnings. grace_not_before is null when no grace deadline applies. Migration-abort warnings identify retained temporary stages or incomplete cleanup. Once repository selection succeeds, a migration failure keeps that repository in the response. See repo migrate for phase meanings.

add, rm, and build

All three report repository state after the operation: repository, desired_revision, built_generation, and dirty.

add also returns operation, accepted, failed, memberships_added, memberships_removed, and items[]. Each item has input and status. It also has format, coordinate, sha256, a per-Dist dists map, and error when those values are available.

Item status Meaning
accepted New package accepted into membership
reused Existing package object reused; membership can still change
excluded No selected Dist accepted the package because of policy
failed Input failed; inspect error

Per-Dist outcomes are accepted, excluded, or limited. A package can have different outcomes in different Dists. Membership removal counts can increase when limit removes older versions.

rm returns optional operation, removed[], selected dists, changes[], and check. Each removed record has dist, sha256, coordinate, and name. A preview has check: true; only prediction_complete: true confirms a complete predicted file list. Pool bytes are not removed by rm.

build returns operation, considered dists, and noop. A no-op creates no new generation.

status and check

status returns status, ready_to_copy, desired_revision, built_generation, dirty_dists, dirty_reasons, pending, and repository_locked. Optional fields include pending_operation, recent_operation, and lock_holder.

status is clean, dirty, recovering, or error. pending contains count and bytes. A successful status query can return any repository state. ok: true means the query succeeded. Before publication or copying, run check for a complete validation.

check returns repository, status, ready_to_copy, built_generation, desired_revision, and layers[]. Each layer has name, ok, checked, and issues.

Normal layers are config, state, public-modes, retained, package-bytes, desired-membership, index, signature, and generation-manifest. An active layout transition instead reports the first three and layout-transition. A dirty repository can pass individual consistency layers and still fail readiness with exit 5.

changes

The result has repository, base, generation, dirty, and changes[]. Each change contains:

Field Values
op add, update, delete
phase payload, metadata, pointer, delete
path Slash-separated path relative to the repository root
size, sha256 Present for added/updated files; omitted for deletions

No base compares with the previous built generation. Base 0 lists the complete current tree. A numbered base compares that recorded generation with the current one. This is a local file difference; use publish and target gc for remote changes.

Package queries

Command Result fields
ls repository, selected dists, dirty, packages[]
show repository, package
where reference, locations[]

Package objects include sha256, format, coordinate, architecture, canonical_arch, pool_path, filename, size, name, source, version, kind, storage, created_revision, dists, and built_dists. Optional fields include epoch, release, RPM payload_sha256 and signature_key, and warning.

architecture is native (noarch, amd64, etc.); canonical_arch is x86_64, aarch64, or neutral. storage is pool or pending; it does not describe remote publication. dists records Desired membership; built_dists records the last built membership. Package-object coordinate omits the format prefix; prepend format + ":" to form a CLI coordinate reference. where location coordinates already include the prefix. Each location has repository, dists, built_dists, sha256, and coordinate.

Publication and maintenance

Command Main result fields
publish repository, target, provider, generation, optional attempt/checkpoint, phase, objects, noop
publish --abort repository, target, provider, attempt, phase, objects
retain add/rm repository, record, record_identity, path
retain ls repository, generations[]
Local gc Optional operation, repository, base_generation, generation, objects, bytes, noop
Target gc repository, target, provider, phase, reports, candidates, deleted_objects, deleted_bytes, retained_objects, pending_grace, completed_attempts, noop
export rpm-leaf repository, repository_id, generation, dist, arch, directory, method, signed, signer_identity, packages, files, manifest_sha256

publish --rebind has the normal publish shape. R2 target GC reports candidates without deleting remote objects.

Operation logs

log returns repository and operations[], newest first. log ID returns repository and detail, with operation, duration_ms, events, packages, memberships, and files.

Detail array Record fields
events sequence, state, detail_json, occurred_at
packages sequence, input_path, disposition; optional package_sha256, coordinate, error_class, message, dists
memberships sequence, dist, package_sha256, action
files sequence, action, phase, path; optional size, sha256

payload_json, result_json, and event detail_json are strings containing JSON. New metadata-building operations include publication_time in payload_json. Older journals and layout migrations can omit it. Parse these JSON strings separately when needed:

sow log -r demo --json \
  | jq '.result.operations[] | .payload_json | fromjson'

log prune returns operation, repository, before, pruned, and compaction_deferred. A date-only argument is resolved in the machine’s local timezone; before contains the resolved timestamp.

log export writes one complete operation record per line, without the envelope:

sow log export operations.jsonl -r demo
sow log export - -r demo

A file target must be new and its immediate parent must be a real directory, not a symlink.

Use a validation result in a script

#!/usr/bin/env bash
set -euo pipefail
sow check -r demo --json | jq -e '.ok' >/dev/null
sow changes 0 -r demo --json \
  | jq -r '.result.changes[] | [.phase, .op, .path] | @tsv'

This checks the local repository and prints its current file manifest. To publish it, run sow publish TARGET for the configured target.

7 - Platforms & Integrations

Supported platforms, filesystem requirements, repository formats, clients, and integration coverage.

SOW builds RPM and DEB repository files on Linux and macOS. Choose a supported local filesystem for the workspace, then configure HTTP or storage access for clients.

Platforms

Operating system amd64 arm64 Release formats
Linux Yes Yes Archive, RPM, DEB
macOS Yes Yes Archive
Windows No No —

Release binaries use CGO_ENABLED=0 and need no language runtime. Source builds require Go 1.27.3 or later. Archives include the README, changelog, Apache-2.0 license, and third-party notices; Linux packages include license and notice files with the binary. Run sow version to inspect the binary version, platform, and build toolchain.

Workspace filesystem

Use a local POSIX filesystem with advisory locks, fsync, and atomic same-filesystem rename. Network filesystems such as NFS are not supported workspace locations. On macOS, use APFS; SOW rejects builds when required atomic directory exchange is unavailable.

Keep the workspace’s public tree and private staging on the same filesystem. Serve only <workspace>/<repo>/. That complete pool/ + dists/ tree can be copied to other storage without the private database or journal.

Full pool paths that differ only in case are rejected. Source-directory case aliases are also rejected on case-insensitive filesystems. A repository created on a case-sensitive volume can contain source directories that a case-insensitive destination cannot represent; filesystem publication checks this before starting. See Layout.

Repository formats and clients

Output Client entry point Package locations
Plain RPM repodata/repomd.xml Beside repodata/
Plain DEB Packages or Packages.gz Beside the indexes; flat APT source
Managed RPM dists/<dist>/<arch>/repodata/repomd.xml Relative paths back to root pool/
Managed DEB dists/<dist>/Release or signed InRelease Root-relative pool/ paths

Managed APT uses component main and SHA-256 by-hash indexes. Metadata signing produces RPM repomd.xml.asc or APT InRelease and Release.gpg.

Publication times

New Managed operations record one publication time when they build metadata, except sow repo migrate. APT Release dates, RPM repomd.xml data timestamps, and metadata signatures use that time. RPM revision remains the Generation number.

Recovery reuses the recorded time. Older journals without a recorded publication time retain their previous timestamp behavior. No-op operations leave publication times unchanged.

XML and SQLite RPM metadata

SOW generates gzip-compressed primary, filelists, and other XML. It does not generate SQLite primary_db, filelists_db, or other_db. These are distinct metadata formats; a tool that only accepts primary_db needs an XML input path or a separate conversion.

Missing primary_db does not by itself prevent YUM from reading the repository. YUM’s upstream loader falls back to XML and creates its local cache when a suitable SQLite index is unavailable. See the YUM metadata loader. SOW’s generated XML uses gzip, so zstd support is a separate question when comparing other repositories or tools.

SOW does not generate zchunk, modulemd, or source-package indexes. If your clients need module profiles or dnf module install, keep a tool that provides module metadata. For ordinary RPM installation from modular packages, apply the appropriate client module_hotfixes policy; see the migration guide.

dnf reposync

Default dnf reposync confines downloads to one repository directory, so it rejects the parent-relative package locations in a canonical Managed RPM view. This follows its documented safe-write path. Use sow export rpm-leaf to generate a self-contained directory for that workflow.

Existing EL7 caches

EL7 YUM compares metadata data timestamps with its cached repository. Plain create --metadata-timestamp SECONDS lets you preserve and advance an existing publication time. The default is 0.

Exported RPM leaves and RPM metadata generated during sow repo migrate use timestamp 0, with no timestamp override. Later Managed builds use their recorded publication time. For these outputs, use a new repository ID if the existing ID has cached a positive timestamp. Alternatively, clear that ID’s metadata cache. Changing the base URL alone is insufficient. To retain the old ID and cache, follow the timestamp procedure with Plain mode in YUM migration.

RPM signatures

Package-signing workflows support RPM format v4. RPM format v6 signature tags are not supported. Metadata key-reference support is separate; see Signing.

Publication providers

Provider Publication Target GC
filesystem Writes below an existing canonical file:// endpoint Conditional deletion after cache grace, followed by public-absence verification
r2 Writes through S3-compatible storage operations Reports candidates; does not delete remote objects

Both publish the complete repository under the configured prefix. Configure the HTTP service, DNS, credentials, access policy, and cache behavior for that storage. public_endpoint tells SOW where to verify public content; it does not create the service. R2 public endpoints must use HTTP(S). Filesystem targets also accept file:// verification.

Automated coverage

The source tree contains these integration checks:

Check Environment Scope
CLI clean-room workflow Linux CI Shipping binary, mixed Plain output, Managed initialization, RPM/DEB Dists, queries, build, and check
Plain APT client pgsty/u22 Ubuntu 22.04 container HTTP update, discovery, version selection, download, and installation with an explicitly trusted unsigned source
RPM detached-signature transitions AlmaLinux 8/9 and pgsty/el10 containers DNF behavior while repomd.xml and its detached signature change
S3-compatible transport Pinned PGSTY Silo container Bucket listing, HEAD, GET, conditional single-part PUT, replay, and object SHA-256 metadata
Release packaging Linux CI Four archives, two RPMs, two DEBs, checksums, package paths, and license files

The DNF test checks signature transitions; the APT test uses unsigned Plain output. Complete signed Managed installation and hosted R2 conditional multipart completion require checks in the deployment environment.

Before switching clients, run sow check, publish to the intended target, then use the actual client configuration to refresh indexes and install a package. See Serving for client setup.