Repository navigation
fix: stage Rustic CA bundle in a volume instead of copying into the container - #4875
Open
neurekadev wants to merge 1 commit into
Open
neurekadev wants to merge 1 commit into
neurekadev wants to merge 1 commit into
Conversation
…ontainer Copying the bundle into the stopped Rustic container makes the daemon create every mount target first. System backups mount the database copies as files under the read-only /data mount, so that fails with "openat data/arcane.db: read-only file system". Stage the bundle in a volume through a stager that mounts only that volume, and remove the stager after Rustic exits, retrying, so ZFS no longer fails with a busy dataset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
🔍 Code ReviewPR #4875 · 🤖 Claude Opus 5.5 (High) · T3 Code (Claude Code) · Round 1 of 3 |
Member
|
Does this spin up two containers just to copy the CA Certs? Im not sure im a fan of that as a "workaround" per se. |
2 of 11 tasks
Contributor
Author
|
Yeah, it does: a short-lived stager container (created, never started) plus a temp volume per Rustic run, just to get the bundle in. Fair point that it's heavy for one file. The real bug is Docker's:
I'd lean towards 2, but happy to do 1 if you'd rather not carry a workaround for an old Docker bug. Which do you prefer? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
mainbranchm.*()) (no new strings)What This PR Implements
Fixes: #4870 (regression of #4616)
Since #4797, system backups fail on Docker Engine before 29.9.0 with:
CopyToContaineron a stopped container makes the daemon replay every mount and callcreateIfNotExistson each mount target, which opens the target withO_CREATE|O_WRONLY. The system backup container mounts theVACUUM INTOdatabase copies as files under the read-only/datamount, so that open fails withEROFS. moby fixed this in 29.9.0 (moby/moby#53716, backported in moby/moby#53724), but older engines still fail.This brings back #4621's approach: a stager container that mounts only a fresh volume receives the bundle, and that volume is mounted read-only at
/etc/ssl/certs. #4780 (ZFS) failed because the stager was removed right after the copy ("dataset is busy"). Now the stager is removed only after Rustic exits, with retries, and a failed removal is logged instead of failing the backup.Changes Made
pkg/rustic/trust.go:stageTrustBundlecreates the volume and stager, copies the bundle, and returns a cleanup function that removes the stager (retrying) and then the volume.pkg/rustic/run.go: mounts the staged volume read-only and defers cleanup so it runs after the Rustic container is removed. Removes theCopyToContainerinto the Rustic container.Testing Done
just format go,just lint backend(0 issues),go build -tags exclude_frontend ./...,go test ./internal/backup/....docker:29.6.0-dindwith the same mount layout (read-only volume at/data, read-only volume-subpath file at/data/arcane.db).docker cpinto that container fails with the exact error above.docker cpinto a stager that mounts only the trust volume succeeds, a container with the layout plus the read-only trust volume reads both the bundle and the file, and removing the stager afterwards succeeds. The samedocker cpsucceeds on 29.10.0.AI Tool Used (if applicable)
Claude Code (Claude Opus 5.5) investigated this, wrote the code and drafted this description, at my direction.
Additional Context
Docker Engine 29.9.0 and later avoid the error without this change. That's a workaround for affected users until this lands.
🤖 Generated with Claude Code
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.

Confidence Score: 5/5
No code issues were found that block merging; the author’s planned human testing remains pending.Summary
This PR stages Rustic’s CA certificates in a temporary Docker volume instead of copying them into the backup container.
No actionable issues found. neurekadev explicitly notes that end-to-end and ZFS human testing remain pending and keeps the PR in draft for that reason. No tests were run during this review.
Reviews (1) · Last reviewed commit: "fix: stage Rustic CA bundle in a volume ..." · Reviewed by Greptile