Skip to content

sow rm

Remove packages from Dists, preview the exact file changes first, or stage removals for one later build.

sow rm takes packages out of the selected Dists’ desired membership and rebuilds those Dists' local indexes. Use it to withdraw a broken or unwanted package; preview the result with --check, or stage several removals with --skip and build once. The package files stay in pool/, because other Dists or retained Generations may still use them, until sow gc can reclaim them. To drop a whole Dist, use sow dist rm.

Synopsis

sow rm PACKAGE... [-c|--check] [--skip] [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]

PACKAGE is a package name, coordinate, file name, or sha256: reference; see Package references. A --check preview can render signed metadata, so it also accepts --passfile.

Options

Flag Description Default
-c, --check Preview only; compute and print the plan without writing anything off
--skip Update the desired state only; do not build off
-j, --jobs N Parallel workers logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Select a distribution; repeatable selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

--check and --skip are mutually exclusive, and --check takes no lock options:

sow rm epel-release -c --skip
usage error: --check and --skip are mutually exclusive

sow rm centos-release -r pigsty -d el9 -c -T 5s
usage error: rm --check does not accept --timeout or --no-wait

Examples

Preview a removal, then apply it:

sow rm patroni -r pgsql -d el9 -c
sow rm patroni -r pgsql -d el9

Remove one exact object from two Dists:

sow rm sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab -r pgsql -d el9 -d el9-beta

Stage several removals, then build once:

sow rm old-tool legacy-agent -r pgsql -d el9 --skip
sow build -r pgsql -d el9
sow check -r pgsql

Feed the preview plan to another tool:

sow rm patroni -r pgsql -d el9 -c --json | jq -r '.result.changes[] | "\(.phase)\t\(.op)\t\(.path)"'

Package references

PACKAGE accepts five forms. Package References has the full grammar and disambiguation rules.

Form Example
Content hash sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab
RPM coordinate rpm:epel-release-0:7-5.noarch
DEB coordinate deb:libpq5=18.3-1:amd64
Full filename epel-release-7-5.noarch.rpm
Bare binary name epel-release

A bare name matches every version and architecture of that name in the selected Dists; every other form must identify exactly one object, and an ambiguous one fails with the matching candidates. sow ls prints exact sha256: references and canonical coordinates, so you never have to assemble one by hand. A reference that matches nothing fails the whole command:

sow rm nosuch -r pigsty -d el9
operation rejected: managed: operation rejected: package reference not found: package reference "nosuch" matches no Desired Membership

Preview with –check

-c/--check computes the removal and the local file changes it would make, without modifying the repository or touching .sow/<repo>/stage. It validates the candidate configuration and the existing state, and takes shared locks, so it waits for a running writer.

sow rm centos-release -r pigsty -d el9 -c
preview repository=pigsty operation= dists=el9 memberships=2 revision=3 generation=00000000000000000005 dirty=false changes=8
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64" sha256:b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead
change op=add phase=metadata path="dists/el9/x86_64/repodata/47950aa13d195a32d224ff9bc4c21ff9ef17ff7ff0a5df2e5f081b165efcff51-primary.xml.gz" size=800 sha256:47950aa13d195a32d224ff9bc4c21ff9ef17ff7ff0a5df2e5f081b165efcff51
change op=add phase=metadata path="dists/el9/x86_64/repodata/bd11398342b0976d30b04fc6ddc8cefeb95c71d9b54f3c49abec0525aadf8dc2-filelists.xml.gz" size=374 sha256:bd11398342b0976d30b04fc6ddc8cefeb95c71d9b54f3c49abec0525aadf8dc2
change op=add phase=metadata path="dists/el9/x86_64/repodata/e1ad4e4ee9c9d78e7b39c3dd04f6ae5aded0a935d0ed707a090e7b1227871e54-other.xml.gz" size=620 sha256:e1ad4e4ee9c9d78e7b39c3dd04f6ae5aded0a935d0ed707a090e7b1227871e54
change op=update phase=pointer path="dists/el9/aarch64/repodata/repomd.xml" size=1538 sha256:7ef73230d19b3e145e27d04f604e782c904588250d54c1167be32cfb5068c026
change op=update phase=pointer path="dists/el9/x86_64/repodata/repomd.xml" size=1538 sha256:7ef73230d19b3e145e27d04f604e782c904588250d54c1167be32cfb5068c026
change op=delete phase=delete path="dists/el9/x86_64/repodata/2446439ec26f96463b15e8b47796bb0f8b68400f3b129756d37f942f7f81ba70-other.xml.gz"
change op=delete phase=delete path="dists/el9/x86_64/repodata/67c4c4607c8ea8b41365a948f0a437843b2d5217c6eae5cc1e098e5bfc0ae310-filelists.xml.gz"
change op=delete phase=delete path="dists/el9/x86_64/repodata/70643c948cae2d671dc2935692d33c6dc62d8749f2c983fa992a4e1e5e2ab4b6-primary.xml.gz"

The bare name matched both centos-release versions. membership lines list the memberships your references matched; change lines list the expected local file changes in payload → metadata → pointer → delete order. If current policy would drop further members as a result, their index changes appear among the change lines, and their count appears in sow log after the real run. With --json, read the removed[] and changes[] arrays.

The preview predicts membership removals, policy results, file paths, actions, Generation, and revision exactly, provided the references, selected Dists, repository state, configuration, and signing keys do not change before the real run. Index and signature bytes, hashes, and sizes can still differ: the real build records its own publication time, and non-deterministic signature algorithms such as ECDSA and DSA produce new bytes on every signing. Crash recovery reuses the metadata that the real run staged or installed, not the preview’s.

Default behavior: remove and rebuild

Without --check or --skip, rm commits the change to the desired state and rebuilds every affected Dist before it returns:

sow rm 'rpm:centos-release-0:6-0.el6.centos.5.x86_64' -r pigsty -d el9
removed repository=pigsty operation=6815056191216444844 dists=el9 memberships=1 revision=3 generation=00000000000000000005 dirty=false changes=2
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16
change op=update phase=pointer path="dists/el9/aarch64/repodata/repomd.xml" size=1538 sha256:3a73bb4d0c1e10a1d5e6cf8d1e33e8407211c4e4f413297ff04db727efcc17cf
change op=update phase=pointer path="dists/el9/x86_64/repodata/repomd.xml" size=1541 sha256:c94ca3b2d93db245a5ba17a32f795293fb6669079075c3a8530580ea0db27aa4

One change line follows the summary for each affected file. Here only the two repomd.xml pointers changed; the checksum-named metadata files they now reference were already in the tree. --json returns the same result in the standard envelope.

Removing the last member of a Dist is fine: SOW still renders a valid empty index, signed if signing is configured, such as an empty Packages with a verifiable InRelease or an empty repodata/ per architecture.

–skip

--skip commits the change to the desired state and leaves the public tree untouched. The repository becomes dirty when the desired state now differs from the built state; removing an addition that was never built can return it to clean without a build.

sow rm 'rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64' --skip -r pigsty -d el9
removed repository=pigsty operation=2095701184059097821 dists=el9 memberships=1 revision=4 generation=00000000000000000005 dirty=true changes=0
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64" sha256:b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead
sow status -r pigsty
repository=pigsty status=dirty ready_to_copy=false revision=4 generation=5 dirty_dists=el9 pending=0/0 locked=false

changes=0 because nothing was built. Run sow build to apply the pending changes.

Policy interaction

Removal does not bring back packages that policy dropped earlier. SOW re-applies policy to the remaining members, so if you remove libpq5 18.3-1 from a limit: 1 Dist, the previously excluded 18.2-1 stays excluded. Run sow add for it to restore it.

Exit codes

Code Trigger
0 Memberships removed and Dists rebuilt, or a --check preview printed
1 Runtime I/O or renderer failure
2 Usage error — --check with --skip, --check with lock flags, ambiguous selection, workspace not found
4 Repository lock held and --no-wait given or --timeout expired
5 Integrity or recovery error
6 A reference matched nothing, or a non-bare reference was ambiguous; SOW rejects the whole batch and removes no memberships

See also

Table reader