Monday, January 28, 2019

sync - Dropbox won't start on ubuntu 14.04; overwrites autostart entry


I noticed recently that my dropbox was no longer running on startup (the icon no longer appeared in the tray at top right, and nothing was syncing.)


In Startup Applications, dropbox is selected, with command dropbox start -i. Based on Dropbox doesn't autostart in 12.04 I changed the command to sh -c ~/.dropbox-dist/dropboxd. This works: if I restart my machine, the dropbox daemon starts running, the usual icon appears up in the tray, and files sync correctly.


However, when I go look at Startup Applications (after the change and restart described above), the command has reverted to dropbox start -i! That means dropbox will not work next time I restart. Why does it do that and how can I fix it?


I'm on Ubuntu 14.04 LTS, with dropbox version 3.6.7.


Edit, was too long as a comment:


@Jacob I haven't been able to get this to work. I'm having trouble with "In Startup Applications (Dash > Startup Applications) remove the Dropbox entry (but not the newly created start_dropbox.desktop)." The newly created start_dropbox.desktop does not appear in Startup Applications, but there's a Dropbox entry with the dropbox logo, whose command is /bin/bash -c "sleep 10&&dropbox start -i" -- seems to be reading the newly created start_dropbox.desktop. The original dropbox.desktop no longer present in ~/.config/autostart. Dropox does not start on reboot: it does ask for my password, but it doesn't actually start running.


Edit, got this to work by following @Jakob's suggestion, with a twist:


$ ls .config/autostart/
start_dropbox.desktop start_dropbox.desktop~
$ cat .config/autostart/start_dropbox.desktop
[Desktop Entry]
Name=Dropbox
GenericName=File Synchronizer
Comment=Sync your files across computers and to the web
Exec=sh -c ~/.dropbox-dist/dropboxd
Terminal=false
Type=Application
Icon=dropbox
Categories=Network;FileTransfer;
StartupNotify=false
X-GNOME-Autostart-enabled=true
$

Note the Exec=sh -c ~/.dropbox-dist/dropboxd line. This is similar to the setup I had when I asked the question, but now the Exec line doesn't get overwritten on reboot.



Although the cause is most likely the same as here, I posted an almost similar answer, since both the question and the symptoms are different:


Dropbox timing issues in 14.04


In some cases, in 14.04 Dropbox has some timing issues, and the command to startup Dropbox syncing starts too early and breaks for some reason. It seems to be a bug, because starting Dropbox manually fixes it temporarily, but only until the next restart. To fix it permanently, we need to edit and rename the dropbox.desktop file in ~/.config/autostart/


The fix:



  • rename the file ~/.config/autostart/dropbox.desktop into: start_dropbox.desktop


    [You need to rename it because Dropbox overwrites the file dropbox.desktop on every startup]


  • Open the (renamed) file with gedit (drag it over an open gedit window).

  • Replace the line, starting with Exec=, change it into:


    Exec=/bin/bash -c "sleep 10&&dropbox start -i"

    This delays the startup of Dropbox with 10 seconds after log-in, which does the trick.


  • in Dropbox preferences, untick "Start Dropbox on startup" (else we would have two .desktop files representing Dropbox in the autostart folder):


    enter image description here


  • In Startup Applications (Dash > Startup Applications) remove the Dropbox entry (but not the newly created start_dropbox.desktop).


    enter image description here


  • In the folder ~/.config/autostart, remove the original dropbox.desktop if it is still there.


Now on restart, it should run fine.


Explanation


The bug seems to be related to the timing of the Dropbox startup. The workaround above replaces the "real" Dropbox starter with one that delays the startup 10 seconds, until the desktop is ready.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...