Restic script testing fails

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.0.10.2
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I am following this guide to start creating automatic backups using restic

Nevertheless, when I arrive at the point where the script needs to be tested, I run rm -rf /tmp/test-backup/; mkdir /tmp/test-backup; yunohost backup create --system conf_ldap -n conf_ldap --methods myrestic --debug -r -o /tmp/test-backup; rm -rf /tmp/test-backup and I get:

root@server:/etc/yunohost/hooks.d# rm -rf /tmp/test-backup/; mkdir /tmp/test-backup; yunohost backup create --system conf_ldap -n conf_ldap --methods myrestic --debug -r -o /tmp/test-backup; rm -rf /tmp/test-backup
160  DEBUG initializing base actions map parser for cli
161  DEBUG loading actions map
162  DEBUG building parser...
166  DEBUG building parser took 0.003s
usage: yunohost {backup} ... [-h] [--output-as {json,plain,none}] [--debug] [--quiet] [--timeout ==SUPPRESS==] [-v]
yunohost: error: unrecognized arguments: -r

therefore, I remove -r, but I get:

root@server:/etc/yunohost/hooks.d# rm -rf /tmp/test-backup/; mkdir /tmp/test-backup; yunohost backup create --system conf_ldap -n conf_ldap --methods myrestic --debug -o /tmp/test-backup; rm -rf /tmp/test-backup
176  DEBUG initializing base actions map parser for cli
178  DEBUG loading actions map
179  DEBUG building parser...
185  DEBUG building parser took 0.006s
187  DEBUG acquiring lock...
208  DEBUG lock has been acquired
237  DEBUG loading python module yunohost.backup took 0.028s
237  DEBUG processing action [33435.1]: yunohost.backup.create with args={'name': 'conf_ldap', 'description': None, 'output_directory': '/tmp/test-backup', 'methods': ['myrestic'], 'system': ['conf_ldap'], 'apps': None, 'dry_run': False}
264  DEBUG Running backup hooks...
275  DEBUG Executing command '['sh', '-c', '/bin/bash -x "/usr/share/yunohost/hooks/backup/05-conf_ldap" /tmp/test-backup 7>&1']'
284  DEBUG + set -eu
285  DEBUG + source /usr/share/yunohost/helpers
285  DEBUG +++ set +o
285  DEBUG +++ grep xtrace
287  DEBUG ++ readonly 'XTRACE_ENABLE=set -o xtrace'
288  DEBUG ++ XTRACE_ENABLE='set -o xtrace'
288  DEBUG ++ set +x
317  DEBUG + backup_dir=/tmp/test-backup/conf/ldap
318  DEBUG + ynh_backup /etc/ldap/ldap.conf /tmp/test-backup/conf/ldap/ldap.conf
319  DEBUG + local legacy_args=sdbm
319  DEBUG + args_array=(['s']='src_path=' ['d']='dest_path=' ['b']='is_big' ['m']='not_mandatory')
319  DEBUG + local -A args_array
320  DEBUG + local src_path
320  DEBUG + local dest_path
321  DEBUG + local is_big
321  DEBUG + local not_mandatory
321  DEBUG + ynh_handle_getopts_args /etc/ldap/ldap.conf /tmp/test-backup/conf/ldap/ldap.conf
322  DEBUG + set +o xtrace
389  DEBUG + echo '! Helper used in legacy mode !'
390  DEBUG + set +x
392  DEBUG + dest_path=/tmp/test-backup/conf/ldap/ldap.conf
392  DEBUG + is_big=0
393  DEBUG + not_mandatory=0
393  DEBUG + BACKUP_CORE_ONLY=0
393  DEBUG + test -n ''
393  DEBUG + '[' 0 -eq 1 ']'
393  DEBUG + '[' '!' -e /etc/ldap/ldap.conf ']'
394  DEBUG ++ realpath /etc/ldap/ldap.conf
394  DEBUG + src_path=/etc/ldap/ldap.conf
394  DEBUG + [[ -z /tmp/test-backup/conf/ldap/ldap.conf ]]
395  DEBUG + [[ / == \/ ]]
395  DEBUG + dest_path=conf/ldap/ldap.conf
395  DEBUG + [[ c == \/ ]]
395  DEBUG + [[ f == \/ ]]
396  DEBUG + [[ -e conf/ldap/ldap.conf ]]
396  DEBUG + local rel_dir=
396  DEBUG + rel_dir=/
396  DEBUG + dest_path=/conf/ldap/ldap.conf
396  DEBUG + dest_path=conf/ldap/ldap.conf
397  DEBUG ++ sed --regexp-extended 's/"/\"\"/g'
397  DEBUG ++ echo /etc/ldap/ldap.conf
399  DEBUG + local src=/etc/ldap/ldap.conf
404  DEBUG ++ echo conf/ldap/ldap.conf
405  DEBUG ++ sed --regexp-extended 's/"/\"\"/g'
406  DEBUG + local dest=conf/ldap/ldap.conf
407  DEBUG + echo '"/etc/ldap/ldap.conf","conf/ldap/ldap.conf"'
407  DEBUG ++ dirname /tmp/test-backup/conf/ldap/ldap.conf
409  DEBUG + mkdir --parents /tmp/test-backup/conf/ldap
413  DEBUG + slapcat -b cn=config -l /tmp/test-backup/conf/ldap/cn=config.master.ldif
451  DEBUG + slapcat -b dc=yunohost,dc=org -l /tmp/test-backup/conf/ldap/dc=yunohost-dc=org.ldif
1555 INFO Creating a backup archive from the collected files...
1556 INFO The archive will contain about 95.5KiB of data.
1556 WARNING Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'...' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
1556 WARNING Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'...' with arguments '()' and '{}', raising  error: KeyError('method') (don't panic this is just a warning)
1556 DEBUG Calling the custom backup method '{method}'...
1557 DEBUG Executing command '['sh', '-c', '/bin/bash -x "./05-myrestic" need_mount /tmp/test-backup conf_ldap /tmp/test-backup 97793 \'\' 7>&1']'
1564 DEBUG + set -e
1565 DEBUG + RESTIC_PASSWORD=KsopZRyWR4VWo9uAJShWcYLZgZWtLt4SxEgozCwZ2EYFk2JLofRpVCJb
1565 DEBUG + RESTIC_REPOSITORY_BASE=sftp:backup:/home/tommi/backup/server.tommi.space
1565 DEBUG + RESTIC_COMMAND=/usr/local/bin/restic
1566 DEBUG + work_dir=/tmp/test-backup
1566 DEBUG + name=conf_ldap
1566 DEBUG + size=97793
1566 DEBUG + description=
1566 DEBUG + case "$1" in
1566 DEBUG + do_need_mount /tmp/test-backup conf_ldap 97793
1567 DEBUG + work_dir=/tmp/test-backup
1568 DEBUG + name=conf_ldap
1568 DEBUG + repo=97793
1568 DEBUG + size=
1568 DEBUG + description=
1568 DEBUG + export RESTIC_PASSWORD
1569 DEBUG + export RESTIC_REPOSITORY=sftp:backup:/home/tommi/backup/server.tommi.space/conf_ldap
1569 DEBUG + RESTIC_REPOSITORY=sftp:backup:/home/tommi/backup/server.tommi.space/conf_ldap
1569 DEBUG + /usr/local/bin/restic list snapshots
1570 WARNING ./05-myrestic: line 19: /usr/local/bin/restic: No such file or directory
1571 DEBUG + /usr/local/bin/restic init
1571 WARNING ./05-myrestic: line 19: /usr/local/bin/restic: No such file or directory
2573 ERROR Could not run script: /etc/yunohost/hooks.d/backup_method/05-myrestic
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 305, in hook_callback
    hook_return = hook_exec(
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 393, in hook_exec
    raise YunohostError("hook_exec_failed", path=path)
yunohost.utils.error.YunohostError: Could not run script: /etc/yunohost/hooks.d/backup_method/05-myrestic
2578 DEBUG Executing command '['sh', '-c', '/bin/bash -x "./05-myrestic" backup /tmp/test-backup conf_ldap /tmp/test-backup 97793 \'\' 7>&1']'
2587 DEBUG + set -e
2588 DEBUG + RESTIC_PASSWORD=KsopZRyWR4VWo9uAJShWcYLZgZWtLt4SxEgozCwZ2EYFk2JLofRpVCJb
2588 DEBUG + RESTIC_REPOSITORY_BASE=sftp:backup:/home/tommi/backup/server.tommi.space
2588 DEBUG + RESTIC_COMMAND=/usr/local/bin/restic
2589 DEBUG + work_dir=/tmp/test-backup
2589 DEBUG + name=conf_ldap
2589 DEBUG + size=97793
2589 DEBUG + description=
2589 DEBUG + case "$1" in
2590 DEBUG + do_backup /tmp/test-backup conf_ldap 97793
2590 DEBUG + work_dir=/tmp/test-backup
2590 DEBUG + name=conf_ldap
2590 DEBUG + repo=97793
2591 DEBUG + size=
2591 DEBUG + description=
2591 DEBUG + export RESTIC_PASSWORD
2591 DEBUG + export RESTIC_REPOSITORY=sftp:backup:/home/tommi/backup/server.tommi.space/conf_ldap
2592 DEBUG + RESTIC_REPOSITORY=sftp:backup:/home/tommi/backup/server.tommi.space/conf_ldap
2592 DEBUG + LOGFILE=/var/log/backup_restic.log
2592 DEBUG + ERRFILE=/var/log/backup_restic.err
2592 DEBUG ++ date +%d_%m_%y_%H:%M
2593 DEBUG + current_date=28_11_22_23:31
2593 DEBUG + pushd /tmp/test-backup
2593 DEBUG /tmp/test-backup /etc/yunohost/hooks.d/backup_method
2593 DEBUG + /usr/local/bin/restic backup ./
3595 ERROR Could not run script: /etc/yunohost/hooks.d/backup_method/05-myrestic
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 305, in hook_callback
    hook_return = hook_exec(
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 393, in hook_exec
    raise YunohostError("hook_exec_failed", path=path)
yunohost.utils.error.YunohostError: Could not run script: /etc/yunohost/hooks.d/backup_method/05-myrestic
3599 INFO The operation 'Create a backup archive' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20221128-223059-backup_create' to get help
3610 DEBUG action [33435.1] executed in 3.373s
3611 DEBUG lock has been released
3611 ERROR Custom backup method could not get past the 'backup' step

Est-ce que vous avez quelque idée, @bleeh?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.