Backup failed with very old lock

Hi there,

I have been using restic_0.9.6_linux_amd64 to backup my system to Backblaze every night for many months now without issue. However last night I got the following error:

Fatal: unable to create lock in backend: repository is already locked by PID 6694 on admin by admin_user (UID 1000, GID 1000)
lock was created at 2020-04-20 16:59:47 (892h6m0.943953987s ago)
storage ID 9c2d0aa5

It seems odd that the lock was created over a month ago. Can anyone explain why this happened?
My backups usually take less than a minute (not much changes on my system from day-to-day), so the backup from the night before was definitely not running and there is no process ID 6694.


John Isles

Backup doesn’t take an exclusive lock anyway, so two backups can run concurrently. If backup is complaining about a lock then it’s an exclusive lock, which is only taken by some commands.

I’m not sure why a lock would have suddenly appeared. Did you do any other maintenance on your repository within the last day, perhaps from a computer whose clock might not have been set correctly? Are you sure that the backups from previous days actually did run successfully?

Hi there,

Hi cdhowie, thanks for your reply.
I think I have found my problem. I run restic from a shell script which occasionally runs a “restic check”.
It is this command that is actually generating the error message.
There was an exclusive lock in the repo which did not affect the nightly backup, but did affect the check which runs very occasionally. I have removed the lock and the check now runs without error.

Thanks for you help. The reference to the table of locks and your explanation gave me the “ahha” moment.


1 Like

Point of clarification: this would be a shared lock. That would block the check but would not block backups.

Glad you found the issue!

Thanks for your help cdhowie.
And thanks for a great backup program.
Just for your interest on users of restic, I am currently backing up about 45TB of data.

Most of the credit goes to @fd0. Restic is his brainchild. I’ve submitted some patches here and there but that’s it.

That’s really awesome to hear! We’re always happy to hear that restic is doing its job protecting data.

1 Like