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.
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 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.