This is about Dropbox not synchronizing on Ubuntu Linux.

The original author blamed it on a old PC with a particular slow I/O. Other possible causes are too many files and folders (see the Dropbox Forums), or when the internet connection isn’t available yet at Dropbox start-up (which was probably the problem in my case after I switched from a wired to a wireless network connection).

The solution:

  • Delay Dropbox startup
  • Set Dropbox’s I/O priority to idle

The solution as described below was written for Ubuntu 9.04 Jaunty Jackalope by the original author, and was tested by me on Ubuntu 10.04 Lucid Lynx and 10.10 Maverick Meerkat. The most recent version of Dropbox used is the 0.6.7. (I have no idea if the same problem occurs with other Linux distros, and if this is the case, whether this solution will work).

The problem for an automated solution is that Dropbox rewrites its autostart config file at every start-up. Meaning that the config file needs to be modified again after every start-up, if done manually.

Solution (automated):

  1. Make a backup copy of the Dropbox autostart config file:
    cp ~/.config/autostart/dropbox.desktop ~/.config/dropbox-asdist.desktop
  2. This will be used as a check in case Dropbox changes their startup script after an upgrade.
  3. Create the folder bin in your home directory.
    cd ~
    mkdir bin
  4. Once this folder is created it should be automatically added to your PATH the next time you log in.
  5. Create the file delay in the folder ~/bin/ with the following contents:
    time=$1
    shift
    sleep $time
    exec "$@"
  6. Create the file dropbox-start-wrapper in the folder ~/bin/ with the following contents:
    # Dropbox overwrites its .config/autostart/dropbox.desktop file on
    # every start. I want it to delay. So this starts dropbox, waits, then
    # restores my config.
    # Also, while I'm at it, ionice dropbox to idle.
    
    ionice -c 3 dropbox start || echo "Dropbox failed to start..."
    sleep 15
    if cmp ~/.config/autostart/dropbox.desktop ~/.config/dropbox-asdist.desktop; then
        # Files are identical. Replace.
        echo "Replacing Dropbox autostart."
        cat > ~/.config/autostart/dropbox.desktop <<EOF
    [Desktop Entry]
    Name=Dropbox
    GenericName=File Synchronizer
    Comment=Sync your files across computers and to the web
    Exec=delay 240 dropbox-start-wrapper
    Terminal=false
    Type=Application
    Icon=dropbox
    Categories=Network;FileTransfer;
    StartupNotify=false
    EOF
    else
        echo "Dropbox autostart differs from the distributed version."
    fi
  7. Replace the contents of the current autostart file ~/.config/autostart/dropbox.desktop with:
    [Desktop Entry]
    Name=Dropbox
    GenericName=File Synchronizer
    Comment=Sync your files across computers and to the web
    Exec=delay 240 dropbox-start-wrapper
    Terminal=false
    Type=Application
    Icon=dropbox
    Categories=Network;FileTransfer;
    StartupNotify=false
  8. Make the files delay and dropbox-start-wrapper executable

    chmod +x ~/bin/{delay,dropbox-start-wrapper}

The delay of 240 seconds was mentioned by the original author. In my case a delay of 100 seconds has proven to be enough.

PS: I have just rewriten the texts, the scripts are from KennethA2.