Often when I run Duplicity I see an error message like this at the end of the run:

Cleanup of temporary file /home/user/.cache/duplicity/9a169830d41477b2dbc3c5b32edd4e8a/duplicity-MEXhMY-tempdir/mktemp-StAkzj-1 failed

The mentioned directory will contain ten or so files that are deleted the next time I run Duplicity.

Any idea why this sometimes fails when running incremental backups? I have not seen any pattern to it myself, and have had little luck in finding others mentioning the same issue. Some guy on some emailing list once mentioned that his locale caused problems for Duplicity. I tried changing from my normal Norwegian bokmål locale to en-US, but still see the issue.

Is this just normal operation for Duplicity?

Seeing it on three different systems: two Ubuntu 13.04 64-bit desktops and one Ubuntu Server 13.04 64-bit.

  • I'm having this issue too since moving my duplicity cron job to be performed by root instead of a sudo user. I wonder if somehow duplicity doesn't have the ability to delete the temp files it creates while running a script croned from the root user? – Lonniebiz Nov 1 '13 at 20:27
  • I'm still hoping for an answer here. – Lonniebiz Jan 30 '14 at 21:31
  • Did you install GunPG ? I had the same issue (on OS X) until I've installed GPG tools. – Cédric Oct 14 '14 at 19:31

This may happen if you've previously run duplicity as root. The files will belong to the root user and can't therefore be removed by a nonprivileged user. Simply changing the owner of the files will fix this, if this is the case:

$ sudo chmod -R user /home/user/.cache/duplicity/

Properly configured Duplicity should not do that.

You might find these steps useful: Duplicity

I know you are on Ubuntu, but I cannot find any suitable source for you. It should be universal.


Maybe try modifying /usr/lib/python2.7/dist-packages/duplicity/tempdir.py (or wherever that file is at your system) to add a more specific exception handler, it seems to do just this:

except Exception:
    log.Info(_("Cleanup of temporary file %s failed") % util.ufn(file))

A more specific error handler added in front of that could try and show the more specific error number:

except OSError as ex:
    log.Info(_("Cleanup of temporary file %s failed with errno %d") % (util.ufn(file), ex.errno))

Running it under strace would show the errno of the unlink call, but would likely be slower and waste a lot of disk space for the log, esp. given the nature of what duplicity does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.