Resume typos
[pwan.org.git] / content / hints / deja-dup.rst
1 #########################################################
2 A workaround for running deja-dup as root in Ubuntu 20.04
3 #########################################################
4
5 :date: 2020-07-13
6 :tags: hint, deja-dup, ubuntu
7 :category: hints
8 :author: Jude N
9
10 I found a workaround for the `Duplicity fails to start`_ issue where :code:`'sudo deja-dup'` would fail with the python stacktrace mentioned in the launchpad ticket.
11
12 The ticket was not very useful, so I started looking at the various files in the stacktrace and saw line from /usr/lib/python3/dist-packages/duplicity/backends/giobackend.py was within an :code:`"if u'DBUS_SESSION_BUS_ADDRESS' not in os.environ"` block.
13
14 So I wondered what would happen if I let that environment variable pass into the sudo environment. I tried :code:`'sudo -E deja-dup'` as per `preserve the environment`_. This didn't result in a stacktrace, but it ended up running the backup as the normal non-root user, probably because the preserved environment included the USER and HOME variables along with the DBUS_SESSION_BUS_ADDRESS variable.
15
16 Then I tried preserving just DBUS_SESSION_BUS_ADDRESS with :code:`'sudo --preserve-env=DBUS_SESSION_BUS_ADDRESS deja-dup'`, it worked as expected.
17
18 So the hint here is that when presented with a stacktrace don't be afraid to "Use the Source, Jean Luc".
19
20 .. image:: {static}/images/use-the-source-jean-luc.png
21 :align: center
22 :alt: A image of Patrick Stewart playing Gurney Halleck from David Lynch's Dune film, with the meme text 'Use the Source, Jean Luc'.
23
24
25 .. _Duplicity fails to start: https://bugs.launchpad.net/ubuntu/+source/duplicity/+bug/1855736
26 .. _preserve the environment: https://www.petefreitag.com/item/877.cfm