Backup Failures in Nextcloud AIO After Two Weeks (Using External Drive)

I’ve been experiencing recurring issues with my Nextcloud AIO backups. My setup involves using an external drive mounted at /mnt/backup on Linux Mint. Everything works fine initially, but after about two weeks, the backups start failing.

I suspect the issue lies with the OS unmounting the external drive after some time, which causes the backup service to fail. However, even after remounting the drive and attempting to restart the backup service, it still doesn’t work. The backup log provides the following error(s):

> 2024-12-30T19:51:13.057521256Z Failed to create/acquire the lock /mnt/borgbackup/borg/lock.exclusive ([Errno 5] I/O error: '/mnt/borgbackup/borg/lock.exclusive.delo_eji.tmp').
> 2024-12-30T19:51:13.057581492Z Traceback (most recent call last):
> 2024-12-30T19:51:13.057586579Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5401, in main
> 2024-12-30T19:51:13.057590389Z     exit_code = archiver.run(args)
> 2024-12-30T19:51:13.057593577Z                 ^^^^^^^^^^^^^^^^^^
> 2024-12-30T19:51:13.057596597Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5321, in run
> 2024-12-30T19:51:13.057599801Z     return set_ec(func(args))
> 2024-12-30T19:51:13.057602907Z                   ^^^^^^^^^^
> 2024-12-30T19:51:13.057605928Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 175, in wrapper
> 2024-12-30T19:51:13.057609083Z     with repository:
> 2024-12-30T19:51:13.057611978Z          ^^^^^^^^^^
> 2024-12-30T19:51:13.057614947Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 203, in __enter__
> 2024-12-30T19:51:13.057618182Z     self.open(self.path, bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock)
> 2024-12-30T19:51:13.057621454Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 435, in open
> 2024-12-30T19:51:13.057624658Z     self.lock = Lock(os.path.join(path, 'lock'), exclusive, timeout=lock_wait).acquire()
> 2024-12-30T19:51:13.057627861Z                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2024-12-30T19:51:13.057631054Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 392, in acquire
> 2024-12-30T19:51:13.057634303Z     with self._lock:
> 2024-12-30T19:51:13.057637305Z          ^^^^^^^^^^
> 2024-12-30T19:51:13.057640328Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 115, in __enter__
> 2024-12-30T19:51:13.057643556Z     return self.acquire()
> 2024-12-30T19:51:13.057646628Z            ^^^^^^^^^^^^^^
> 2024-12-30T19:51:13.057649647Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 137, in acquire
> 2024-12-30T19:51:13.057652872Z     raise LockFailed(self.path, str(err)) from None
> 2024-12-30T19:51:13.057656101Z borg.locking.LockFailed: Failed to create/acquire the lock /mnt/borgbackup/borg/lock.exclusive ([Errno 5] I/O error: '/mnt/borgbackup/borg/lock.exclusive.delo_eji.tmp').
> 2024-12-30T19:51:13.057659590Z 
> 2024-12-30T19:51:13.057662606Z Platform: Linux d2e4507a0d64 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
> 2024-12-30T19:51:13.057665902Z Linux: Unknown Linux  
> 2024-12-30T19:51:13.057668924Z Borg: 1.2.8  Python: CPython 3.12.8 msgpack: 1.0.8 fuse: llfuse 1.5.0 [pyfuse3,llfuse]
> 2024-12-30T19:51:13.057672181Z PID: 34  CWD: /
> 2024-12-30T19:51:13.057675249Z sys.argv: ['/usr/bin/borg', 'info']
> 2024-12-30T19:51:13.057678386Z SSH_ORIGINAL_COMMAND: None
> 2024-12-30T19:51:13.057686540Z 
> 2024-12-30T19:51:13.084431940Z Borg could not get info from the targeted directory.
> 2024-12-30T19:51:13.084459282Z This might happen if the targeted directory is located on an external drive and the drive not connected anymore. You should check this.
> 2024-12-30T19:51:13.084461341Z If you instead want to initialize a new backup repository, you may delete the 'borg.config' file that is stored in the mastercontainer volume manually, which will allow you to initialize a new borg repository in the chosen directory:
> 2024-12-30T19:51:13.084463729Z sudo docker exec nextcloud-aio-mastercontainer rm /mnt/docker-aio-config/data/borg.config

If anyone has encountered similar issues or has suggestions for troubleshooting, I’d greatly appreciate your input!

It sounds like a filesystem issue.

You may want to attempt running fsck against the mount/device (while unmounted ideally).

1 Like

fsck gives me this:

fsck from util-linux 2.37.2
exfatprogs version : 1.1.3
ERROR: /borg/lock.roster: first cluster is wrong. Truncate (y/N)? n
/dev/sdb1: checking stopped. directories 8, files 2
/dev/sdb1: files corrupted 1, files fixed 0

So I guess I should delete the lock file?

So I guess I should delete the lock file?

Yes. Personally I’d probably let the fsck attempt to fix the file then, yeah, probably delete the lock.

P.S. Are you deliberately using an exFAT based filesystem for any particular reason?

So I deleted the lock.roster file and then attempted to run ‘Create Backup’ followed by ‘Check backup integrity.’ The integrity check log is as follows:

2025-01-01T14:06:15.094755616Z Failed to create/acquire the lock /mnt/borgbackup/borg/lock.exclusive ([Errno 5] I/O error: '/mnt/borgbackup/borg/lock.exclusive.iqfp615h.tmp').
2025-01-01T14:06:15.094813993Z Traceback (most recent call last):
2025-01-01T14:06:15.094818957Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5401, in main
2025-01-01T14:06:15.094822616Z     exit_code = archiver.run(args)
2025-01-01T14:06:15.094825386Z                 ^^^^^^^^^^^^^^^^^^
2025-01-01T14:06:15.094827929Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5321, in run
2025-01-01T14:06:15.094830662Z     return set_ec(func(args))
2025-01-01T14:06:15.094833301Z                   ^^^^^^^^^^
2025-01-01T14:06:15.094835820Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 175, in wrapper
2025-01-01T14:06:15.094838603Z     with repository:
2025-01-01T14:06:15.094841023Z          ^^^^^^^^^^
2025-01-01T14:06:15.094843492Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 203, in __enter__
2025-01-01T14:06:15.094846203Z     self.open(self.path, bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock)
2025-01-01T14:06:15.094848861Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 435, in open
2025-01-01T14:06:15.094851635Z     self.lock = Lock(os.path.join(path, 'lock'), exclusive, timeout=lock_wait).acquire()
2025-01-01T14:06:15.094854253Z                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-01T14:06:15.094856831Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 392, in acquire
2025-01-01T14:06:15.094859498Z     with self._lock:
2025-01-01T14:06:15.094861950Z          ^^^^^^^^^^
2025-01-01T14:06:15.094864395Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 115, in __enter__
2025-01-01T14:06:15.094867012Z     return self.acquire()
2025-01-01T14:06:15.094869470Z            ^^^^^^^^^^^^^^
2025-01-01T14:06:15.094871892Z   File "/usr/lib/python3.12/site-packages/borg/locking.py", line 137, in acquire
2025-01-01T14:06:15.094874729Z     raise LockFailed(self.path, str(err)) from None
2025-01-01T14:06:15.094877342Z borg.locking.LockFailed: Failed to create/acquire the lock /mnt/borgbackup/borg/lock.exclusive ([Errno 5] I/O error: '/mnt/borgbackup/borg/lock.exclusive.iqfp615h.tmp').
2025-01-01T14:06:15.094880197Z 
2025-01-01T14:06:15.094882746Z Platform: Linux 73cc7c992c87 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
2025-01-01T14:06:15.094885450Z Linux: Unknown Linux  
2025-01-01T14:06:15.094887890Z Borg: 1.2.8  Python: CPython 3.12.8 msgpack: 1.0.8 fuse: llfuse 1.5.0 [pyfuse3,llfuse]
2025-01-01T14:06:15.094890554Z PID: 25  CWD: /
2025-01-01T14:06:15.094893048Z sys.argv: ['/usr/bin/borg', 'info']
2025-01-01T14:06:15.094895575Z SSH_ORIGINAL_COMMAND: None
2025-01-01T14:06:15.094903162Z 
2025-01-01T14:06:15.119249851Z The repository is uninitialized. Cannot perform check or restore.

What puzzled me even more was that, after performing the steps I mentioned earlier, the drive now appears to be mounted twice. The output of df -h is as follows:

/dev/sdb1       477G   73G  405G  16% /mnt/backup
/dev/sda1       477G   73G  405G  16% /media/closet-calculator1/Backupberry

Regarding the filesystem: It’s an old drive, and I honestly can’t recall if I intentionally chose exFAT. Would ext4 make more sense?