borg failed to create/acquire the lock.exclusive

Viewed 958

When running a backup script through a scheduled Jenkins job on many servers, I receive the following error on borg create command:

Failed to create/acquire the lock /path/to/repo/lock.exclusive (timeout).
terminating with error status, rc 2

OS : Ubuntu 18.04 Bionic and Ubuntu 20.04 Focal Borg version: 1.1.15 PS: I had tried some solution like borg break-lock, and upgrade the borg version to the latest 1.1.17 and same problem

Update:

Fixed adding --max-lock-wait 3600 to borg create command to increase lock-wait timeout by default it is 2 seconds, Thanks to ThomasWaldmann from BorgBackup community. https://github.com/borgbackup/borg/issues/6047#issuecomment-967092381

1 Answers

I had the same problem in Borg 1.20. My search led to a few suggestions, including:

  • Delete <BackupDir>/lock.roster (see ITGrenade)
  • If it doesn't work to make sure there are no other backups running, and then use borg break-lock as described in the manual, check ps aux or just restart to ensure borg is not still running (see SolvedTips)

I had success with a variation on the latter: unmount the Borg drive, delete the mount point, make sure nothing else is running that might lock the drive, and then recreate the mount point and restart the Borg process.

Related