Installing Dropbox in Gentoo Linux following the recent restrictions introduced for Dropbox for Linux
August 29, 2018 Leave a comment
In a 2013 post I explained how I installed Dropbox in Gentoo Linux running KDE 4. The Dropbox company has recently imposed some restrictions in the Linux client, so this is to explain what I did to get Dropbox working again in my two Gentoo Linux installations, both using the ext4 filesystem (unencrypted) and, these days, KDE Plasma 5.
Both my laptops running Gentoo Linux had a version of Dropbox installed via the Portage package manager: dropbox-45.3.88 in the case of the laptop running Gentoo amd64, and dropbox-48.3.56 in the case of the laptop running Gentoo ~amd64. Recently a Dropbox window popped up, warning me to upgrade Dropbox to the latest version within seven days otherwise the client would no longer be able to sync with the remote Dropbox server. I also received an e-mail from the Dropbox company titled ‘[Action required] We’re updating Linux system requirements‘ informing me that the only supported Linux distributions from now on would be Ubuntu 14.04 or higher and Fedora 21 or higher, and furthermore that the client will only work on an unencrypted ext4 filesystem. As both my Gentoo installations use unencrypted ext4, I was OK on that score, but I still had the problem that an up-to-date Dropbox ebuild is not available for Gentoo and the old Dropbox versions I was using no longer sync. However, I managed to install the latest version of Dropbox (currently 55.4.171) in Gentoo, and it works fine. The Dropbox client’s icon is on the KDE Plasma 5 Panel, and the local Dropbox directory is being sync’ed correctly. Below I explain what I did.
1. I selected ‘Quit Dropbox’ from the old Dropbox client’s menu, and the Dropbox icon disappeared from the Panel.
2. I removed the Dropbox daemon from the list of script files to be started at login (‘System Settings’ > ‘Startup and Shutdown’ > ‘Autostart’).
3. I unmerged (uninstalled) the dropbox package:
clevow230ss /home/fitzcarraldo # emerge --ask --depclean dropbox
4. I deleted the directories ~/.dropbox
and ~/.dropbox-dist
but kept the directory ~/Dropbox
and its contents.
fitzcarraldo@clevow230ss ~ $ rm -rf ~/.dropbox ~/.dropbox-dist
5. I followed the instructions under ‘Dropbox Headless install via command line‘ on the Dropbox Website to re-install the latest version of the daemon and client:
fitzcarraldo@clevow230ss ~ $ cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
6. I configured KDE Plasma 5 to start ~/.dropbox-dist/dropboxd
at login (‘System Settings’ > ‘Startup and Shutdown’ > ‘Autostart’ > ‘Add Script…’).
7. I launched ~/.dropbox-dist/dropboxd
manually from a Konsole window. The Dropbox client icon appeared on the Panel and I was prompted to login to my Dropbox account via a Web browser, as per the instructions on the Dropbox Website (see link in in Step 5):
If you’re running Dropbox on your server for the first time, you’ll be asked to copy and paste a link in a working browser to create a new account or add your server to an existing account. Once you do, your Dropbox folder will be created in your home directory.
8. I logged in to my Dropbox account via the Firefox browser. As soon as I had logged in via the browser, a message appeared in the browser window informing me that “Your computer was successfully linked to your account”, and the Dropbox client icon appeared on the Panel and showed that the contents of ~/Dropbox
were being synchronised.
Everything seems to be working as before. The Dropbox icon on the Panel has the same menu items it had previously. ‘Preferences…’ shows the Dropbox version as v55.4.171. I have not ticked ‘Start Dropbox on system startup’ under Dropbox Preferences because I configured automatic startup using KDE Plasma 5 ‘System Settings’ as described in Step 6 above, and the Dropbox daemon is indeed started automatically when I login.
The Dropbox Website’s instructions (see link in Step 5) also include the following:
Download this Python script to control Dropbox from the command line. For easy access, put a symlink to the script anywhere in your PATH.
I did download that Python script and made it executable:
fitzcarraldo@clevow230ss ~/Dropbox $ chmod +x dropbox.py
However the Python 3.6 interpreter in my Gentoo Linux installations report a syntax error in the script when I run it, I assume because it was written for a different version of Python:
fitzcarraldo@clevow230ss ~/Dropbox $ ./dropbox.py
File "./dropbox.py", line 233
except OSError, e:
^
SyntaxError: invalid syntax
Anyway, as the Dropbox client icon is on the KDE Plasma 5 Panel and I can control Dropbox from there, I see no need for the Python script.
9. My Gentoo installations have a Bash script ~/dbox.sh
that I had created to be launched by a Desktop Configuration file ~/Desktop/Dropbox.desktop
with a nice icon which I double-click on if I want to relaunch the Dropbox daemon (if I previously quit Dropbox from the client’s menu, for example). I had to modify ~/dbox.sh
by replacing the command ‘dbus-launch dropbox start > /dev/null
‘ with the command ‘/home/fitzcarraldo/.dropbox-dist/dropboxd
‘ as shown below.
dbox.sh
#!/bin/bash notify-send 'Launching Dropbox' 'Daemon will be (re)started in 20 seconds' --icon=dialog-information sleep 20s ps auxww | awk '$0~/dropbox/&&$0!~/awk/{print $2}' | xargs kill /home/fitzcarraldo/.dropbox-dist/dropboxd
Dropbox.desktop
[Desktop Entry] Comment[en_GB]=(re)launch Dropbox daemon Comment=(re)launch Dropbox daemon Exec=/home/fitzcarraldo/dbox.sh GenericName[en_GB]=Dropbox GenericName=Dropbox Icon=kipi-dropbox MimeType= Name[en_GB]=Dropbox Name=Dropbox Path= StartupNotify=true Terminal=false TerminalOptions= Type=Application X-DBUS-ServiceName= X-DBUS-StartupType=none X-KDE-SubstituteUID=false X-KDE-Username=fitzcarraldo
10. At the moment Dropbox is working fine again in my Gentoo installations. However, I noticed that Gentoo Linux user zsitvaij posted the following comment in a Gentoo Forums thread:
On every dropbox update, I have to remove ~/.dropbox-dist/dropbox-lnx./libdrm.so.2 to avoid having it crash on launch, works fine after until they update again.
I do not know if that will be necessary in my case, as I have not yet had to upgrade Dropbox from the Version 55.4.171 that I recently installed. When a new version of Dropbox becomes available I will update this post to confirm whether or not I had to do anything to keep Dropbox working.
Addendum (5 October 2019): With reference to my addendum of 31 August 2018, the Python script dropbox.py
that can be downloaded from the Dropbox Web site has been updated and is now written in Python 3, so you can ignore my addendum of 31 August 2018.
Addendum (1 October 2018): With reference to my addendum of 2 September 2018, if you are using OpenRC it is possible to automate the deletion of the file ~/.dropbox-dist/dropbox-lnx.x86_64-/libdrm.so.2
by creating a Bash script /etc/local.d/40dropbox.start
containing the following:
#!/bin/bash if [ -e /home/fitzcarraldo/.dropbox-dist/dropbox-lnx.x86_64-*/libdrm.so.2 ] then rm /home/fitzcarraldo/.dropbox-dist/dropbox-lnx.x86_64-*/libdrm.so.2 fi
Replace my username with your username, obviously. Of course the conditional test could be dispensed with and the script could just contain the shebang line and the rm
line, which would still work even if the file does not exist, but it feels a bit tidier to only attempt to delete the file if it actually exists.
Addendum (2 September 2018): I have just installed Dropbox Version 56.4.94 in my Gentoo ~amd64 installation and I had to use the command shown below once in order to stop the daemon segfaulting when I entered the command ~/.dropbox-dist/dropboxd
in a Konsole window:
fitzcarraldo@clevow230ss ~/Dropbox $ rm ~/.dropbox-dist/dropbox-lnx.x86_64-56.4.94/libdrm.so.2
Addendum (31 August 2018): The Python script dropbox.py
that can be downloaded from the Dropbox Web site (see Step 8 above) is old, as can be seen in the comments in the header of the script:
# Dropbox frontend script # This file is part of nautilus-dropbox 2015.10.28.
It is written in Python 2. Although I do not need to use it, I managed to get it to run in my Gentoo installations by replacing the shebang line ‘#!/usr/bin/python
‘ with ‘#!/usr/bin/env python2
‘. This works in my Gentoo installations because they have both Python 2.7 and Python 3.6 installed. When I now run dropbox.py
I see the following:
fitzcarraldo@clevow230ss ~/Dropbox $ ./dropbox.py
Dropbox command-line interface
commands:
Note: use dropbox help to view usage for a specific command.
status get current status of the dropboxd
throttle set bandwidth limits for Dropbox
help provide help
stop stop dropboxd
running return whether dropbox is running
start start dropboxd
filestatus get current sync status of one or more files
ls list directory contents with current sync status
autostart automatically start dropbox at login
exclude ignores/excludes a directory from syncing
lansync enables or disables LAN sync
sharelink get a shared link for a file in your dropbox
proxy set proxy settings for Dropbox
fitzcarraldo@clevow230ss ~/Dropbox $ ./dropbox.py status
Up to date
fitzcarraldo@clevow230ss ~/Dropbox $ ./dropbox.py running
fitzcarraldo@clevow230ss ~/Dropbox $ ./dropbox.py filestatus ~/Dropbox/Getting\ Started.pdf
/home/fitzcarraldo/Dropbox/Getting Started.pdf: up to date
fitzcarraldo@clevow230ss ~/Dropbox $
Notice that the command ./dropbox.py running
does not return anything even though the daemon is definitely running, so I do not trust the script anyway.