Help with migrating to another box

I have to migrate to another box. Once again, I’m running into problems trying to restore my data. Below are my commands and the error. Please advise.

root@box:  cd /home/user-data/backup/
root@box:  ls
encrypted  secret_key.txt
root@box:  export PASSPHRASE=$(cat secret_key.txt)
$ sudo -E duplicity restore --force file:/home/user-data/backup/encrypted /home/user-data/
Synchronizing remote metadata to local cache...
Copying duplicity-full-signatures.20200619T105004Z.sigtar.gpg to local cache.
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: AES256 encrypted data
gpg: gcry_kdf_derive failed: Invalid data
gpg: encrypted with 1 passphrase
gpg: decryption failed: No secret key
===== End GnuPG log =====


The secret key is extremely lengthy. I tried entering in just the first line as someone had suggested earlier and it did not work. Is there a way to shorten the key so as to enter a complete key…would that resolve this?


Step 1 before moving to a new box should be upgrading the existing box to the latest version of MIAB. Not doing so can cause all sorts of problems.

So I’d suggest starting there. Once you have your existing box on the most recent version, can you clarify what you mean when you say your key is “extremely lengthy”; how big of a file are we talking? It should be less than 3K.

Lastly, you want to make sure that you don’t get the secret key for your existing box and the secret key for your new box confused, since they are unique to their backups.

Thanks Blinkingline. I should have said I upgraded to 0.53 already.

As for the secret key, it is 2.7K

I followed the instructions at Mail-in-a-Box Maintenance Guide and already copied the key from the old box to the new box and am using that.

Your problem is that you have the secret key in one of the directories that will be overwritten during the restore, so obviously that cannot work.

Which directory do you have the encrypted backup in?

I do not understand what you are trying to do here … you do not physically enter the secret key, it is entered with utilizing the
export PASSPHRASE=$(cat secret_key.txt) command.

You are using the correct path to where you have the file stored on the new MiaB, correct? If I am speaking a completely unintelligible foreign language, please say so. The instructions provided are written for someone with unix experience, not for laymen – something that should be improved upon, IMHO.

Okay I got it to run, but with errors. See below:

$ sudo -E duplicity restore --force file:/home/aztlan/copied_files/encrypted /home/user-data/
Synchronizing remote metadata to local cache...
Copying duplicity-full-signatures.20210430T142902Z.sigtar.gpg to local cache.
Copying duplicity-full.20210430T142902Z.manifest.gpg to local cache.
Last full backup date: Fri Apr 30 07:29:02 2021
Error '[Errno 17] File exists: b'ces/roundcube.sieve' -> b'/home/user-data/mail/sieve/'' processing mail/sieve/
Error '[Errno 17] File exists: b'/home/user-data/owncloud/config.php' -> b'/home/user-data/owncloud-backup/2019-08-04-06:14:36/owncloud-install/config/config.php'' processing owncloud-backup/2019-08-04-06:14:36/owncloud-install/config/config.php
Error '[Errno 17] File exists: b'/home/user-data/owncloud/config.php' -> b'/home/user-data/owncloud-backup/2020-02-16-06:24:50/owncloud-install/config/config.php'' processing owncloud-backup/2020-02-16-06:24:50/owncloud-install/config/config.php
Error '[Errno 17] File exists: b'/home/user-data/owncloud/config.php' -> b'/home/user-data/owncloud-backup/2020-05-17-14:06:39/owncloud-install/config/config.php'' processing owncloud-backup/2020-05-17-14:06:39/owncloud-install/config/config.php
Error '[Errno 17] File exists: b'/home/user-data/ssl/' -> b'/home/user-data/ssl/ssl_certificate.pem'' processing ssl/ssl_certificate.pem

Can these errors be ignored?

Thanx everybody!

If NextCloud is functioning ok for you, I am going to say yes.