tasket / wyng-backup

Fast backups for logical volumes & disk images
GNU General Public License v3.0
251 stars 16 forks source link

Error when using Wyng with rclone #175

Closed ldeso closed 6 months ago

ldeso commented 1 year ago

In Qubes OS, the command wyng send --all fails with "CalledProcessError" if the destination is a remote filesystem mounted with rclone:

Traceback (most recent call last):rivate.img
  File "/usr/local/bin/wyng", line 4644, in <module>
    monitor_send(storage, aset, selected_vols, monitor_only=False)
  File "/usr/local/bin/wyng", line 3446, in monitor_send
    send_volume(storage, vol, curtime, ses_tags, send_all=datavol in send_alls)
  File "/usr/local/bin/wyng", line 3239, in send_volume
    dest.run([ dest.cd
  File "/usr/local/bin/wyng", line 2132, in run
    return do_exec([cmd], infile=infile, inlines=inlines, out=out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/wyng", line 2491, in do_exec
    return close()[-1]
           ^^^^^^^
  File "/usr/local/bin/wyng", line 2480, in close
    raise SPr.CalledProcessError([x for x in rclist if x][0], commands)
subprocess.CalledProcessError: Command '[['/usr/bin/qvm-run', '--no-color-stderr', '--no-color-output', '-p', 'sys-backup', '/bin/sh /tmp/wyngrpc/tmpx4p86e2_']]' returned non-zero exit status 1.

This is because of an error when Wyng tries to execute the script /tmp/wyngrpc/tmpx4p86e2_ on the qube where the destination is mounted. This script is:

trap '' INT TERM QUIT ABRT ALRM TSTP USR1
set -e && export LC_ALL=C
 cd '/mnt/remote/qubes-rclone.backup' && mv -T Vol_8ce480/S_20230922-102839-tmp Vol_8ce480/S_20230922-102839 && mv Vol_8ce480/volinfo.tmp Vol_8ce480/volinfo && mv archive.ini.tmp archive.ini

When executing this script manually, this error happens:

mv: cannot move 'Vol_8ce480/S_20230922-102839-tmp' to 'Vol_8ce480/S_20230922-102839': File exists

For some reson, there is an empty directory on the remote with the name Vol_8ce480/S_20230922-102839 that prevents Wyng from running the command mv -T Vol_8ce480/S_20230922-102839-tmp Vol_8ce480/S_20230922-102839.

This only happens when mounting the remote filesystem with rclone, it does not happen when using e.g. davfs2.

Environment: Qubes OS 4.2.0-rc1, Wyng 0.8beta release 20230826

tasket commented 6 months ago

Added manually.