Mon 30 Sep 13:02:27 SAST 2019 Starting backup
Killed stale lock [email protected].
Removed stale exclusive roster lock for host hornswaggle@36074249074878 pid 3247 thread 0.
Removed stale exclusive roster lock for host hornswaggle@36074249074878 pid 3247 thread 0.
Creating archive at "ssh://[email protected]/media/nas/backups/hornswaggle::hornswaggle-2019-09-30T13:02:28"
Local Exception
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4501, in main
exit_code = archiver.run(args)
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4433, in run
return set_ec(func(args))
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 166, in wrapper
return method(self, args, repository=repository, **kwargs)
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 566, in do_create
cache_mode=args.files_cache_mode, ignore_inode=args.ignore_inode) as cache:
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 379, in __new__
return local()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 373, in local
lock_wait=lock_wait, cache_mode=cache_mode)
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 456, in __init__
self.open()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 504, in open
self.rollback()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 609, in rollback
self._do_open()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 494, in _do_open
self.chunks = ChunkIndex.read(fd)
File "src/borg/hashindex.pyx", line 113, in borg.hashindex.IndexBase.read
File "src/borg/hashindex.pyx", line 100, in borg.hashindex.IndexBase.__cinit__
ValueError: Incorrect file length (expected 19608574, got 4063232)
Platform: Linux hornswaggle 4.19.69-1-MANJARO #1 SMP PREEMPT Thu Aug 29 08:51:46 UTC 2019 x86_64
Linux: arch Manjaro Linux
Borg: 1.1.10 Python: CPython 3.7.4 msgpack: 0.5.6
PID: 3477 CWD: /home/daniel/bin
sys.argv: ['/usr/bin/borg', 'create', '--verbose', '--filter', 'AME', '--list', '--stats', '--show-rc', '--compression', 'zstd', '--exclude-if-present', '.noborgbackup', '--exclude-caches', '--exclude', '/home/*/.cache/*', '--exclude', '/var/cache/*', '--exclude', '/var/tmp/*', '::{hostname}-{now}', '/etc', '/home', '/root', '/var']
SSH_ORIGINAL_COMMAND: None
terminating with error status, rc 2
Mon 30 Sep 13:02:35 SAST 2019 Pruning repository
Killed stale lock [email protected].
Removed stale exclusive roster lock for host hornswaggle@36074249074878 pid 3477 thread 0.
Removed stale exclusive roster lock for host hornswaggle@36074249074878 pid 3477 thread 0.
Local Exception
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4501, in main
exit_code = archiver.run(args)
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4433, in run
return set_ec(func(args))
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 166, in wrapper
return method(self, args, repository=repository, **kwargs)
File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 1591, in do_prune
with Cache(repository, key, manifest, lock_wait=self.lock_wait) as cache:
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 379, in __new__
return local()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 373, in local
lock_wait=lock_wait, cache_mode=cache_mode)
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 456, in __init__
self.open()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 504, in open
self.rollback()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 609, in rollback
self._do_open()
File "/usr/lib/python3.7/site-packages/borg/cache.py", line 494, in _do_open
self.chunks = ChunkIndex.read(fd)
File "src/borg/hashindex.pyx", line 113, in borg.hashindex.IndexBase.read
File "src/borg/hashindex.pyx", line 100, in borg.hashindex.IndexBase.__cinit__
ValueError: Incorrect file length (expected 19608574, got 4063232)
Platform: Linux hornswaggle 4.19.69-1-MANJARO #1 SMP PREEMPT Thu Aug 29 08:51:46 UTC 2019 x86_64
Linux: arch Manjaro Linux
Borg: 1.1.10 Python: CPython 3.7.4 msgpack: 0.5.6
PID: 3485 CWD: /home/daniel/bin
sys.argv: ['/usr/bin/borg', 'prune', '--list', '--prefix', '{hostname}-', '--show-rc', '--keep-hourly', '4', '--keep-daily', '7', '--keep-weekly', '4', '--keep-monthly', '6']
SSH_ORIGINAL_COMMAND: None
terminating with error status, rc 2
Mon 30 Sep 13:02:41 SAST 2019 Backup and/or Prune finished with an error
Yes
ISSUE
Client: Platform: Linux hornswaggle 4.19.69-1-MANJARO #1 SMP PREEMPT Thu Aug 29 08:51:46 UTC 2019 x86_64
Linux: arch Manjaro Linux
Borg: 1.1.10 Python: CPython 3.7.4 msgpack: 0.5.6
Server: Linux Debian Borg 1.1.10
Ext4
2TB
#!/bin/sh
#todo - set USERNAME variable for error messages
BORGUSER="daniel"
# Setting this, so the repo does not need to be given on the commandline:
export BORG_REPO=ssh://[email protected]/media/nas/backups/$HOSTNAME
# Setting this, so you won't be asked for your repository passphrase:
export BORG_PASSPHRASE='XXXXXXXXXXXXXXX'
# or this to ask an external program to supply the passphrase:
#export BORG_PASSCOMMAND='pass show backup'
# some helpers and error handling:
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
info "Starting backup"
sudo -u $BORGUSER DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send 'Backup started!' \
'The Borg has started a backup of your computer.' --icon=dialog-information -t 14400000
# Backup the most important directories into an archive named after
# the machine this script is currently running on:
borg create \
--verbose \
--filter AME \
--list \
--stats \
--show-rc \
--compression zstd \
--exclude-if-present .noborgbackup \
--exclude-caches \
--exclude '/home/*/.cache/*' \
--exclude '/var/cache/*' \
--exclude '/var/tmp/*' \
::'{hostname}-{now}' \
/etc \
/home \
/root \
/var \
backup_exit=$?
info "Pruning repository"
# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
# archives of THIS machine. The '{hostname}-' prefix is very important to
# limit prune's operation to this machine's archives and not apply to
# other machines' archives also:
borg prune \
--list \
--prefix '{hostname}-' \
--show-rc \
--keep-hourly 4 \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 6 \
prune_exit=$?
# use highest exit code as global exit code
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
if [ ${global_exit} -eq 1 ];
then
info "Backup and/or Prune finished with a warning"
sudo -u $BORGUSER DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send 'BACKUP WARNING' 'The Borg has completed a backup with a warning.' --icon=dialog-warning -t 14400000
fi
if [ ${global_exit} -gt 1 ];
then
info "Backup and/or Prune finished with an error"
sudo -u $BORGUSER DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send 'BACKUP ERROR' 'The Borg has completed a backup with an error.' --icon=dialog-error -t 14400000
fi
if [ ${global_exit} -eq 0 ];
then
sudo -u $BORGUSER DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send 'Backup Successful' 'The Borg has completed a backup successfully.' --icon=dialog-information -t 14400000
fi
exit ${global_exit}
Well, it looks like you had a crash before (that is why a stale lock existed at the time you ran the command you posted above).
Could be that this crash damaged / truncated the chunks file (see ~/.cache/borg/<REPOID>/chunks).
Either remove it manually or delete the whole cache via borg delete --cache-only REPO (the latter will also delete all files in chunks.archive.d/, so it might take longer to re-sync the chunks cache at the next run).
You guys rock. Thanks @ThomasWaldmann
Most helpful comment
Well, it looks like you had a crash before (that is why a stale lock existed at the time you ran the command you posted above).
Could be that this crash damaged / truncated the
chunksfile (see~/.cache/borg/<REPOID>/chunks).Either remove it manually or delete the whole cache via
borg delete --cache-only REPO(the latter will also delete all files inchunks.archive.d/, so it might take longer to re-sync the chunks cache at the next run).