Linux – Is it possible to see what dropboxd is syncing right now


The script for dropboxd on linux will give current status:

$ status 
Syncing (2,656 files remaining)
Uploading 2,656 files...  

Or status of a specific file or current folder:

$ filestatus 
Camera Uploads:     up to date 
Customer Shares:    syncing

But is there a way to see what file(s) are actually being transferred right now?

The reason I ask is that dropbox has been stuck for days syncing but isn't progressing. I suspect it is stuck on some weirdly large or corrupt file, and if I could identify it, I could remove it / ignore it.


$ ls -l /proc/7857/fd

Where 7857 is the pid of dropbox, no files in the synced path are shown.

Note that requiring the stopping of dropboxd and re-executing with a debugger would not reveal what is being transferred now. Stopping and starting the daemon results in re-indexing and re-commencing synchronisation. This would likely cause a different set of files to be the ones being transferred.

Any suggestions?

Best Answer

  • If you are on linux it is quite easy. During the sync process you can do:

    find $HOME/dropbox_sync_dir -type f -exec file status -a '{}' \; | grep 'syncing'

    Explaining details:

    • find <path> -type f -exec ... '{}' \;

    Runs on every file or below the current directory.

    Notice that the braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though single quotes could have been used in that case also.

    More on man find pages

    • file status -a from the dropbox linux client manual:

      dropbox file status  [-l] [-a] [FILE]…
      Prints the current status of each FILE.
         -l or --list prints out information in a format similar to the native Linux command ls.
         -a or --all do not ignore entries starting with "."

      Aliases include stat.

    • | grep 'syncing'

    Searches for the 'syncing' string.

    Note: that the .py end should not be mandatory there should be an alias so writing just dropbox should be enough.

    First Edit - re-edit due to Paul's comment about dropboxd (daemon) vs.

    This remains the most probable way to find out what is being transferred.

    I'll try to debug it myself when I finish my pending tasks.

    The should be debugged via pdb (the python debugger) for more at python debugger.

    Finally after the Paul's comments I understood where is the core of the issue. He wants to see the currently accessed file or even better the one being transferred by the dropbox sync client.

    • You could find all files used by the dropbox client currently used:

      ls -thal /proc/`pgrep dropbox`/fd | egrep -v 'socket:|pipe:|anon_inode|/dev/'
    • If you can not see anything that means that something is probably wrong with the client. I would recommend performing strace.

      To monitor your dropboxd script with output save into output.txt file:
      `strace -o output.txt dropboxd`
      To monitor only system calls you could enter:
      `strace -e open dropboxd`
    • If you want to go even deeper you could attach an debugger e.g. gdb to your strace session.

      If you are unfamiliar with this process you can check,for example, this nice post about unix strace and gdb.

    Just a quick help:

    When you start your trace with: strace dropboxd (running pid would be 501) Then you attach to it the following way:

    $ gdb --quiet
    (gdb) attach 501
    • If everything else fails you can use other ways to sync your dropbox:

    For example, use a different cli client like dbxcli.

    Second Edit & Forth Edit - will not work till dropbox supports own private keys.

    Answer from the dropbox support:

    Dropbox does not support the creation of your own private keys.

    It occurred to me that it should be possible to check what is transferred even via network monitoring tool like wireshark.

    Since the dropbox client is using SSL/TSL (or AES) The dropbox security architecture and you should have the key to check.

    For details how to use wireshare you could check or adjust this example to your case Analyze SSL/TLS Client Hello Traffic. In you have dropbox certificate you could import it into wireshark to see what is happening. (For dropbox security details you can check Dropbox security whitepaper.

    Third Edit & Forth edit - details about the SSL/TSL decryption. (will not work till dropbox supports own private keys.)

    Answer from the dropbox support:

    Dropbox does not support the creation of your own private keys.

    In the second edit section I suggested that you can view the SSL traffic via wireshark. Since Paul has thought that I'm suggesting that you should actually hack the DH key exchange, which is with current knowledge not possible, I would like to rectify it.

    What I'm trying to suggest is that if you are using dropbox business RSA and RSA authentication, you could try to use the dropboxd with RSA key (the daemon dropboxd is closed source, I can not check the source code if the functionality is there and probably the best solution is to ask directly).

    If that is possible, only then import the RSA key to wireshark to see what is currently being transferred.