Mirrors and content
Praxis can serve packages to your fleet from mirrors you control, and can move that content into fully disconnected (airgapped) environments. Everything lives under the Automate workspace.
Mirrors
Automate > Mirrors lists the package repositories Praxis maintains. A mirror has a package family (deb or rpm) and a source mode:
- Upstream sync - Praxis pulls from an upstream repo on a schedule. Each sync is a run with a status; the mirror detail page shows run history and lets you trigger an on-demand sync. The upstream URL must not carry credentials; see upstream URLs.
- Imported offline - content arrives via an airgap bundle rather than a live upstream (see below).
Mirrors are signed so downstream hosts can verify what they install. The mirror’s signing key and the upstream trust it validates against are managed as part of the mirror; a mirror that can’t validate its upstream or sign its output will surface an error state rather than serve unverified content.
A mirror that looks “synced” but shows a signing or upstream-trust error is not safe to serve. Check the run status and signing state on the mirror detail page before pointing hosts at it.
Channels and profiles
Mirrors are raw repositories; channels and profiles compose them into something hosts subscribe to:
Automate > Channels- a channel bundles one or more mirrors of the same package family, optionally pinned to a specific mirror run.Automate > Profiles- a profile is the host-facing object. Hosts, groups, and smart groups subscribe to a profile. Each host resolves to a single effective profile; when subscriptions conflict, the host is flagged rather than guessing.
Applying a profile writes the host’s /etc source-list configuration and installs the trust needed to consume the channel’s mirrors. Apply is explicit - resolving/previewing a profile never changes a host until you apply it.
Conflicting profile subscriptions block a host. If a host is subscribed to two profiles (directly and via a group, say), it resolves to a conflict state and won’t apply until you remove the ambiguity.
A run pin is a tracking pin, not a byte freeze (1.0). Praxis keeps mirror bytes live-only - only the last-promoted sync exists on disk; retention keeps older runs as metadata/manifests, not bytes. A channel pin records a content state, but an airgap export can reproduce it byte-exact only while that run is still what’s live. If you pin to an older run and then re-sync, an export with pinned snapshot selection is refused (
historical_bytes_unavailable) rather than exporting the wrong bytes - export latest, re-pin to the current run, or keep the earlier bundle tar as your byte-exact archive. See the airgap runbook.
Airgap export / import
For disconnected sites, Praxis exports a signed airgap bundle of mirror content and metadata that you physically transfer to the offline instance, which imports it into an imported-offline mirror. The bundle is signed with an instance airgap key so the offline side can verify integrity before trusting the content.
This is a procedure with real operational steps (key handling, transfer, verification); the in-app screens drive it, but the full runbook is airgap export and import.
Airgap signing keys & trust pins
Automate > Airgap Keys is where you manage the two sides of bundle trust - no database edits required.
- Bundle signing key (connected/export side). One key is
activeand signs every bundle you export. Bootstrap it once, then copy its armored public key and hand it to the offline instance out-of-band. - Rotating a key. Rotation is immediate: the current key becomes
rotating_out(still valid for verifying bundles you already exported) and a newactivekey is generated. Before you import any bundle exported after the rotation, pin the new public key on the offline side - bundles signed by the new key won’t verify until its pin exists. Keep the old pin during the overlap: the importer accepts a bundle if any active pin verifies it, so old and new bundles both import cleanly. - Retire a
rotating_outkey once nothing needs to verify bundles it signed. You can’t retire theactivekey - rotate first. - Import trust pins (offline/import side). The offline instance trusts a bundle only if a pinned public key verifies its signature - never the armored bytes carried inside the tar. Add a pin from the exporter’s armored public key; remove the old pin only after you stop importing bundles it signed. Removed pins are soft-deleted and kept for audit.
Every signing-key create/rotate/retire and trust-pin add/remove is written to the audit log (fingerprints and statuses only - never private key material or Vault paths).
Common failure modes
- Unverified/expired upstream key - sync fails closed and nothing new is published; the last published content stays served until trust is repaired.
- Upstream URL carries credentials - the mirror is not synced until you replace the URL.
- Signing key not yet provisioned - the mirror can pull but can’t sign; hosts won’t trust it.
- Profile conflict - a host subscribed via multiple paths won’t apply.
- Family mismatch - a channel can only bundle mirrors of the same
deb/rpmfamily.
Upstream URLs
A new or replacement upstream URL has the form scheme://host[:port]/path, with
http, https, rsync or ftp as the scheme. Praxis refuses with 422 a URL
that has a user or password before the host, a query string, a fragment,
whitespace, a backslash or no valid host. Query strings are refused as a whole
because a token can travel under any parameter name. Validation errors on mirror
routes name the field and the rule, never the submitted value.
Praxis has no way to hold a credential for an upstream. The upstream you configure must be usable without one in the URL.
How a mirror is published
Hosts are served from a mirror’s live/ directory, which is never written in
place. A sync downloads into work/, checks and signs there, builds the next
generation in .live.next/ beside live/, and swaps the two directories in one
step. Sign-current does the same starting from a copy of live/.
- A sync that fails, including because the upstream is unavailable or its
signature cannot be verified, records a failed run and leaves the published
content as it was. A new generation stays published only once its run is
recorded as
ok. .live.next/and the record of a switch in progress,.live.journal, are never served.- With retention, the manifest and signature files of runs that leave the window are removed only after the new generation is confirmed.
- The file system under the mirror root must support exchanging two directories atomically. ext4 does; NFS does not. Without it, the first publication works and every later one fails, leaving the published content in place.
live/may be a symbolic link to a directory elsewhere. The next generation and the switch record then sit beside that directory, named after it:.<name>.nextand.<name>.journal. It must not be a mount point.- Publishing needs free space for the files that differ from the published
ones, in addition to
work/. - A client that fetches several files across a switch can get an old index with a new package list. Running the update again resolves it.
- Do not run an airgap export while the same mirror is publishing: an export is not held to a single generation.
With verify upstream signature on and trust keys configured, an RPM sync
accepts only a repository whose repodata/repomd.xml.asc verifies against those
keys.
Running the procedures below
The commands assume a Docker Compose deployment. Run docker compose with the
same project name, files and profiles you deploy with; the examples show the
shortest form. API calls need a bearer token for an administrator or maintainer.
BASE=https://praxis.example.com/api/backendTOKEN='<bearer token>'The mirror root is /data/praxis/mirrors unless you set PRAXIS_MIRROR_ROOT;
adjust the paths if you did. Each mirror has a directory there named after its
slug.
Move off an upstream URL that carries credentials
Earlier releases accepted upstream URLs that contained credentials. Upgrading does not delete, rewrite or disable such a mirror, but it is no longer synced:
- A scheduled sync records a failed run that says to replace the URL, and raises the usual failure alert. An on-demand sync is refused with 409.
- Hosts keep being served the last published content.
- The API and the UI show the URL with the credential replaced by
REDACTED, and the mirror reportsupstream_url_redacted: true. A stored URL that cannot be parsed, or has a query string or fragment, is treated the same way. - Run errors and mirror alerts are shown with fixed wording. Stored records are not changed. Detail that older releases showed in run history reads as “recorded detail is not available”.
RPM mirrors that earlier releases reported as ok while the upstream was
unavailable now report failed.
1. Find the affected mirrors
curl -sS -H "Authorization: Bearer ${TOKEN}" "$BASE/mirrors" | jq -r '.[] | select(.upstream_url_redacted) | [.id, .slug, .source_mode, .enabled, .upstream_url] | @tsv'Removed mirrors are not listed, but their stored URL and files remain. With the bundled database, list those whose URL has a user, a query string or a fragment. The query prints identifiers only:
docker compose exec -T db sh -c 'psql -U "${POSTGRES_USER:-postgres}" -d "${POSTGRES_DB:-praxis}"' <<'SQL'SELECT id, slug FROM mirror_reposWHERE deleted_at IS NOT NULL AND (upstream_url ~ '://[^/?#]*@' OR upstream_url ~ '[?#]');SQLWith an external database, run the same query with your own client. For these, follow removed mirrors instead of the steps below.
2. Rotate the credential and prepare a source without one
Treat the credential as exposed. A refused mirror no longer sends it, so revoking it at the upstream does not break a Praxis sync. Revoke or rotate it as soon as its other users allow; do not wait for the rest of this procedure.
Provide the same content at a URL that needs no embedded credential: a public source, a source that authorizes your Praxis host by network address, or a relay you operate that authenticates to the upstream itself. Such a relay holds the credential, so restrict who can reach it.
3. Clean the mirror’s directory
Follow Clean a mirror tree for each affected mirror.
Debian-family mirrors can have recorded the upstream, including the credential,
in files under project/trace/. That procedure takes a restricted copy first,
and ends by replacing the URL:
curl -sS -X PATCH -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" \ -d '{"upstream_url": "https://packages.internal.example/debian/"}' \ "$BASE/mirrors/$ID"In the UI, open the mirror under Automate > Mirrors, choose Edit and enter
the complete new URL. Saving the form with the redacted value unchanged keeps the
stored URL, so you can edit other settings before you have a new one.
If there is no source without a credential
Leave the mirror in place. It keeps serving its last published content and
receives no updates. Setting enabled to false stops the scheduled attempts
and their alerts; the content stays served. Still rotate the credential, and
clean the tree if the listing finds anything.
Removed mirrors
A removed mirror is not served or exported, and the API refuses to edit, sync or sign it (404), so no clean generation can be published for it.
- Rotate the credential.
- Set
slugand take the restricted copy, including a linked served tree. Skip step 1 and settling. - Run the listing and searches and record what they report.
- Stop. Restrict access to the directory and the copy. Do not edit, move or delete anything in it by hand, including a pending publication or snapshot files. If your rules require the data to be destroyed, consult the maintainers first, without sending them the credential or the copy.
Copies that Praxis cannot recall
Replacing the URL removes it from the mirror’s configuration. It does not reach copies made earlier:
- container logs, aggregated logs, support bundles and package tool logs;
- alerts already delivered;
- airgap bundles already built, wherever they have been copied, and mirrors imported from them;
- database backups, mirror volume backups and full backup bundles;
- run errors and alert history stored before the upgrade, which remain in the database;
- the restricted copies you make during cleanup.
Restrict access to these, and expire or destroy them under your retention and incident rules. Rotating the credential is what makes them harmless.
Clean a mirror tree
Praxis checks everything that project/trace/ in a mirror tree leads to,
including through links. An entry fails the check if it names an upstream with a
user before the host, leads outside the tree, leads nowhere, is not a file or
directory, or cannot be read. While an entry fails:
- a sync whose
work/tree holds it is not signed or published; - sign-current and airgap export are refused if
live/holds it; - downloads of the affected files return 404, under every path that reaches them. Other files stay served.
Every file of a mirror returns 404 while the server cannot tell what
project/trace/ leads to: a link there leads to a directory outside the tree,
something there cannot be listed, it keeps changing, or the server’s temporary
directory cannot be written. The listing in step 3 shows the first two.
The check does not recognise a token in a query string or in a URL path.
Praxis never edits or removes the files. Handle the file a link leads to before you remove the link: the link is what marks those bytes as sensitive, and once it is gone the file at its ordinary path is served, signed and exported like any other.
1. Pause the mirror
ID=7slug=my-mirrorcurl -sS -X PATCH -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" -d '{"enabled": false}' "$BASE/mirrors/$ID"curl -sS -H "Authorization: Bearer ${TOKEN}" "$BASE/mirrors/$ID/runs?limit=5" | jq -r '.[] | [.id, .run_kind, .status] | @tsv'Wait until no run is running. Do not start a sync, sign-current or export until
step 5. Disabling a mirror does not block sign-current, so make sure nobody else
requests one.
2. Take a restricted copy
Copy the whole mirror directory to storage outside every Praxis volume that only the people handling this can read. The copy needs as much space as the directory, and it contains whatever you are about to remove, including any credential.
copies=/srv/restricted/praxisarchive="$copies/$slug-$(date -u +%Y%m%dT%H%M%SZ).tar"(umask 077 && mkdir -p "$copies" && docker compose exec -T backend tar -C /data/praxis/mirrors -cf - "$slug" > "$archive") && docker compose exec -T backend tar -C /data/praxis/mirrors -df - < "$archive" && echo "copy verified: $archive"Continue only after copy verified. Later syncs apply retention to older
manifests, so make the copy first.
Then check where hosts are served from and whether a publication is pending. This only reads:
docker compose exec -T backend python - "$slug" <<'PY'import sysfrom app.services.mirror_paths import live_dirfrom app.services.mirror_publication import Publication
live = live_dir(sys.argv[1])served = live.resolve()own = live.parents[1].resolve() / sys.argv[1] / "live"journal = Publication(live).journalprint("live/:", "own directory" if served == own else "LINKED")print("served tree:", served, "" if served.is_dir() else "MISSING")print("journal:", journal, "PENDING" if journal.exists() else "none")PYIf the served tree is MISSING, stop and consult the maintainers.
Copy a linked served tree
When the check says LINKED, the archive above holds only the link. Keep it, and
also copy the directory it leads to, with the unfinished generation and switch
record beside it:
served="$copies/$slug-served-$(date -u +%Y%m%dT%H%M%SZ).tar"(umask 077 && docker compose exec -T backend sh -ec ' tree=$(readlink -e "/data/praxis/mirrors/$1/live") name=${tree##*/} cd "${tree%/*}" set -- "$name" for extra in ".$name.next" ".$name.journal"; do if [ -e "$extra" ] || [ -L "$extra" ]; then set -- "$@" "$extra"; fi done exec tar -cf - -- "$@"' sh "$slug" > "$served") &&docker compose exec -T backend sh -ec ' tree=$(readlink -e "/data/praxis/mirrors/$1/live") exec tar -C "${tree%/*}" -df -' sh "$slug" < "$served" &&echo "served copy verified: $served" &&tar -tf "$served" | cut -d/ -f1 | sort -uContinue only after served copy verified, and check that the names printed
include the served directory and, if the journal was PENDING, its switch
record.
Settle a pending publication
If the journal is PENDING, request sign-current before listing or changing
anything. It settles the publication first, also on a disabled mirror; a sync
does not for a mirror whose URL carries a credential. When the tree passes the
trace check it also signs and publishes it again; a refusal for that check comes
after the settlement.
curl -sS -X POST -H "Authorization: Bearer ${TOKEN}" "$BASE/mirrors/$ID/sign-current"Wait for the new run to finish, then repeat the check. If the request is refused,
or the journal is still PENDING, stop: keep the mirror paused and see
interrupted publications.
3. List what must be handled
docker compose exec backend python -m app.services.mirror_trace_audit "$slug"The command scans live/, which hosts are served from, and work/, which the
next sync publishes from. It prints names, never file contents or link targets,
and changes nothing. Each line holds a kind, a tab and a path; each tree ends
with a summary line.
| Exit status | Meaning |
|---|---|
| 0 | Scans completed; no file names a user and each tree passes the check |
| 1 | Scans completed; there is something to handle or review |
| 2 | A scan was incomplete, or there was nothing to scan |
Status 2 is never a clean result. An unreadable line, or SCAN INCOMPLETE,
means files may be missing from the list: restore read access without changing
contents and run it again. not-a-directory means the tree itself is a link or a
file and was not scanned.
| Line | Meaning |
|---|---|
match-trace | Names a user and is reached from project/trace/ |
match-other | Names a user and is not reached from there |
trace-link, trace-link-outside, trace-link-broken | A link passed through from project/trace/ |
link, link-outside, link-broken | Any other link |
special | Not a file, directory or link; it was not read |
The command does not scan a linked live/: it reports not-a-directory for it
and exits 2. Scan the served tree as well, which only reads:
docker compose exec -T backend python - "$slug" <<'PY'import sysfrom app.services.mirror_paths import live_dirfrom app.services.mirror_trace_audit import scan_tree
report = scan_tree(live_dir(sys.argv[1]).resolve())for kind, name in report.findings: print(f"{kind}\tserved/{name}")print("served tree:", report.state, "- files that name a user:", report.matches, "- trace policy:", "refused" if report.refused else "accepted")sys.exit(0 if report.state == "complete" else 2)PYThe command does not look outside live/ and work/. Older releases may also
have left text in .last-error and dnf-state/ in the mirror directory. This
prints the names of files there that contain a URL with a user:
docker compose exec -T backend sh -c \ 'cd "/data/praxis/mirrors/$1" && grep -rlsE "://[^/[:space:]]+@" .last-error dnf-state' sh "$slug"If your credential was a token in a query string or path, search for the token itself. Put it alone on one line in a file only you can read, so that it appears on no command line, and pass that file on standard input:
docker compose exec -T backend grep -rlF -f - "/data/praxis/mirrors/$slug" < /srv/restricted/praxis/tokenThat search does not follow a linked live/; search the served tree too:
docker compose exec -T backend sh -ec ' tree=$(readlink -e "/data/praxis/mirrors/$1/live") exec grep -rlF -f - "$tree"' sh "$slug" < /srv/restricted/praxis/tokenAll searches print names only, and none looks inside compressed files. What they print are candidates to review, not a list to delete.
4. Handle the files, then the links
Paths in the listing are relative to the mirror directory, and served/ paths to
the linked tree. The verified copies keep everything, so removing an entry here
moves it into restricted storage. Do not edit a file in place.
With a linked live/, change nothing in the served tree. Clean work/; a
successful sync then replaces the served tree with a copy of it. If the mirror
cannot sync from an upstream and its served tree needs a change, stop and consult
the maintainers.
- Remove every
match-tracefile, in both trees. Each name of a file has its own line. If repository metadata lists a removed file, hosts cannot fetch it until a clean publish replaces it. - Review each
match-otherline. It can be unrelated content, or a separate copy of the same bytes, which must be removed too. - Only now remove the
trace-links, broken or outward links andspecialentries. A link that leads outside the tree is not followed: leave what it leads to with its owner and remove only the link. Name the link itself, without a trailing slash, and do not userm -ron it.
docker compose exec backend rm -- "/data/praxis/mirrors/$slug/live/project/trace/<name>"Search results are candidates
A search can match unrelated content and files that must stay as they are. Never remove everything it prints. Confirm that a file holds the credential, then act according to where it is:
| Where | What it is | What to do |
|---|---|---|
work/ | Staging for the next sync | Remove a confirmed file, then publish a clean generation |
live/ | The published, signed generation | Handle a confirmed file like a copy found in item 2, then publish a clean generation |
| A linked served tree | The same, outside the mirror directory | Change nothing by hand; see above |
snapshots/ | Signed manifests and signatures of retained runs, used by pins, exports and deltas | Do not edit or delete; restrict access and consult the maintainers |
.live.next/, .live.journal, or their equivalents beside a linked tree | A publication not yet settled | Leave it; settle it and search again |
.last-error, dnf-state/ | Diagnostics left by earlier runs, neither signed nor served | A confirmed file may be removed |
| Anywhere else, or you are unsure | Leave it and consult the maintainers |
Before publishing
Airgap export refuses every link, working or not. A mirror that you will export
also needs its link lines removed, or replaced by regular files, before it is
signed.
Run the listing again. Continue only when it exits 0, or exits 1 with nothing
left but match-other lines you have reviewed, and every tree that exists reports
trace policy: accepted. With a linked live/ it exits 2: continue only if the
live/ link is the sole thing it could not scan and work/ reports
trace policy: accepted.
If a link was removed before its target was handled, the check can no longer
find those bytes. Keep the mirror paused, compare with a copy or backup, and
review every match-other line in both trees.
5. Publish a clean generation
For a mirror that syncs from an upstream, replace the URL if it carried a credential, then enable it and sync:
curl -sS -X PATCH -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" -d '{"enabled": true}' "$BASE/mirrors/$ID"curl -sS -X POST -H "Authorization: Bearer ${TOKEN}" "$BASE/mirrors/$ID/sync"For an imported mirror, or one with no usable upstream, sign what is published instead:
curl -sS -X POST -H "Authorization: Bearer ${TOKEN}" "$BASE/mirrors/$ID/sign-current"Both requests only queue the work. List the runs as in step 1 until the new run
is ok. With a linked live/, then scan the served tree again with the command
in step 3, and require a complete scan with trace policy: accepted and no
unreviewed line. Only then export. Restore the mirror’s earlier enabled setting if
you did not already. Keep the restricted copy for as long as your rules
require, then destroy it.
How hand edits reach downloads
Praxis expects a published tree to change only when Praxis publishes it. After a
change made by hand, a requested file under project/trace/ or already known to
be reached from there is checked at once; changes at the top of the trace
directory or the tree are noticed by the next download; anything deeper can go
unnoticed for up to 30 seconds. Never add sensitive content to a published tree
by hand. Sign-current publishes the cleaned tree as a new generation.
The first download after a publication waits while the server checks the trace
directory. Files the check concerns are sent from a private temporary copy, so
the temporary directory (TMPDIR) needs room for them.
Interrupted or unconfirmed publications
A crash, a database outage or a failing directory swap can leave a publication that Praxis cannot yet judge. It then keeps both generations and the journal, and sends no success or recovery alert for a generation that is not published. The next sync or sign-current settles it first (a sync of a mirror whose URL carries a credential is refused before that; use sign-current):
| What happened | How it is settled |
|---|---|
| Interrupted while building, before any switch | The unfinished generation is discarded |
Switched, and the run is not recorded as ok | The previous generation is published again |
The run is recorded as ok | That generation is published and the previous one discarded |
Until then, expect the following:
- A run can keep showing
running, and an on-demand sync is refused while the mirror shows it too. The next scheduled sync judges it: a success that reached the database stays, otherwise the run is marked as stale. A disabled mirror is not scheduled, so enable it. For an imported mirror, request sign-current. - If the database records success but the generation cannot be published, the
run and mirror can read
okwhile hosts still receive the previous generation. A sync or sign-current started in that state is recorded as failed with the publishing message. Fix the cause shown in the backend log; the next one publishes the recorded generation and sends any recovery alert that was due. - If the backend was killed between the switch and the database record, hosts receive the complete new generation, not yet recorded, until the next sync or sign-current settles it.
- A recovery alert is delivered on a best-effort basis and can be lost if the backend stops just before sending it.
- Nothing is settled merely by restarting the backend.
When it does not clear
Database outages, a run another process still holds and a failing swap clear once their cause does. Do not remove the journal for them. Two states need you, and typically follow restoring the database or the mirror volume from copies taken at different times. Every sync and sign-current fails with the publishing message, and the backend log says one of:
the outcome of run <id> is unknown, persisting while the database is reachable and no process holds the run: the run is not in the database;cannot tell which generation of <path> is published,the generation of <path> to publish is missingor<path> cannot be understood: the journal and directories do not match.
Do not rename, move or overwrite live/, .live.next/ or anything set aside
earlier. Resolve it like this, and stop at the first step that does not succeed:
- Disable the mirror, make sure no run is
running, and take a restricted copy, including a linked served tree. Do not try to settle with sign-current again. - Verify the tree hosts are receiving. The check below follows a linked
live/, reads everything and changes nothing. A run records the regular files of a tree only, so the check cannot confirm a tree that holds a link or any other kind of entry inside it, and saysSTOPwithout comparing:
docker compose exec -T backend python - "$slug" <<'PY'import os, stat, sysfrom app.db.models import MirrorRepo, MirrorSyncRunfrom app.db.session import SessionLocalfrom app.services.mirror_manifest import build_manifest, manifest_sha256from app.services.mirror_paths import live_dirfrom app.services.mirror_trace_audit import scan_tree
def unreadable(error): raise error
slug = sys.argv[1]db = SessionLocal()mirror = db.query(MirrorRepo).filter( MirrorRepo.slug == slug, MirrorRepo.deleted_at.is_(None)).one()tree = live_dir(slug).resolve(strict=True) # live/ itself may be a linkothers = []for folder, folders, files in os.walk(tree, onerror=unreadable): for path in (os.path.join(folder, name) for name in folders + files): mode = os.lstat(path).st_mode if not (stat.S_ISDIR(mode) or stat.S_ISREG(mode)): others.append(os.path.relpath(path, tree))if others: for name in sorted(others): print("link or special entry:", repr(name)) print("STOP") sys.exit(1)report = scan_tree(tree)found = manifest_sha256(build_manifest( slug=slug, run_id=0, package_family=mirror.package_family, root=tree))runs = [run.id for run in db.query(MirrorSyncRun).filter_by( mirror_repo_id=mirror.id, status="ok", manifest_sha256=found)]good = bool(runs) and report.state == "complete" and not report.refusedprint("served tree:", tree)print("successful runs with exactly this content:", runs or "none")print("trace scan:", report.state, "refused" if report.refused else "accepted")print("VERIFIED" if good else "STOP")sys.exit(0 if good else 1)PY- Only after
VERIFIED, remove the switch record, at the path that the check in step 2 of cleaning prints afterjournal:. The next publication discards the unfinished generation, which your copy keeps. - Enable the mirror and sync, or request sign-current for a mirror that cannot
sync from an upstream, and confirm that the run is
ok.
docker compose exec backend rm -- "<journal path>"If the check says STOP or fails, or you believe the other generation is the one
that should be served, keep the mirror disabled, leave both generations and the
switch record in place, and consult the maintainers.
Leftover snapshot files
If a success is confirmed only after the operation that made it has given up, or
the backend stops right after recording it, manifest and signature files that no
run refers to stay in snapshots/. They take space and are otherwise harmless,
so leave them if in doubt.
Do not judge a file by its name. The files of an imported mirror carry the run numbers of the system that exported them, not the local ones. Only the paths stored on the runs tell whether a file is in use.
Disable the mirror and wait until no run is running. From then until you have
finished removing files, request no sync, sign-current or export, and make sure
nobody else does; disabling does not block sign-current. Take a
restricted copy, then list. The command only reads,
and lists nothing unless it can account for every file the mirror’s runs refer
to:
docker compose exec -T backend python - "$slug" <<'PY'import os, re, sysfrom app.db.models import MirrorRepo, MirrorSyncRunfrom app.db.session import SessionLocalfrom app.services.mirror_paths import live_dir, snapshots_dirfrom app.services.mirror_publication import Publication
def stop(why): sys.exit(f"STOP, nothing listed: {why}")
slug = sys.argv[1]db = SessionLocal()mirror = db.query(MirrorRepo).filter( MirrorRepo.slug == slug, MirrorRepo.deleted_at.is_(None)).first()if mirror is None: stop("no such mirror, or it was removed")if mirror.enabled: stop("disable the mirror first")if db.query(MirrorSyncRun).filter_by(mirror_repo_id=mirror.id, status="running").count(): stop("a run is still running")if Publication(live_dir(slug)).journal.exists(): stop("a publication is pending")columns = (MirrorSyncRun.manifest_path, MirrorSyncRun.manifest_signature_path)referenced = {p for row in db.query(*columns) for p in row if p}own = {p for row in db.query(*columns).filter( MirrorSyncRun.mirror_repo_id == mirror.id) for p in row if p}with os.scandir(snapshots_dir(slug)) as entries: sidecars = {e.path for e in entries if e.is_file(follow_symlinks=False) and re.fullmatch(r"[0-9]+\.manifest\.json(\.sig)?", e.name)}if not own: stop("no run of this mirror refers to a file")if own - sidecars: stop(f"a referenced file is not where expected: {min(own - sidecars)}")for path in sorted(sidecars - referenced): print(path)print(f"unreferenced: {len(sidecars - referenced)}; in use by this mirror: {len(own)}")PYReview the paths. Run the command again immediately before removing, and remove only paths it lists, one at a time:
docker compose exec backend rm -- "<listed path>"Then restore the mirror’s earlier enabled setting. If the command says STOP
for a reason you cannot clear by following it, remove nothing and consult the
maintainers.
Troubleshooting mirror runs
A failed run and its alert carry one of these messages. The tool output behind it
is in the backend log (docker compose logs backend), with URL credentials
removed.
| Message | What to do |
|---|---|
sync refused: the stored upstream URL carries credentials. Replace upstream_url with a credential-free URL, sync again, then rotate the old credential. | Move off the URL |
publish refused: the staging tree's project/trace holds an entry that names an upstream with credentials or cannot be checked. In the mirror's work directory, move aside the file it names or leads to before removing any link, then sync again. | Clean the tree. An upstream that itself publishes such an entry is refused again |
signing refused: the published tree's project/trace holds an entry that names an upstream with credentials or cannot be checked. In the mirror's live and work directories, move aside the file it names or leads to before removing any link, then sync or sign again. | Clean the tree |
sync refused: the mirror configuration is not usable by the sync tool | Check the URL, distribution, components and architectures |
free-space gate refused: not enough free space or disk budget | Free space or raise the mirror’s disk budget |
sync failed: a required mirror tool is not installed | Use the released backend image, or install the tool |
sync failed: the sync tool exceeded its time limit | Check upstream speed and mirror size, then sync again |
sync failed: the upstream download did not complete | Check that the upstream is reachable and serves a repository. Published content is unchanged |
upstream signature invalid: the repository could not be verified with the configured trust keys | Check the trust keys and the upstream’s signature. Published content is unchanged |
signing failed | Check the mirror’s signing key and the secrets service |
publishing failed: the new tree could not be published | Read the log. For a snapshot file with this run number exists and is kept, leave the file and run the sync or sign-current again, which uses a new number. Otherwise see interrupted publications |
signing refused: the published tree is empty or missing | Sync or import content first |
stale: scheduler restarted before completion | Sync again |
mirror operation failed with an internal error | Read the log |
mirror operation failed; recorded detail is not available | An error recorded before this release, or without a category. Read the log |
Related
- Airgap runbook: airgap export and import. Serviceable families: the Linux support matrix.
- Hardening guidance for offline and edge deployments: production hardening.
- Patch Workflows - mirrors/profiles decide where hosts get packages; patch policies decide how and when they’re applied.