Update 2017-10-20: Because Dropbox resigned their API v1
It is possible to use dropbox as a cloud backend for duplicity or duply for backing up data. While I use duply for server backups this is also possible on linux clients. I am using:
- Ubuntu 16.04 LTS
- with its default version of duply
- a newer version of duplicity (see BackendException: Could not initialize backend: cannot import name client)
- and with python dropbox client (v8.4.0)
Needed packages to install
duply and duplicity must both be installed to proceed. duplicity needs the python dropbox backend. On Debian systems you can install it this way:
sudo apt-get install python-pip sudo pip install dropbox
Some tutorials say to use python library dropbox2 instead. But for me this led to an error while backing up.
For dropbox access in
.duply/<name>/conf you only need the following lines:
TARGET='dpbx:///<name>' TARGET_PASS='' export DPBX_ACCESS_TOKEN='<app-token-generated-in-dropbox>'
TARGET sets dropbox as protocol and
<name> is the folder in dropbox:
/Apps/duplicity/<name>. For Dropbox as cloud backend
TARGET_USER must not be set.
TARGET_PASS must be set empty. Without it duply will not run.
DPBX_ACCESS_TOKEN must contain a valid dropbox access token for a Dropbox App. This parameter must be exported because duplicity not for duply and duplicity reads it that way.
The config file must of course contain the other parameters used by duply like
SOURCE as for any other backup cloud backend as well. And as for any other backup cloud backend I strongly recommend to only load up encrypted backup files.
Create a new Dropbox App using Dropbox API and an App folder. The App name you chose is the name of the dropbox folder under
/Apps. After you created your app generate your access token and paste it to your duply config file and replace
Now duply can access Dropbox via duplicity with your created dropbox access token.
Help with possible Errors
Error: dpbx error:  u"Path '<name>' not found"
You are using the
<name> in your duply configuration within the
TARGET parameter but the Dropbox folder
/App/duplicity/<name> is missing. Just add it.
Error: BackendException: Could not initialize backend: No module named dropbox
The dropbox python library is missing. Try
pip install dropbox
Error: dpbx error:  'Error parsing response body or headers: Body - x8crx0 …
The problem did not occur with the first backup but with the following ones if I was using
dropbox2 python library instead of
pip uninstall dropbox2 pip install dropbox
dpbx error:  u'v1_retired'
Since the End of September 2017 Dropbox retired their API v1. So you have to update your python dropbox client.
pip search dropbox # Output: # dropbox (8.4.0) - Official Dropbox API Client # INSTALLED: 6.9.0 # LATEST: 8.4.0 pip uninstall dropbox pip install dropbox
BackendException: Could not initialize backend: cannot import name client
07:25:27.701 Task 'BKP' failed with exit code '23'.
This will occur if your python dropbox backend is not compatible with duplicity
For me it occured after fixing the error dpbx error:  u'v1_retired' with updating dropbox python client.
For Ubuntu 16.04 I updated duplicity to higher version from ppa source to fix it with the following commands:
apt install software-properties-common add-apt-repository ppa:duplicity-team/ppa apt-get update apt-get install duplicity
Help with possible Errors (outdated)
These are common errors with older versions of the duplicity dropbox backend that is not compatible with dropbox API v2.
Error: NameError: global name ‘rest’ is not defined
This is a known bug in the python dropbox backend script. If you have this error you can simply fix it adding the following highlighted line into the file
/usr/lib/python2.7/dist-packages/duplicity/backends/dpbxbackend.py to this position. The bug description is here.
def command(login_required=True): """a decorator for handling authentication and exceptions""" def decorate(f): def wrapper(self, *args): from dropbox import rest if login_required and not self.sess.is_linked(): log.FatalError("dpbx Cannot login: check your credentials",log.ErrorCode.dpbx_nologin) return
Error: dpbx error:  u'Unauthorized'
Something went wrong with the authorization. Removing (or better moving) the file
~/.dropbox.token_store.txt should help. The next time you are using duply you have to confirm the access of the duplicity backend in your browser again and the file will be recreated.