Skip to content

sow check

Verify package bytes, indexes, signatures, and state before you deliver a repository.

sow check is the gate before you copy or publish a standard repository. It hashes every package file again, verifies every declared signature, confirms that each index matches the membership it claims, and compares the current Generation’s manifest with the files on disk. It is read-only and reports ready_to_copy for the scope you checked. Before delivering a whole repository, run sow check -r REPO without -d. For a quick state query that skips package hashing, use sow status.

Synopsis

sow check [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-j, --jobs N Parallel verification workers; at least 1 logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Check membership and indexes for these Dists; repeatable all Dists
--json Output JSON false

With -d, a clean Dist can return 0 and ready_to_copy=true while another Dist is dirty. The database, public tree permissions, and current Generation manifest still receive repository-wide checks.

Output

The first line summarizes the repository state as status does; each further line is one verification layer:

sow check
repository=pigsty status=clean ready_to_copy=true revision=5 generation=5
config	ok=true	checked=5
state	ok=true	checked=1
public-modes	ok=true	checked=67
retained	ok=true	checked=0
package-bytes	ok=true	checked=8
desired-membership	ok=true	checked=8
index	ok=true	checked=2
signature	ok=true	checked=9
generation-manifest	ok=true	checked=1

Verification layers

Layer Verification checked counts
config sow.yml parses and validates for the repository configuration objects
state SQLite quick_check, foreign keys, journal, and recovery evidence one state database
public-modes File and directory permissions across the served tree inspected paths
retained Retained records and their saved Generation manifests retained records
package-bytes SHA-256 of pool and private pending payloads packages
desired-membership Membership rows resolve under current policy memberships
index Rendered indexes match the membership they claim Dists
signature Every declared metadata and package signature verifies signatures
generation-manifest The current Generation manifest matches the files on disk one manifest

If a retained record is damaged, the retained layer names the Generation; see retain rm for how to discard it.

Dirty is not deliverable

A dirty repository fails an unscoped check even when every file is intact. This includes one whose limit or exclude policy in sow.yml changed since the last build. The last Generation and the new desired state can each be internally consistent, but they differ, so the tree on disk is not what you asked for:

sow check
repository=pigsty status=dirty ready_to_copy=false revision=6 generation=5
...
integrity or recovery error: managed: repository is not ready to copy: repository status is dirty

The exit code is 5. Run sow build, then run sow check again.

Details

Package verification

Every run hashes the package files again; checked counts packages, not file reads, and hard links to the same physical file share one hash. Signed RPMs are also signature-verified, including RPM v6 native RPMSIGTAG_OPENPGP (tag 278, with dual- and multi-signed RPMs) and RSA, DSA, ECDSA, and EdDSA packets in header signature tag 267 (RPMSIGTAG_DSA). When copying broke the hard links of APT by-hash files, check verifies them by content digest instead. .DS_Store files under .sow/ are tolerated.

Unfinished layout migration

During an unfinished layout migration, check reports config, state, public-modes, and layout-transition, then stops. Follow the reported repo migrate instruction to complete or abort the migration.

Exit codes

Code Trigger
0 Every layer passes and the selected scope is ready to copy
1 I/O failure during verification
2 Usage error, workspace not found, or implicit repository selection is ambiguous
5 A verification layer failed, or the repository is not deliverable
6 Explicit repository or Dist is not configured

See also

Table reader