mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.98k stars 1.44k forks source link

Backup.py fails on 18.04 #1503

Open Jelle0637 opened 5 years ago

Jelle0637 commented 5 years ago
root@mail:~/mailinabox# management/backup.py 
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: AES256 encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key
===== End GnuPG log =====

Traceback (most recent call last):
  File "management/backup.py", line 554, in <module>
    perform_backup(full_backup)
  File "management/backup.py", line 279, in perform_backup
    get_env(env))
  File "/root/mailinabox/management/utils.py", line 123, in shell
    ret = getattr(subprocess, method)(cmd_args, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/duplicity', 'incr', '--verbosity', 'warning', '--no-print-statistics', '--archive-dir', '/home/user-data/backup/cache', '--exclude', '/home/user-data/backup', '--volsize', '250', '--gpg-options', '--cipher-algo=AES256', '/home/user-data', 's3://s3-eu-west-1.amazonaws.com/*****', '--allow-source-mismatch', "--ssh-options='-i /root/.ssh/id_rsa_miab'", '--rsync-options=-e "/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p 22 -i /root/.ssh/id_rsa_miab"']' returned non-zero exit status 31.
aroundmyroom commented 5 years ago

I try to use rsync, error message in UI is that the hostname cannot be found

verify gives this: yes I need to change the default ssh port in backup.py

root@box:~/mailinabox# sudo management/backup.py --verify Command line error: One of the arguments must be an URL. Examples of URL strings are "scp://user@host.net:1234/path" and "file:///usr/local". See the man page for more information. Enter 'duplicity --help' for help screen. Using temporary directory /tmp/duplicity-CeD0jT-tempdir Traceback (most recent call last): File "management/backup.py", line 532, in run_duplicity_verification() File "management/backup.py", line 350, in run_duplicity_verification ] + rsync_ssh_options, get_env(env)) File "/root/mailinabox/management/utils.py", line 123, in shell ret = getattr(subprocess, method)(cmd_args, **kwargs) File "/usr/lib/python3.6/subprocess.py", line 291, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/duplicity', '--verbosity', 'info', 'verify', '--compare-data', '--archive-dir', '/home/user-data/backup/cache', '--exclude', '/home/user-data/backup', 'off', '/home/user-data', "--ssh-options='-i /root/.ssh/id_rsa_miab'", '--rsync-options=-e "/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p 2345 -i /root/.ssh/id_rsa_miab"']' returned non-zero exit status 2.

durd commented 5 years ago

I try to use rsync, error message in UI is that the hostname cannot be found

I had to add the hostname again, even though it was pre-filled albeit gray text. After I did that there was no complaints about my hostname.

Jelle0637 commented 5 years ago

Fixed:

When I migrated the box to the new 18.04 installation mailinabox created a new encryption key.

So I deleted all the old backup files in the S3 bucket and reran the command:

# cd mailinabox/
# management/backup.py
ajimix commented 5 years ago

For those having the same problems after a server upgrade, make sure to restore your previous server secret_key.txt here /home/user-data/backup/secret_key.txt

glaszig commented 5 years ago

For those having the same problems after a server upgrade, make sure to restore your previous server secret_key.txt here /home/user-data/backup/secret_key.txt

second that. this was exactly my issue. no need to delete existing backups if you have your old key in place.

tuminoid commented 3 years ago

I'm getting this after upgrading from 0.48 to 0.51.