GPG Failed: bad session key

Asked by Hnyk Daniel on 2016-03-22

Hello,

I have successfully done backup on my network hdd, but now I cannot do another backup nor list files. When I try to list files I get:

$ duplicity -v9 list-current-files file:///media/extq/backup/smecpi_dupl
Using archive dir: /home/dan/.cache/duplicity/7c6d0f64aee92a7fe2c699a6af6ab374
Using backup name: 7c6d0f64aee92a7fe2c699a6af6ab374
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.copycombackend Succeeded
Import of duplicity.backends.dpbxbackend Succeeded
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Main action: list-current
================================================================================
duplicity 0.7.06 (December 07, 2015)
Args: /usr/bin/duplicity -v9 list-current-files file:///media/extq/backup/smecpi_dupl
Linux 530uarch 4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016 x86_64
/usr/bin/python2 2.7.11 (default, Mar 3 2016, 11:00:04)
[GCC 5.3.0]
================================================================================
Synchronizing remote metadata to local cache...
PASSPHRASE variable not set, asking user.
GnuPG passphrase:
Copying duplicity-full-signatures.20160317T111854Z.sigtar.gpg to local cache.
Using temporary directory /tmp/duplicity-6LTx8B-tempdir
Registering (mktemp) temporary file /tmp/duplicity-6LTx8B-tempdir/mktemp-phRYB4-1
Registering (mktemp) temporary file /tmp/duplicity-6LTx8B-tempdir/mktemp-Z7iaLD-2
Releasing lockfile /home/dan/.cache/duplicity/7c6d0f64aee92a7fe2c699a6af6ab374/lockfile.lock
Removing still remembered temporary file /tmp/duplicity-6LTx8B-tempdir/mktemp-phRYB4-1
Removing still remembered temporary file /tmp/duplicity-6LTx8B-tempdir/mktemp-Z7iaLD-2
GPG error detail: Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1532, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1526, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1380, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1401, in do_backup
    sync_archive(decrypt)
  File "/usr/bin/duplicity", line 1188, in sync_archive
    copy_to_local(fn)
  File "/usr/bin/duplicity", line 1133, in copy_to_local
    gpg.GzipWriteFile(src_iter, tdp.name, size=sys.maxsize)
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 401, in GzipWriteFile
    new_block = block_iter.next()
  File "/usr/bin/duplicity", line 1113, in next
    self.fileobj.close()
  File "/usr/lib/python2.7/site-packages/duplicity/dup_temp.py", line 226, in close
    assert not self.fileobj.close()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 259, in close
    self.gpg_failed()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 226, in gpg_failed
    raise GPGError(msg)
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: AES encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key
===== End GnuPG log =====

and when trying to do a backup:

smecpi backup_scripts # PASSPHRASE="mysecret" $(which duplicity) -v9 --exclude-filelist=bckp_excl.txt / rsync://sarch//media/extq/backup/smecpi_dupl
Using archive dir: /root/.cache/duplicity/33fae63ea4bf4bc61442763253b77101
Using backup name: 33fae63ea4bf4bc61442763253b77101
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.copycombackend Succeeded
Import of duplicity.backends.dpbxbackend Succeeded
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Reading globbing filelist bckp_excl.txt
Main action: inc
================================================================================
duplicity 0.7.06 (December 07, 2015)
Args: /usr/bin/duplicity -v9 --exclude-filelist=bckp_excl.txt / rsync://sarch//media/extq/backup/smecpi_dupl
Linux smecpi 4.1.19-5-ARCH #1 Tue Mar 15 19:59:09 MDT 2016 armv6l
/usr/bin/python2 2.7.11 (default, Mar 6 2016, 12:21:48)
[GCC 5.3.0]
================================================================================
Using temporary directory /tmp/duplicity-rYo0nh-tempdir
Registering (mkstemp) temporary file /tmp/duplicity-rYo0nh-tempdir/mkstemp-sVd1s3-1
Temp has 251637760 available, backup will use approx 34078720.
Reading results of 'rsync -e 'ssh -oBatchMode=yes' sarch:/media/extq/backup/smecpi_dupl/'
Local and Remote metadata are synchronized, no sync needed.
Reading results of 'rsync -e 'ssh -oBatchMode=yes' sarch:/media/extq/backup/smecpi_dupl/'
344 files exist on backend
4 files exist in cache
Extracting backup chains from list of files: [u'duplicity-full-signatures.20160317T111854Z.sigtar.gpg',...
... (shortedned for readability)
...
File duplicity-full.20160317T111854Z.vol99.difftar.gpg is part of known set
Found backup chain [Thu Mar 17 12:18:54 2016]-[Thu Mar 17 12:18:54 2016]
Last full backup date: Thu Mar 17 12:18:54 2016
Collection Status
-----------------
Connecting with backend: BackendWrapper
Archive dir: /root/.cache/duplicity/33fae63ea4bf4bc61442763253b77101

Found 0 secondary backup chains.

Found primary backup chain with matching signature chain:
-------------------------
Chain start time: Thu Mar 17 12:18:54 2016
Chain end time: Thu Mar 17 12:18:54 2016
Number of contained backup sets: 1
Total number of contained volumes: 342
 Type of backup set: Time: Num volumes:
                Full Thu Mar 17 12:18:54 2016 342
-------------------------
No orphaned or incomplete backup sets found.
Registering (mktemp) temporary file /tmp/duplicity-rYo0nh-tempdir/mktemp-yrFG0V-2
Reading results of 'rsync -e 'ssh -oBatchMode=yes' sarch:/media/extq/backup/smecpi_dupl/duplicity-full.20160317T111854Z.manifest.gpg /tmp/duplicity-rYo0nh-tempdir/mktemp-yrFG0V-2'
Releasing lockfile /root/.cache/duplicity/33fae63ea4bf4bc61442763253b77101/lockfile.lock
Removing still remembered temporary file /tmp/duplicity-rYo0nh-tempdir/mktemp-yrFG0V-2
Removing still remembered temporary file /tmp/duplicity-rYo0nh-tempdir/mkstemp-sVd1s3-1
GPG error detail: Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1532, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1526, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1380, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1507, in do_backup
    check_last_manifest(col_stats) # not needed for full backup
  File "/usr/bin/duplicity", line 1211, in check_last_manifest
    last_backup_set.check_manifests()
  File "/usr/lib/python2.7/site-packages/duplicity/collections.py", line 201, in check_manifests
    remote_manifest = self.get_remote_manifest()
  File "/usr/lib/python2.7/site-packages/duplicity/collections.py", line 235, in get_remote_manifest
    manifest_buffer = self.backend.get_data(self.remote_manifest_name)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 694, in get_data
    assert not fin.close()
  File "/usr/lib/python2.7/site-packages/duplicity/dup_temp.py", line 226, in close
    assert not self.fileobj.close()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 259, in close
    self.gpg_failed()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 226, in gpg_failed
    raise GPGError(msg)
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: AES encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key
===== End GnuPG log =====

$ gpg --version
gpg (GnuPG) 2.1.11
libgcrypt 1.6.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Other backups works fine. Thank you

Question information

Language:
English Edit question
Status:
Solved
For:
Duplicity Edit question
Assignee:
No assignee Edit question
Solved by:
Hnyk Daniel
Solved:
2016-04-25
Last query:
2016-04-25
Last reply:
2016-03-27
edso (ed.so) said : #1

essentially duplicate of Daniel's solved other question
 https://answers.launchpad.net/duplicity/+question/288602

..ede/duply.net

Hnyk Daniel (hnykda) said : #2

Hello. This is not the same problem as the previous one. I experienced this bug later on and the errors are different.

edso (ed.so) said : #3

Daniel,

true, but from my experience they should have the same solution. the one you used in the other thread.

did you switch to symmetric passphrease encryption inbetween? your other ticket used keys.

..ede/duply.net

Hnyk Daniel (hnykda) said : #4

I don't know what happened. It was probably some gpg "feature"... Sorry for this.