This is the multi-page printable view of this section.
Reference
- 1: Troubleshooting
- 2: sow.yml Reference
- 3: Package References
- 4: Repository Layout
- 5: Exit Codes
- 6: JSON Output
- 7: Platforms & Integrations
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.
- Configuration — Fields, defaults, validation rules, signing references, and publication targets in
sow.yml. - Package references — Select packages by digest, coordinate, filename, or name, and resolve ambiguous matches.
- Repository layout — Locate package files, indexes, private state, and publication output.
- Exit codes — Interpret command results and choose the next action in scripts.
- JSON output — Read the
sow.cli/v1response and command result fields. - Platforms and integrations — Check supported systems, filesystems, client formats, and integration coverage.
- Troubleshooting — 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
Start with the error message and the exit code. For Managed commands, specify the workspace and Repository so you inspect the intended state:
Replace /srv/sow, pgsql, and the target name prod below with your configuration.
The database needs migration
SOW 0.9.0 and versions 0.5.0 through 0.8.0 use schema v13. These workspaces can upgrade directly, and 0.9.0 directly resumes interrupted 0.7.1 local GC plans containing an empty manifest array. See the upgrade guide.
For a 0.3 or 0.4 workspace, stop writers and back up the complete workspace. Then run:
Repeat this for each Repository. Compatible read-only commands can still inspect an older
schema, but they do not migrate it; write commands and init reject an unmigrated schema v12 database with exit code 6. If a Repository migrated from C2 layout by SOW 0.5 or
0.6 reported an invalid transition control target after a later build, SOW 0.7.0 and later
recover this state automatically. See Upgrade.
If leftover C2 migration stage files block local GC, rerun sow repo migrate REPOSITORY.
SOW 0.7.1 and later preserve unproven files under .sow/<repo>/abandoned/ and report their location. Inspect them before removal.
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:
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, or rerun
sow prune with the same --protect and --metadata-timestamp 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.
For an interrupted local gc or retain rm, rerun sow gc or sow retain rm GENERATION (including interrupted 0.7.1 empty-manifest local GC plans). If an R2 target deletion was interrupted, resume it with sow gc TARGET --delete.
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 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:
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. If a populated workspace loses .sow/workspace.lock, stop all SOW processes and scheduled jobs for that workspace, exclusively create an empty 0600 .sow/workspace.lock as the workspace owner, and run sow init before restarting jobs.
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. - Regular files, symlinks (including Kubernetes Secret mounts), and named pipes (FIFOs, with a 2-second writer deadline) are supported. The password is one nonempty line (optional UTF-8 BOM and one final LF or CRLF are removed); spaces and tabs are significant. The file is not a shell script or
NAME=valueassignment. - 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 checkunlocks 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.checkverifies 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
sow.yml configures a Managed workspace. It declares repositories, Dists, package policy,
signing, and publication targets. Plain sow create and sow prune do not read it.
After editing the file, validate it and inspect the effective settings:
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. Read-only inspection (config check,repo ls,repo show,dist ls,dist show) also accepts frozensow/v2workspaces before migration. - Unknown fields and duplicate keys are errors.
- Name the file
sow.ymlorsow.yamland keep it at the workspace root as a regular file of at most 16 MiB (sow initcreatessow.ymland rejects a symlink; discovery and reads follow a symlink to a regular file). Having bothsow.ymlandsow.yamlas regular files is an error. Withsow.yml, an existing repository directory namedsow.yamlremains supported. init,repo new/rm, anddist new/rmupdate the file as part of their operations.- Edit policy, signing, and target settings in the file. SOW applies defaults when reading the file and does not rewrite the source.
Use repo migrate to upgrade an older repository database or layout.
Workspace
| 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
| 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
| 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.
SOW rejects removing an architecture that membership or built state still references.
limit must be non-negative. RPM uses epoch-version-release ordering (sorting caret ^
snapshot versions before point releases, such as 2.0^20250611 < 2.0.1); 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
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:
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 (tolerating human-readable comment lines outside armor fences) or binary OpenPGP data in a regular file of up to 16 MiB. Relative paths resolve from the workspace root. Regular files and symlinks (including Kubernetes Secret mounts) are supported.
Metadata signing accepts RSA, EdDSA (Ed25519/Ed448), ECDSA, and DSA keys and 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 requires SOW 0.7.0 or later. 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:
--passfile PATH: override every signing key used by this invocation.- The key’s configured
passfile, or its legacypassphrasereference. SOW_GPG_PASSFILE: default file path for keys without a configured source.- 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.
The file contains the password itself, with these exact rules:
- One nonempty line, at most 64 KiB including an optional terminator; an optional UTF-8 BOM is removed.
- 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, orNAME=valuesyntax. - 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.
- Regular files, symlinks (including Kubernetes Secret mounts), and named pipes (FIFOs) are supported. A FIFO writer has two seconds to supply the line and close its end. Keep credentials outside published paths.
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 and Plain prune do not
accept --passfile. Recovery selects the source
again from the current invocation and configuration; SOW never journals password values.
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 sow-gpg-pass-* directory under $TMPDIR (falling back to /tmp) because RPM
may invoke GPG repeatedly. SOW zero-overwrites and removes it when the signing call returns; forced process
termination can leave it behind. On failure, SOW can surface a bounded diagnostic from up to 4 KiB of helper stderr.
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 follow the same path rules as key files.
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
| Field | Required | Meaning |
|---|---|---|
repository |
Yes | Existing repository name |
provider |
Yes | filesystem or r2 |
endpoint |
Yes | file:///absolute/path, or https://host (or http://localhost) for R2; case and trailing slash are normalized |
region |
No (R2 only) | Defaults to auto; lowercase [a-z0-9-]{1,64}; forbidden for filesystem |
bucket |
R2 only | Lowercase DNS-safe bucket name (a-z, 0-9, -, and . without ..); 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 | Verification URL (normalized to end in /); filesystem accepts HTTP(S) or file://, R2 accepts HTTP(S) |
max_cache_ttl |
Yes | Non-negative Go duration (such as 0, 0s, 5m, or 24h), normalized to canonical form |
authoritative_workspace |
No | Defaults to true; explicit false or null is rejected |
single_writer |
No | Defaults to true; explicit false or null is rejected |
exclusive_write_authority |
No | Defaults to true; explicit false or null is rejected |
The last three fields state that this workspace owns publication and is the only writer
for the target namespace; they default to true when omitted. Targets on the same storage
cannot have overlapping prefixes—for R2, two targets on the same (endpoint, bucket) with
overlapping prefixes are rejected regardless of region spelling (such as auto vs us-east-1).
Filesystem targets cannot resolve to overlapping directories.
Shorthand Go durations such as 0, 5m, or 24h are accepted and normalized (for example,
24h0m0s). Durations are bounded below Go’s maximum duration to leave room for the cache-grace
margin. Set max_cache_ttl to cover the longest cache lifetime used by the public service:
starting in SOW 0.9.0, new target GC grace records use max_cache_ttl directly without a
30-day floor, so 0s gives superseded objects zero grace.
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:
The referenced environment variable or file contains one JSON document:
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
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.
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. SOW rejects abbreviated or uppercase digests
with exit code 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.
SOW matches an rpm: reference 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.
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 |
Plain sow prune --protect NAME also accepts only an exact binary RPM package name (not coordinates, digests, or filenames).
Preview a name-wide removal before applying it:
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 SOW cannot infer the Dist 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
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_completewith --pigsty
sow create writes RPM metadata only when RPMs are present and DEB metadata only when
DEBs are present. sow prune prunes RPMs in flat directories (including mixed RPM/DEB directories, where it preserves the DEB index and existing repo_complete DEB entries), keeping the highest EVR per
package name and architecture. RPM locations use a bare basename; DEB locations use ./<basename>.
A running build uses private .sow-plain-stage-* directories, and an active prune tracks
its completion marker with .sow-prune-repo-complete. Exclude these private paths 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 or prune runs. It does not belong in a client index and is not a recovery journal.
Managed workspace
- <workspace>/
- sow.ymlworkspace configuration
- .sow/private state
- workspace.lock
- workspace-ops/
- repo-locks/<repo>.lock
- <repo>.db
- <repo>/
- abandoned/retained migration stages
- stage/active staging and retain-remove-* removal plans/tombstones
- recovery/active local GC plans (<operation-id>/plan.json) and detached payloads
- retained/retained generation records
- 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.9.0 uses database schema v13 and configuration schema sow/v3 (stored in sow.yml or sow.yaml). 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
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.ascwith metadata signing
- aarch64/repodata/
- x86_64/repodata/
Architecture views contain metadata only. Each package location points back to the root pool:
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
- InReleasewith metadata signing
- Release.gpgwith metadata signing
- main/
- binary-amd64/
- Packages
- Packages.gz
- by-hash/SHA256/<digest>
- binary-arm64/
- binary-amd64/
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.
SOW rejects any new pool path that differs only in case from an existing path, 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
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:
A dirty repository can have consistent old indexes and still fail check with code 5,
because you have not built the Desired state. 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 SOW accepted or reused at least one input and at least one
input failed. The JSON result retains per-input outcomes. Exclusion by policy is not a failed
input. init can return 3 after creating some declared objects and failing on a
later one. prune also returns 3 if an error occurs after it publishes the filtered index
or removes at least one RPM.
Capture both output and status before deciding whether to continue:
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 and prune print their domain
error to stderr; their 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
Use --json on data commands to read one newline-terminated JSON document from stdout.
Diagnostics go to stderr; for successful flat create and prune runs, warnings and skipped
entries are returned inside the stdout JSON envelope and stderr stays empty. log export is
the exception: it writes JSON Lines and does not accept --json.
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:
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
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:
This applies to generation, built_generation, base_generation, and generation-valued
base fields. Desired revisions and counts remain JSON numbers.
SOW sets the top-level operation field as follows:
| Command | Value |
|---|---|
add, rm without preview, build, local gc, log prune |
Journal ID, if allocated |
publish, publish --abort |
Publication attempt ID, if available |
log ID |
Requested operation ID |
Other commands (create, prune, init, config, ls, show, where, retain, export) |
null |
A null operation does not mean the command is read-only. create, prune, init, config check, and repo ls keep the top-level repository null. where sets the top-level repository when -r/--repo is given and keeps it null when searching across all repositories; each entry in result.locations also carries its own repository.
Plain create and prune
sow create returns these fields in result:
| Result field | Meaning |
|---|---|
dir |
Absolute indexed directory |
rpm, deb |
Indexed package counts |
kept |
Sorted included filenames |
removed |
Files removed by --pigsty |
skipped |
Array of {path, reason} objects for packages skipped in default fault-tolerant mode, when present |
warnings |
Warning strings reported during scan or publication, when present |
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 |
dropped_metadata |
Unsupported repomd.xml data types (such as group, updateinfo, or modules) replaced by create, when present |
sow prune returns these fields in result:
| Result field | Meaning |
|---|---|
dir |
Target directory path |
dry_run |
Whether --dry-run was set |
kept |
Sorted basenames of retained top-level RPM packages |
candidates |
Array of {path, latest} objects naming each removal candidate and its retained replacement RPM |
removed |
Basenames of removed RPM files |
skipped |
Array of {path, reason} objects for skipped RPM files in default fault-tolerant mode, when present |
warnings |
Warning strings (such as corrupt packages, equal-version conflicts, or unmatched --protect names), when present |
index_updated |
Whether repodata/ was rewritten |
marker |
Whether repo_complete is present after completion |
noop |
True when no package needed removal and no index write occurred |
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. rm does not remove pool bytes.
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 uses the target GC result fields for both the default report and gc TARGET --delete. The latter records verified removals in deleted_objects and deleted_bytes.
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:
log prune returns operation, repository, before, pruned, and
compaction_deferred. SOW resolves a date-only argument in the machine’s local timezone;
before contains the resolved timestamp.
log export writes one complete operation record per line, without the envelope:
A file target must be new; symlinked parent directories (such as /tmp on macOS) are resolved to their physical directory before atomic creation and directory sync.
Use a validation result in a script
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
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.4 or later. Archives include the sow binary and the Apache-2.0 LICENSE;
Linux packages install /usr/bin/sow and the Apache-2.0 license.
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>/. You can copy that complete pool/ + dists/ tree to
other storage without the private database or journal.
SOW rejects full pool paths that differ only in case. On case-insensitive filesystems, SOW also rejects source-directory case aliases. 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.
For binary DEBs, SOW reads control.tar uncompressed or compressed with gzip, bzip2, xz, or zstd, and normalizes legacy Latin-1 bytes (>= 0x80) in binary control files to UTF-8. Rebuild packages that use control.tar.lzma with a supported control archive (dropped in 0.8.0) before importing them.
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 and prune --metadata-timestamp SECONDS let 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 formats and signatures
SOW supports RPM format v4 and RPM format v6 (lead major versions 3 through 6, PAYLOADSHA256 without PAYLOADSHA256ALGO, and native RPMSIGTAG_OPENPGP tag 278 OpenPGP v4 and v6 signature arrays) across Plain create / prune and Managed add / build / check, including dual- and multi-signed RPMs. SOW also verifies RSA, DSA, ECDSA, and EdDSA (Ed25519) OpenPGP packets in RPM header signature tag 267 (RPMSIGTAG_DSA) and legacy PGP tags; when tag 278 is present it is authoritative. RPM indexing accepts identical duplicate main-header tags (such as EL10 duplicate SOURCERPM) while rejecting conflicting main tags and duplicate signature-header tags. Metadata signing supports RSA, EdDSA (Ed25519/Ed448), ECDSA, and DSA keys; 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 by default. gc TARGET --delete rechecks eligible objects, deletes them and verifies absence |
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 |
|---|---|---|
| Core contract tests | Linux and macOS CI | Repository manager, recovery, signing, and patched RPM parser unit and contract suites |
| CLI clean-room workflow | Linux CI | Shipping binary, mixed Plain output, Managed initialization, RPM/DEB Dists, queries, build, and check |
| Plain APT client | Ubuntu 22.04 | Update, discovery, download, and installation from an explicitly trusted unsigned source |
| Signed Managed clients | Ubuntu 22.04 and AlmaLinux 9 | APT and DNF verify signed repository metadata and install a package |
| RPM signing and detached-signature transitions | AlmaLinux 8, 9, and 10 | Protected-key signing with a password file and DNF behavior while the detached signature changes |
| S3-compatible publication | Pinned PGSTY Silo container | Object transport, Managed GC deletion, republishing identical bytes, and a subsequent no-op publish |
| Release packaging | Linux CI | Four archives, two RPMs, two DEBs, checksums, package paths, and license files |
Verify conditional multipart completion against the hosted R2 endpoint used in your deployment.
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.