Commands not accepted because of existing lock


I can’t run any commands because the repo is already locked. But even after running the unlock command, the lock still seems to be there.

Can you help me ? Here is the commands I am playing :

vagrant@homestead:~/restic-ik$ ./restic unlock
repository 1dce2ff8 opened (version 2, compression level auto)

vagrant@homestead:~/restic-ik$ ./restic forget --tag TAG_A --tag TAG_B --keep-last 360 --dry-run
repository 1dce2ff8 opened (version 2, compression level auto)
repo already locked, waiting up to 0s for the lock
unable to create lock in backend: repository is already locked by PID 59001 on homestead by vagrant (UID 1000, GID 1000)
lock was created at 2023-12-27 13:54:13 (2m45.906250677s ago)
storage ID 7bed3f7b
the unlock command can be used to remove stale locks

unlock only removes stale locks. If restic thinks (or knows) the lock is fresh, it will not remove it. restic list locks will give a list. If you are absolutely sure that PID 59001 is no longer active then you can delete the listed lock file in the repo\locks directory. Note that if the lock is fresh, and is a sign of a process using the repository, you could damage the repository by removing a lock and making changes to a repository.

Thank you for your reply. I discovered that a lock was being refreshed every 5 minutes from my development machine. I cancelled a “check” command the day before, and I think it might have been due to this action. Also, I was in version 0.14. After updating to version 0.16.2 and restarting the virtual machine, the lock was in a “stale” state and can be removed.

1 Like