Skip to content

Instantly share code, notes, and snippets.

@davidar
Created February 22, 2026 04:28
Show Gist options
  • Select an option

  • Save davidar/358d8d1f72959aa53b0c9f8ab863924c to your computer and use it in GitHub Desktop.

Select an option

Save davidar/358d8d1f72959aa53b0c9f8ab863924c to your computer and use it in GitHub Desktop.
Fix Dropbox CLI (dropbox.py) not detecting the Flatpak Dropbox daemon

Fix Dropbox CLI with Flatpak Dropbox

Problem

The official Dropbox CLI (dropbox.py) doesn't detect the Flatpak Dropbox daemon. Commands like dropbox status report "Dropbox isn't running" even when it is.

Root cause: The CLI checks ~/.dropbox/dropbox.pid, but the Flatpak daemon writes its sandboxed PID there, which doesn't correspond to a real process on the host.

Fix

1. Install the CLI

curl -sL "https://linux.dropbox.com/packages/dropbox.py" -o ~/.local/bin/dropbox
chmod +x ~/.local/bin/dropbox

2. Patch is_dropbox_running()

Edit ~/.local/bin/dropbox and replace the is_dropbox_running() function with:

def is_dropbox_running():
    # Check for Flatpak or native dropbox process
    import subprocess
    try:
        result = subprocess.run(['pgrep', '-f', 'dropbox-lnx|dropboxd'],
                                capture_output=True, text=True)
        return result.returncode == 0
    except:
        pass
    # Fallback to original pid file check
    pidfile = os.path.expanduser("~/.dropbox/dropbox.pid")
    try:
        with open(pidfile, "r") as f:
            pid = int(f.read())
        with open("/proc/%d/cmdline" % pid, "r") as f:
            cmdline = f.read().lower()
    except:
        cmdline = ""
    return "dropbox" in cmdline

This uses pgrep to find the actual Dropbox process on the host, falling back to the original PID file check for non-Flatpak installs.

3. Autostart (optional)

Flatpak Dropbox doesn't autostart by default. Fix by copying the desktop entry:

cp /var/lib/flatpak/exports/share/applications/com.dropbox.Client.desktop ~/.config/autostart/

Useful Commands

dropbox status           # Sync status
dropbox filestatus path  # Check if a file is synced
dropbox exclude list     # Show excluded folders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment