Fixing Broken Restic Backups: Repository Locks, Prune Errors, Corruption Checks, and Failed Docker Backups
Restic is one of the most reliable backup tools for self-hosted infrastructure, but even reliable tools fail under real-world conditions, killing containers, full disks, and network drops mid-prune. This restic troubleshooting guide walks through the exact failure patterns you’ll hit in production and the safe order to fix them.
Table of Contents
Why Restic Fails in Production
Most restic errors aren’t random; they follow predictable patterns tied to interrupted processes, storage limits, or concurrent access. Understanding these root causes is the foundation of any useful restic troubleshooting guide, because guessing at fixes without knowing the cause can make corruption worse.
The four failure categories covered in this restic troubleshooting guide are:
- Repository locks left behind by crashed or killed backup jobs.
- Prune operations that stall or fail from insufficient scratch space.
- Index and pack corruption from hardware issues or interrupted transfers.
- Incomplete or missing snapshots caused by broken Docker volume backups.
If you’re running these jobs on a server with tight disk space or no reliable console access, half of these problems become harder to diagnose. Keeping backups healthy really depends on running restic on a Linux VPS with enough storage and root access to repair issues safely.
Fix Restic Repository Locks
A locked repository is the most common issue this restic troubleshooting guide addresses, and it’s usually caused by a killed backup or a scheduler that fired twice. Restic stores its lock state as files inside a locks/ directory in the repo itself, not on the client machine, which is why unlocking is safe once you confirm no process is actually running.
Before removing any lock, verify nothing is actively backing up:
ps aux | grep restic
docker ps | grep restic
docker exec <container> ps aux | grep restic
If nothing is running, clear the stale lock:
restic -r /path/to/repo unlock
If a normal unlock fails, force it, but only when you are certain no other process touches the repo:
restic -r /path/to/repo unlock --remove-all
For scheduled jobs that might overlap, restic 0.16+ supports waiting instead of failing outright:
restic backup /data --retry-lock 2h
In Docker environments, a container killed mid-backup is the top cause of orphaned locks. Give the stop signal enough grace time before the scheduler force-kills it:
services:
restic:
image: restic/restic:0.18.1
stop_grace_period: 30m
This is the part of a restic troubleshooting guide most people skip: adding a pre-backup unlock as a safety net, since running unlock before every job only clears dead locks and never touches an active one.
Resolve Restic Prune Failures
Prune is a two-step process, forget removes snapshot references, then prune deletes the actual unreferenced data, and it locks the repository the entire time it runs, so failed prunes often masquerade as “stuck” repos.
If prune fails midway, the repository still works, but how you fix it depends on why it stopped.
For repos that fill available disk space mid-prune, restic provides options built specifically for this restic troubleshooting guide scenario:
restic -r /path/to/repo prune --max-repack-size 0
This forces prune to use minimal scratch space. If that alone doesn’t free enough space, remove more old snapshots first, then prune again:
restic forget --keep-daily 7 --keep-weekly 4 --prune
If prune still won’t finish because there’s zero free space left, restic offers a specific “unsafe recovery” flag as a last resort:
restic prune --unsafe-recover-no-free-space SOME-ID
Run this only if you have a stable connection to storage, because an interrupted run in this mode can leave the repo temporarily unusable. If it fails, you may need to manually clear the index/ folder and run restic repair index afterward.
No Free Space and Prune Deadlocks in Restic
Low disk space causes most of the prune failures in this restic troubleshooting guide, and it gets worse fast on VPS instances with small root partitions. Restic keeps the repository consistent even if prune gets interrupted, but it still needs some scratch space to repack partially-used data blocks.
The practical order to recover is:
- Free up space externally if possible, move old snapshots off, and expand the volume.
- Run
forgetwith a small retention policy to remove more snapshots first. - Retry
prune --max-repack-size 0to minimize repacking overhead. - Only use
--unsafe-recover-no-free-spaceif steps 1 to 3 fail.
This headroom problem usually comes from undersized hosting. A PerLod Linux VPS with enough space for logs, reverse proxying, and security tooling keeps backup jobs from competing with live traffic for disk.
Diagnose Restic Repository Corruption
Corruption checks are the diagnostic backbone of this restic troubleshooting guide, and restic’s check command is the starting point for every real repair.
Run a light check regularly and a full data check periodically:
restic check
restic check --read-data
The --read-data flag downloads and checks every pack file. It’s complete but costly on remote or cloud storage, so save it for weekly or monthly runs. If check reports “ciphertext verification failed,” that points to a hardware problem, not a restic bug; check your disk or network instead.
When check finds problems, restic’s repair sequence must be followed in this exact order:
- Back up the
indexandsnapshotsfolders before touching anything. - Disable all
forget/prunejobs temporarily so nothing deletes data mid-repair. - Repair the index first; everything else depends on it:
restic repair index. - If
checkflagged damaged snapshot files, remove them:restic repair snapshots --forget snapshot-id. - Re-run your normal backups; new snapshots can sometimes automatically heal older damaged data.
- If data is still missing, strip inaccessible content from snapshots:
restic repair snapshots --forget. - Run
restic check --read-dataagain to confirm a clean result.
Order matters here; users repeatedly report that running prune or forget before rebuilding the index causes more “not referenced in any index” errors, not fewer.
Restic Failed Docker Backups and Volume Paths
For Docker-hosted apps, treat container lifecycle as unpredictable, not fixed. Restic doesn’t know a container got killed; it just sees an incomplete lock or snapshot.
The two most common failure modes are containers stopped before the backup command finishes and bind-mounted volume paths that shift between runs.
For consistent Docker volume backups, mount the same host path or named volume every run so restic’s deduplication and snapshot history stay accurate:
docker run --rm \
-v myapp_data:/data:ro \
-v /restic-repo:/repo \
restic/restic -r /repo backup /data
If your workflow already ships volumes to object storage, this guide on backing up Docker volumes to S3 or MinIO covers the bucket and credential side that pairs with the recovery steps in this guide.
For restic-specific remote repositories on a dedicated backup host, this guide on restic backup to a storage VPS shows the repository setup that this restic troubleshooting guide assumes you already have.
Verifying Restic Snapshots After Repair
The final check in any restic troubleshooting guide is confirming that the repaired snapshots actually restore correctly, not just that the check reports clean. Test restore at least one recent snapshot to a scratch directory after any repair:
restic restore latest --target /tmp/restore-test
diff -r /tmp/restore-test /original/data
If you sync repository copies to a secondary VPS for redundancy, the rclone sync method described in rclone sync to a storage VPS is a solid option; it keeps an independent copy, so a corrupted primary repo doesn’t leave you without any recovery path.
Conclusion
Most restic problems follow the same fix: check nothing’s running, repair the index first, then confirm with a real restore test. Keep this restic troubleshooting guide as a checklist, since these few steps cover almost every failure you’ll face.
If backups keep failing from low disk space or slow performance, the host itself may be the real problem. For heavier backup loads or multiple Docker stacks, a high-performance dedicated server gives you the extra I/O and memory that a shared VPS can’t.
We hope you enjoy this restic troubleshooting guide.
For more detailed information, check the official restic troubleshooting docs.
FAQs
Is it safe to run restic unlock anytime?
Yes, as long as no restic process is actively running against that repo. It only clears deadlocks.
Why does restic prune fail with no free space?
Prune needs some free space to repack data, even while it’s deleting old blobs. A full disk stops this process cold.
Can Docker container restarts corrupt my restic repository?
Not directly, but killing a container mid-backup can leave a stale lock or an incomplete snapshot.