Can't unlock a repostory

I have a problem with a large (~60TB) restic repository on backblaze. “restic check” showed lots of errors regarding blobs not found in index. I followed Corrupted Repositories & Can't Recover · Issue #2146 · restic/restic · GitHub and ran “restic find blob” for one of the missing blobs.

After 21 hours, it found one snapshot that the blob was in, so rather than waiting an indeterminate amount of time, I terminated the “find blobs”, unlocked the repository and (hoping it was just that single snapshot that was corrupt), tried to forget the failing snapshot.

The repository was still locked! I repeatedly tried “unlock”, which was reported as successful, but each time I tried a “forget”, was told that the repository was locked.

restic --no-cache -r b2:myrepo unlock

repository 4379d5c1 opened successfully, password is correct
successfully removed locks

restic --no-cache -r b2:myrepo forget 4e8ae755
repository 4379d5c1 opened successfully, password is correct
unable to create lock in backend: repository is already locked by PID 32613 on by root (UID 0, GID 0)
lock was created at 2021-02-04 09:15:06 (1m0.506678001s ago)
storage ID 18cbdf66
the unlock command can be used to remove stale locks

I have tried this repeatedly with restic 0.11.0 and 0.9.5


Actually, I have found the answer. I terminate the “find blobs” with a CTRL-C, but somehow, this just seems to have backgrounded the process. I guess that either …

  1. “unlock” deleted the lock, and the backgrounded “find blobs” immediately restored it,


  1. “unlock” was lying about removing the locks.

I note that for other unused repositories, “restic unlock” always returns “successfully removed locks”, even when done repeatedly.

Is there a command to test if a repo is locked?

Anyway, you can close this issue. Thanks for a great product!

restic unlock only removes stale locks. AFAIK it might take up to 30min for a lock to be considered stale.

restic --no-lock list locks