# 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 ```bash 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: ```python 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: ```bash cp /var/lib/flatpak/exports/share/applications/com.dropbox.Client.desktop ~/.config/autostart/ ``` ## Useful Commands ```bash dropbox status # Sync status dropbox filestatus path # Check if a file is synced dropbox exclude list # Show excluded folders ```