g3492 / vzborg

Simple deduplicated encrypted backups for Proxmox
GNU Affero General Public License v3.0
55 stars 15 forks source link

Failed to initialized a new borg repository on first use if folder already exist; doesn't clean vzdump .log files in tmp directory #1

Closed johnr14 closed 3 years ago

johnr14 commented 3 years ago
# vzborg backup -i 106
vzborg: > Host i8100 - Backup job started for guests 106.
vzborg: > Repository /RaidZ4x3/Borgbackup/vzBorg/.
vzborg: -> Beginning backup of CT 106 (syncthing)
Exception ignored in: <function Repository.__del__ at 0x7f21b4346d90>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 179, in __del__
    assert False, "cleanup happened in Repository.__del__"
AssertionError: cleanup happened in Repository.__del__
Local Exception
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4455, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4387, in run
    return set_ec(func(args))
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 139, in wrapper
    with repository:
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 189, in __enter__
    self.open(self.path, bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 396, in open
    with open(os.path.join(self.path, 'config')) as fd:
FileNotFoundError: [Errno 2] No such file or directory: '/RaidZ4x3/Borgbackup/vzBorg/config'

Platform: Linux i8100 5.4.78-2-pve #1 SMP PVE 5.4.78-2 (Thu, 03 Dec 2020 14:26:17 +0100) x86_64
Linux: debian 10.7 
Borg: 1.1.9  Python: CPython 3.7.3
PID: 14712  CWD: /nvmez/backup/dump/tmp
sys.argv: ['/usr/bin/borg', 'create', '--chunker-params', '9,16,12,4095', '-s', '--compression=zstd,8', '--comment=([vm_type]=CT [vm_id]=106 [vm_hostname]=syncthing)\nBEGIN_CONFIG>\narch: amd64\ncores: 4\nhostname: syncthing\nmemory: 512\nnet0: name=eth0,bridge=vmbr20,firewall=1,hwaddr=BA:71:24:A0:65:90,ip=dhcp,type=veth\nonboot: 1\nostype: fedora\nrootfs: local-raidz:basevol-105-disk-0/subvol-106-disk-0,size=48G\nswap: 512\nunprivileged: 1\n<END_CONFIG', '/RaidZ4x3/Borgbackup/vzBorg/::vzborg-106-2021_02_14-16_17_33.tar', '-']
SSH_ORIGINAL_COMMAND: None

INFO: starting new backup job: vzdump 106 --dumpdir /nvmez/backup/dump/tmp --quiet 0 --compress 0 --mode snapshot
INFO: filesystem type on dumpdir is 'zfs' -using /var/tmp/vzdumptmp14715_106 for temporary files
INFO: Starting Backup of VM 106 (lxc)
INFO: Backup started at 2021-02-14 16:17:33
INFO: status = running
INFO: CT Name: syncthing
INFO: including mount point rootfs ('/') in backup
INFO: backup mode: snapshot
INFO: ionice priority: 7
INFO: create storage snapshot 'vzdump'
INFO: sending archive to stdout
INFO: cleanup temporary 'vzdump' snapshot
INFO: Finished Backup of VM 106 (00:00:01)
INFO: Backup finished at 2021-02-14 16:17:34
INFO: Backup job finished successfully
vzborg: <- Finished backup of CT 106 (syncthing).
vzborg: < Host i8100 - backup job complete!

VZBORG SUMMARY

TY   VMID  BCK.TIME  BACKUP  PUR.TIME   PURGE  NAME                                      
CT    106  00:00:01  failed  00:00:00      no  syncthing   

But once I initialized the repository, it works.

borg init --encryption=repokey-blake2 /RaidZ4x3/Borgbackup/vzBorg/

I had created the directory that is pointed by the config file before first run.

So I think a check must be done to assure there is a config file in that directory before proceeding by changin line 195 for an additionnal file check.

Also it means that if you try to list a uninitialized directory, borg crash.It seems vzborg doesn't clean .logs in tempory directory.

I just started using vzborg and it seems to fit my need. Thanks for your work. Not to sync to backblaze, trying rclone. Other options are s3ql and b2.