GPG EOFError during restore

Bug #582720 reported by ignoble
52
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Duplicity
Invalid
Undecided
Unassigned
Déjà Dup
Fix Released
High
Michael Terry
16
Fix Released
Undecided
Michael Terry
deja-dup (Ubuntu)
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

Bug Description

When I try to restore my files (into original directory) after a while the program tells me, there's an unknown error and gives me back these lines (anything about my password?):

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1239, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1232, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1124, in main
    globals.gpg_profile.passphrase = get_passphrase(1, action)
  File "/usr/bin/duplicity", line 128, in get_passphrase
    pass1 = getpass.getpass("GnuPG passphrase: ")
  File "/usr/lib/python2.6/getpass.py", line 83, in unix_getpass
    passwd = fallback_getpass(prompt, stream)
  File "/usr/lib/python2.6/getpass.py", line 118, in fallback_getpass
    return _raw_input(prompt, stream)
  File "/usr/lib/python2.6/getpass.py", line 135, in _raw_input
    raise EOFError
EOFError

The backup I try to restore is from an encrypted filesystem (but I excluded the directory /home/.ecryptfs). I secured my backup with a password.

I'm using:
- deja-dup 14.0.3-0ubuntu1
- duplicity 0.6.08b-0ubuntu2
- Ubuntu 10.04 LTS
- python2.6 2.6.5-1ubuntu6

At first, I couldn't reproduce the error creating a log with the given command line (DEJA_DUP_DEBUG=1 deja-dup | tail -n 200 > /tmp/deja-dup.log) - the program didn't do anything for hours. I then modified the command line and added a "sudo" before "deja-dup" - and it nearly worked: The restoring nearly completed, just in the end I got another unknown error - this time without any additional information. (I attached that log to this bug report.)

Revision history for this message
ignoble (8-launchpad-10-wech-spamgourmet-com) wrote :
Revision history for this message
ignoble (8-launchpad-10-wech-spamgourmet-com) wrote :
description: updated
Revision history for this message
Michael Terry (mterry) wrote :

ignoble, do you get prompted for your encryption password?

Ken, I marked that this bug affects duplicity, but actually I'm not sure yet. This might be Deja Dup's messup. But, have you seen EOFErrors before?

Changed in deja-dup:
status: New → Incomplete
Michael Terry (mterry)
summary: - Restore exits with some password error (?)
+ GPG EOFError during restore
Revision history for this message
ignoble (8-launchpad-10-wech-spamgourmet-com) wrote :

Yes, I'm prompted for my encryption password. After that I get a system prompt (background turns grey) for my root password.

Michael Terry (mterry)
Changed in deja-dup:
importance: Undecided → High
status: Incomplete → Confirmed
Revision history for this message
Michael Terry (mterry) wrote :

Just FYI, I've been looking at this, but have been unable to reproduce it. It seems that Deja Dup is not passing the encryption password on to duplicity correctly.

Revision history for this message
Michael Terry (mterry) wrote :

For a workaround, I'd recommend trying to enter the duplicity command line that Deja Dup prints out on the console when it runs, right before it gives you the error.

Something like:

duplicity restore --restore-time=2010-06-04T23:26:39Z --file-to-restore=home/mike/bin/polink --s3-use-new-style --force s3+http://deja-dup-auto-06veryxhre00fhyvmnr2/snare /home/mike/bin/polink --verbosity=9 --gpg-options= --archive-dir=/home/mike/.cache/deja-dup --log-file=/tmp/deja-dup-G1UGDV

You should be prompted for your encryption password on the console.

Michael Terry (mterry)
tags: added: restore
Revision history for this message
JayK (jakres) wrote :

I'm getting the same EOFError in Deja-Dup (no encrypted filesystems here). According to its console output, the duplicity restore command results in an exit code of 30 [1]. But trying it out on the console gave an exit code of 2 because duplicity couldn't process the arguments correctly: my destination for the restored files contains a space and the path is not quoted. [2]

But because the duplicity exit codes don't match I cannot be sure that quoting the destination path solves the original problem.
Anyway, in my opinion it should be possible to have spaces in the path. I am going to open a separate bug ticket for this, to be sure.

I retried the duplicity restore command on the console, with the path quoted, again. It prompted for the password and now it runs and files appear in the destination folder. It has not finished yet but I suspect it to run fine now as far as it concerns this bug ticket.

Something more: Deja-Dup prompts me for my password via gksu after about two minutes of restore preparations (duplicity list-current-files). If I enter my login password (this is not the backup password!), I get the EOFError and the output from [1]. If I enter the backup password (which seems odd to me with gksu) or some random string Deja-Dup fails with another unknown error. [3] So I never get the chance to enter the actual backup password on the way to the EOFError.

[1] Deja-Dup output when the EOFError appears:
** (deja-dup:8489): DEBUG: DuplicityInstance.vala:199: Running the following duplicity (8695) command: duplicity restore --restore-time=20101001T220418Z --rename home/jakob home/jakob --gio --force file:///media/Expansion%20Drive/dejadup /media/Expansion Drive --verbosity=9 --gpg-options= --archive-dir=/home/jakob/.cache/deja-dup --log-file=/tmp/deja-dup-CFSVJV

** (deja-dup:8489): DEBUG: DuplicityInstance.vala:552: duplicity (8695) exited with value 30

[2] Duplicity output of the above command:
$ duplicity restore --restore-time=20101001T220418Z --rename home/jakob home/jakob --gio --force file:///media/Expansion%20Drive/dejadup /media/Expansion Drive --verbosity=9 --gpg-options= --archive-dir=/home/jakob/.cache/deja-dup --log-file=/tmp/deja-dup-CFSVJV
Command line error: Expected 2 args, got 3
Enter 'duplicity --help' for help screen.
Using temporary directory /tmp/duplicity-rY_Dz9-tempdir
$ echo $?
2

[3] Deja-Dup output if I provide the backup password to gksu when Deja-Dup prompts it:
** (deja-dup:8489): DEBUG: DuplicityInstance.vala:199: Running the following duplicity (8658) command: duplicity restore --restore-time=20101001T220418Z --rename home/jakob home/jakob --gio --force file:///media/Expansion%20Drive/dejadup /media/Expansion Drive --verbosity=9 --gpg-options= --archive-dir=/home/jakob/.cache/deja-dup --log-file=/tmp/deja-dup-68KSJV

** (deja-dup:8489): DEBUG: DuplicityInstance.vala:552: duplicity (8658) exited with value 1

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

[1] Why duplicity exits with an error 30 will need a log to examine.

[2] On the commandline arguments with spaces must be quoted. Duplicity will handle them correctly after that.

[3] Once again, we'll need a log to find out what's going on. ErrorCode 30 is exception, so will need traceback.

Revision history for this message
giovano iannotti (iannotti) wrote :

I have the same problem. Just installed ubuntu 10.10 and I am trying to restore my files. I've tried with Deja Dup and with duplicity command line. The last gives me the following message:

GnuPG passphrase:
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1257, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1250, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1151, in main
    sync_archive()
  File "/usr/bin/duplicity", line 928, in sync_archive
    remlist = globals.backend.list()
  File "/usr/lib/python2.6/dist-packages/duplicity/backends/localbackend.py", line 70, in list
    return self.remote_pathdir.listdir()
  File "/usr/lib/python2.6/dist-packages/duplicity/path.py", line 514, in listdir
    return os.listdir(self.name)

I am using:
- Déjà Dup 16.0
- Ubuntu 10.10

Revision history for this message
Michael Terry (mterry) wrote :

OK, I was finally able to reproduce this. It's a combination of using encrypted backups and trying to restore to a system file that requires sudo. As a workaround, if you restore to a folder that your user owns, you shouldn't be prompted for your system password, so you shouldn't hit this.

But I've got a real fix coming up.

Revision history for this message
Michael Terry (mterry) wrote :

Not a duplicity bug, this is a bug with how Deja Dup passes environment variables like PASSPHRASE to the sudo process.

Changed in duplicity:
status: New → Invalid
Changed in deja-dup:
assignee: nobody → Michael Terry (mterry)
status: Confirmed → Fix Committed
Michael Terry (mterry)
Changed in deja-dup:
milestone: none → 17.1
Michael Terry (mterry)
Changed in deja-dup:
status: Fix Committed → Fix Released
Michael Terry (mterry)
Changed in deja-dup (Ubuntu):
status: New → Fix Released
Michael Terry (mterry)
Changed in deja-dup (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package deja-dup - 17.2-0ubuntu1

---------------
deja-dup (17.2-0ubuntu1) natty; urgency=low

  * New upstream release
    - Fix GPG Error during restore (LP: #582720)
    - Fix backing up to devices that don't report free space (LP: #657518)
    - Don't ask for root password if it's not needed (LP: #662884)
  * debian/patches/drop-gconf.patch:
    - Drop unnecessary gconf requirement from configure
 -- Michael Terry <email address hidden> Wed, 17 Nov 2010 22:21:37 -0500

Changed in deja-dup (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Michael Terry (mterry) wrote :

I'm proposing that deja-dup 16.1.1 be approved as an SRU for maverick. 16.1.1 fixes three bugs:

 * Fix backing up to devices that don't report free space (LP: #657518). This means that some people who bought certain types of NAS devices can't back up to them at all. [Two line patch.]

 * Don't ask for root password if it's not needed (LP: #662884). This would prompt users for a root password if they were restoring to 'original locations' even if all their files were inside their home directory. By itself, not so bad, but it became much worse in conjunction with the next bug. [One line patch.]

 * Fix GPG Error during restore (LP: #582720). If you were restoring from an encrypted backup and deja-dup prompted you for the root password, you would afterwards get a fatal GPG error. The only workaround was to avoid a password prompt by restoring to a separate directory, not the files' original locations. [Ten line patch.]

These have all been fixed in deja-dup unstable and stable branches (17.1 and 16.1 respectively). 17.2 is in natty, 16.1.1 is in the upstream PPA: https://launchpad.net/~deja-dup-team/+archive/ppa

TEST CASE: For the first bug, I don't know how to reproduce without the device. But you can test the next two bugs together:
1) Make a backup to, say, ~/deja-dup-test, that contains just some simple home directory, like ~/Documents. Make sure it is encrypted.
2) Try to restore that backup to 'original locations'.
3) If you get prompted for the root password, you've hit the second bug. If you afterwards get a GPG Error, you've hit the third bug. Both should be gone in 16.1.1.

I'm not aware of any regression potential with the patch. I'm attaching the debdiff and uploading to maverick-proposed.

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted deja-dup into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in deja-dup (Ubuntu Maverick):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

Any testers of the maverick-proposed package? As this has been in -proposed for a long time already, I'll remove the proposed package soon if there is no feedback. Thank you!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package deja-dup - 16.1.1-0ubuntu1

---------------
deja-dup (16.1.1-0ubuntu1) maverick-proposed; urgency=low

  * New upstream bug fix release
    - Fix GPG Error during restore (LP: #582720)
    - Fix backing up to devices that don't report free space (LP: #657518)
    - Don't ask for root password if it's not needed (LP: #662884)
 -- Michael Terry <email address hidden> Thu, 18 Nov 2010 07:55:49 -0500

Changed in deja-dup (Ubuntu Maverick):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.