How to fix non working Dropbox icon on Xubuntu 14.04 LTS 64?

A few hours ago the dropbox icon in Xubuntu 14.04 stopped working. The icon is black with a red slashed zero. I cannot click on it to bring up the dropbox menu. I believe there was an update right before this happened. I reinstalled then purged dropbox. I even deleted all associated files and hidden folders and after I installed it again. Still, the icon is not working. Tried to stop and start the service... again nothing.


Solution 1:

Just got this bug on my Xubuntu 15.10, broken icon and no way to open the menu. I think the bug is connected to Dropbox starting to use "indicator area" for their tray icon instead of "notification area" and the sudo-fix just happens to work because of some environment variables are not in use with sudo sessions.

At least for me this problem can be fixed by running:

dropbox stop && DBUS_SESSION_BUS_ADDRESS="" dropbox start

This seems to move the icon back to "notification area" which fixes both icon and menu. This way the daemon runs as a normal user and not as root.

EDIT: If you create your own startup script for Dropbox based on this fix, remember to disable the default startup script with "dropbox autostart n" command (Thank StockBreak for this one, saved me some time this morning).

EDIT2: ...and for some reason I still had to remove the autostart setting from Dropbox GUI (click icon >> Preferences >> Start Dropbox on system startup). Hope it stays off after this one.

EDIT: To implement this fix in a script that run every time session starts, try this solution: https://askubuntu.com/a/795864/496493

Solution 2:

A new workaround, proposed by File C., is "dbus-launch dropbox start -i".

The following adaptations are reported by users to work at least on the Linux distributions Fedora, Gentoo, Kubuntu, Linux Mint, openSUSE, Slackware, Ubuntu, Xubuntu... and the desktop environments Cinnamon, KDE 4, KDE 5, Mate, Unity, Xfce...

This new dbus-launch workaround seems to work a little faster, with more reliability, and in more cases than the previous DBUS_SESSION_BUS_ADDRESS workaround.

As command line:

dropbox stop && dbus-launch dropbox start

Or as a shell script file:

#!/bin/bash

dropbox stop && dbus-launch dropbox start

Solution 3:

Thanks to kk78's solution I made this complete workaround (see also my other post):

I copied* my desktop entry:

cp ~/.config/autostart/dropbox.desktop ~/.config/autostart/start_dropbox.desktop

Changed the entry like this (please notice the env word):

[Desktop Entry]
Name=Dropbox
GenericName=File Synchronizer
Comment=Sync your files across computers and to the web
#Exec=dropbox start -i
Exec=env DBUS_SESSION_BUS_ADDRESS="" dropbox start -i
Terminal=false
Type=Application
Icon=dropbox
Categories=Network;FileTransfer;
StartupNotify=false

And disabled Dropbox's autostart:

dropbox autostart n

* you cannot just edit it because Dropbox replaces the file every time you log in.

Solution 4:

[This is my deprecated early answer, now kept to research this and related bugs; for newer and better workarounds, without the file ownership change/recovery inconvenience of sudo, see kk78's answer instead, or the command line "dropbox stop && dbus-launch dropbox start" in another answer]

This Dropbox tray icon bug seems to be related to permissions.

Until it gets fixed, a temporary workaround from the command line (Konsole, Terminal, etc.), which is working these days for users of Xubuntu, Linux Mint, etc.:

dropbox stop
sudo dropbox start

Note:

About the "sudo", running Dropbox as root overcomes the permission bug, and the tray icon works again correctly.

However, it has the small secondary effect of having a few files in the hidden folder ~/.dropbox/ owned by root now instead of the user (as you can see with e.g. a file manager such as Dolphin), and therefore the root password is requested when starting Dropbox.

This is ok as a temporary workaround to get the Dropbox tray icon fully working on Linux until the bug is hopefully fixed by a next update, but if the fix doesn't restore the correct permissions, in that hypothetical case a quick solution after the bug fix will be:

sudo dropbox stop
sudo chown -R USER:GROUP /home/USER/.dropbox
dropbox start

Of course, replacing USER and GROUP. For example, if you are co-creator of Unix, UTF-8, Go language, etc. ;) it would be something like:

sudo chown -R ken:ken /home/ken/.dropbox

Update:

Sorry, I've just seen something that makes this temporary workaround still workable but less convenient: Not only those few already mentioned files in the hidden ~/.dropbox folder get owned by root, also the files downloaded from the Dropbox servers to the Dropbox folder (usually ~/Dropbox) on the computer running Dropbox as root.

So, I'm still using this workaround until the bug fix, but if we want to use it we have to apply the permissions recovery line also to the Dropbox folder, at least when we want to edit our downloaded documents. For example:

sudo chown -R USER:GROUP /home/USER/Dropbox

To save time, and to apply it when we start the computer, we can include it in a simple shell script, e.g. a dropbox.sh text file with the executable property, that we can run from the command line or by mouse click:

#!/bin/bash

dropbox stop
sudo dropbox start
sudo chown -R USER:GROUP /home/USER/Dropbox

Simple alternative workaround:

Instead of all the previous procedures, if dealing with file ownership changes and recoveries, etc. is too inconvenient, the simplest alternative is probably to just wait for the Dropbox bug fix without using the icon, and simply check the Dropbox status from time to time using the command line:

dropbox status

The result, if Dropbox is running, most of the time will be: "Up to date".

Later, probably you can use the up arrow to quickly run this line again from a small command line window that you can keep open.

See additional command line help by just typing:

dropbox

As already suggested, to stop using the other workaround (sudo), recover normal file ownership, and start running Dropbox again as normal user instead of root, use just one time (replacing USER and GROUP):

sudo dropbox stop
sudo chown -R USER:GROUP /home/USER/Dropbox
sudo chown -R USER:GROUP /home/USER/.dropbox
sudo chown -R USER:GROUP /home/USER/.dbus
dropbox start

New update:

See kk78's answer to this question, with a much better workaround than mine, and with Dropbox tray icon as normal user, not root. It works at least for Xubuntu and Linux Mint.

It can also be used as a shell script:

#!/bin/bash

dropbox stop && DBUS_SESSION_BUS_ADDRESS="" dropbox start