Difference between revisions of "Dropbox"

From ArchWiki
Jump to navigation Jump to search
m (→‎Without Nautilus (Another Way): don't need install instructions)
m (Move non-ext4 note to the corresponding section)
 
(265 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:HOWTOs (English)]]
+
[[Category:File sharing]]
[https://www.dropbox.com Dropbox] is a file sharing system that recently introduced a GNU/Linux client. Use it to transparently sync files across computers and architectures. Simply drop files into your "~/Dropbox" folder, and they will automatically sync to your centralized repository.
+
[[de:Dropbox]]
 +
[[it:Dropbox]]
 +
[[ja:Dropbox]]
 +
[[ru:Dropbox]]
 +
[[zh-hans:Dropbox]]
 +
[[zh-hant:Dropbox]]
 +
{{Related articles start}}
 +
{{Related|Synchronization and backup programs}}
 +
{{Related|Syncthing}}
 +
{{Related articles end}}
 +
[https://www.dropbox.com Dropbox] is a file sharing system with a GNU/Linux client. Use it to transparently sync files across computers and architectures. Simply drop files into your {{ic|~/Dropbox}} folder, and they will automatically sync to your centralized repository.
  
==Installation==
 
  
[http://aur.archlinux.org/packages.php?ID=23363 dropbox] can be installed from the [[AUR]]. Alternatively, [http://aur.archlinux.org/packages.php?ID=29432 dropbox-experimental] is also available.
+
== Installation ==
  
# After installing the package, you can start Dropbox from your application menu or run "dropboxd" from the command-line. The client icon will appear in the system tray.
+
=== AUR ===
# Eventually a popup will ask you to login to your Dropbox account, or start a new one. Enter your credentials.
+
 
# After some time you will see a "Welcome to Dropbox" popup, which will give you the opportunity to view a short tour of Dropbox.
+
{{AUR|dropbox}} can be [[install]]ed. As a last resort, the Dropbox website has instructions for a [https://www.dropbox.com/install?os=lnx headless install via command line].
 +
 
 +
# After installing the package, you can start Dropbox from your application menu or run {{ic|dropbox}} from the command-line. The client icon will appear in the system tray.
 +
# A pop-up will notify you that Dropbox is running from an unsupported location. Click on ''Don't ask again'' since you know that you have installed it from AUR rather than from the official homepage.
 +
# Eventually a pop-up will ask you to log in to your Dropbox account or create a new account. Enter your credentials.
 +
# After some time you will see a "Welcome to Dropbox" pop-up, which will give you the opportunity to view a short tour of Dropbox.
 
# Press the "Finish and go to My Dropbox".
 
# Press the "Finish and go to My Dropbox".
  
===Optional packages===
+
=== Optional packages ===
 +
 
 +
{| class="wikitable"
 +
|command-line interface
 +
|{{AUR|dropbox-cli}}
 +
|-
 +
|[[GNOME/Files]] integration
 +
|{{AUR|nautilus-dropbox}}
 +
|-
 +
|[[Nemo]] integration
 +
|{{AUR|nemo-dropbox}}
 +
|-
 +
|[[Thunar]] integration
 +
|{{AUR|thunar-dropbox}}
 +
|-
 +
|[[Dolphin]] integration
 +
|{{pkg|dolphin-plugins}}
 +
|-
 +
|Caja integration
 +
|{{AUR|caja-dropbox}}
 +
|-
 +
|[[KDE]] client
 +
|{{AUR|kfilebox}}
 +
|}
 +
 
 +
Note that in order to access the GUI and the settings, the only way is via a tray icon. You need an X panel with a system tray or a standalone [[List of applications#System tray|system tray application]] for that.
 +
 
 +
=== Prevent automatic updates ===
 +
 
 +
Since at least version 2.4.6 (see comments around 2013-11-06 on [https://aur.archlinux.org/packages/dropbox/?comments=all AUR]), Dropbox has had an auto-update capability which downloads a new binary to the {{ic|~/.dropbox-dist/}} folder.  The service then attempts to hand over control to this binary and dies, causing systemd to re-start the service, generating a conflict and an endless loop of log-filling, CPU-eating misery. 
 +
 
 +
A workaround is to prevent Dropbox from downloading the automatic update by creating the {{ic|~/.dropbox-dist/}} folder and making it read-only:
 +
 
 +
$ rm -rf ~/.dropbox-dist
 +
$ install -dm0 ~/.dropbox-dist
 +
 
 +
This appears to be necessary for modern Dropbox clients to operate successfully from systemd on arch.
 +
 
 +
Also see the [https://www.dropboxforum.com/hc/en-us/community/posts/202917115-dropbox-will-not-start-under-systemd-on-linux relevant Dropbox forum post].
 +
 
 +
== Autostart ==
 +
 
 +
In the Dropbox preferences, under the "General" tab there should be a "Start Dropbox on system startup" checkbox. Try checking this box and seeing if Dropbox starts automatically.
 +
 
 +
If that does not work, uncheck the box and use one of the following methods instead:
 +
 
 +
=== Autostart with your WM/DE ===
 +
 
 +
For [[KDE]] users, no further steps are required, as KDE saves running applications when logging out and restarts them automatically. Similarly for [[Xfce]] users, Dropbox will be restarted automatically next time you login since the {{ic|dropbox.desktop}} file has been placed in {{ic|~/.config/autostart}}.
 +
 
 +
For [[Cinnamon]] users, it's recommended to start Dropbox client by configuring Startup Applications with a little delay (Cinnamon issue [https://github.com/linuxmint/Cinnamon/issues/4396 #4396]). Starting Dropbox with systemd works, running in background, but there's is no icon on systray due to some Cinnamon bugs ([https://github.com/linuxmint/Cinnamon/issues/481 #481], [https://github.com/linuxmint/Cinnamon/issues/2846 #2846]).
 +
 
 +
If that does not work, you can start the Dropbox sync client along with your window manager by adding {{Ic|/usr/bin/dropbox &}} to your [[xinitrc]] (or {{ic|~/.config/openbox/autostart}}, depending on your setup).
 +
 
 +
=== Autostart on boot with systemd ===
 +
 
 +
{{Note|If ''systemd'' keeps restarting Dropbox, see [[#Prevent automatic updates]].}}
 +
 
 +
To have Dropbox automatically start when your system boots, simply [[enable]] the systemd service, passing your username as the instance identifier. The service unit to be enabled takes the format {{ic|dropbox@''username''}}.
 +
 
 +
By default, running the service does not give you an icon in the system tray because it does not know which X display to use. If you want to have tray support, you must [[edit]] the provided service:
 +
 
 +
{{hc|# systemctl edit dropbox@''username''|<nowiki>
 +
[Service]
 +
Environment=DISPLAY=:0
 +
</nowiki>}}
 +
 
 +
=== Autostart on login with systemd ===
 +
 
 +
To have Dropbox automatically start when you log in, simply [[enable]] the [[systemd/User|user service]].
 +
 
 +
If you want Dropbox to appear in your system tray, you will need to [[edit]] the service unit so that it knows which X display the system tray is in:
 +
 
 +
{{hc|$ systemctl --user edit dropbox|<nowiki>
 +
[Service]
 +
Environment=DISPLAY=:0
 +
</nowiki>}}
 +
 
 +
== Accessing the files without installing a sync client ==
 +
 
 +
If all you need is basic access to the files in your Dropbox, you can use the web interface at https://www.dropbox.com/ to upload and download files to your Dropbox. This can be a viable alternative to running a Dropbox daemon and mirroring all the files on your own machine.
 +
 
 +
Alternatively, the [[AUR]] package {{AUR|droxi}} provides a command-line interface to Dropbox similar to the GNU {{ic|ftp}} client.
 +
 
 +
== Encrypting your Dropbox files ==
 +
 
 +
If you want to store sensitive data in your Dropbox, you should encrypt it before doing so. Syncing to Dropbox is encrypted, but all files are (for the time being) stored on the server unencrypted just as you put them in your Dropbox.
 +
 
 +
* Dropbox works with [[TrueCrypt]], and after you initially uploaded the TrueCrypt volume to Dropbox, performance is quite okay, because Dropbox has a working binary diff.
 +
 
 +
* Another possibility is to use [[EncFS]], which has the advantage that all files are encrypted separately, i.e. you do not have to determine in advance the size of the content you want to encrypt and your encrypted directory grows and shrinks while you add/delete/modify files in it. You can also mount an encrypted volume at startup using the {{ic|-S}} option of {{Ic|encfs}} to avoid having to input the passphrase, but note that your encrypted files are not secure from someone who has direct access to your computer.
 +
 
 +
* A third option is to use [[gocryptfs]]. It is similar to EncFS, except that gocryptfs uses authenticated encryption, for protecting both confidentiality and integrity (tamper-resistance) of the data.
 +
 
 +
=== Setup EncFS with Dropbox ===
 +
 
 +
Follow the Wiki instructions to install [[EncFS]].
  
*For a command-line interface, install [http://aur.archlinux.org/packages.php?ID=34310 dropbox-cli] from the [[AUR]].
+
Assuming you have set your Dropbox directory as {{ic|~/Dropbox}}:
*For integration with nautilus, install [http://aur.archlinux.org/packages.php?ID=19615 nautilus-dropbox] from the [[AUR]]. The nautilus plugin will start dropbox automatically.
 
*For integration with thunar, install [http://aur.archlinux.org/packages.php?ID=39214 thunar-dropbox] from the [[AUR]].
 
*For KDE users, there is KDE client available: [http://aur.archlinux.org/packages.php?ID=41169 kfilebox] from [[AUR]].
 
  
===Autostart===
+
Create a folder.  Files you want synced to Dropbox will go in here.
 +
$ mkdir ~/Private
  
Dropbox can be autostarted by adding dropboxd to .xinitrc (or autostart.sh, depending on your setup). Alternatively, you can [[#Daemon|start it as a daemon]].
+
Run the following and enter a password when asked:
 +
$ encfs ~/Dropbox/Encrypted ~/Private
  
== Alternative to install: use the web interface ==
+
Your secure folder is ready for use; creating any file inside {{ic|~/Private}} will automatically encrypt it into {{ic|~/Dropbox/Encrypted}}, which will then be synced to your cloud storage.
  
If all you need is basic access to the files in a dropbox, you can use the web interface at http://dropbox.com to upload and download files to your dropbox. This can be a viable alternative to running a dropbox daemon and mirroring all the files on your own machine.
+
To mount your EncFS folder on every boot, follow the instructions in the [[EncFS#User_friendly_mounting|EncFS]] wiki page.
  
==Daemon==
+
{{Tip|Consider using the {{ic|ENCFS6_CONFIG}} variable and moving the {{ic|.encfs6.xml}} file to another location (like a USB stick), to help ensure that your encrypted data and the means to realistically decrypt it do not exist together online.}}
  
To run dropbox as a daemon like sshd or vsftpd, simply do the following:
+
== Multiple Dropbox instances ==
  
As root, copy this into a file called /etc/rc.d/dropboxd and set USER to your username.
+
If you need to separate or distinguish your data, personal and work usage for example, you can subscribe to Dropbox with different email addresses and have their directories synced by different Dropbox instances running on a single machine.
  
<pre>
+
The basic principle and general how-to are described in the [http://www.dropboxwiki.com/Multiple_Instances_On_Unix Dropbox Wiki].
#!/bin/bash
 
  
USER=yourusername
+
To summarize, you can setup new or additional instances with:
  
. /etc/rc.conf
+
{{bc|<nowiki>
. /etc/rc.d/functions
+
mkdir /path/to/.dropbox-alt-1
 +
HOME=/path/to/.dropbox-alt-1 /usr/bin/dropbox start -i
 +
</nowiki>}}
  
PID=`pidof -o %PPID /opt/dropbox/dropbox`
+
Once that is done, stop any Dropbox instance still running and start them like this:
  
case "$1" in
+
{{bc|<nowiki>
  start)
+
HOME=/path/to/.dropbox-alt-1 /path/to/.dropbox-alt-1/.dropbox-dist/dropboxd
    stat_busy "Starting Dropbox Service"
+
HOME=/path/to/.dropbox-alt-2 /path/to/.dropbox-alt-2/.dropbox-dist/dropboxd
    [ -z "$PID" ] && su -c "/usr/bin/dropboxd &" $USER
+
</nowiki>}}
    if [ $? -gt 0 ]; then
+
 
      stat_fail
+
Pay attention to use different {{ic|.../.dropbox-dist/dropboxd}} binaries. Even when setting a custom HOME value, the {{ic|/opt/dropbox/dropbox}} or {{ic|/opt/dropbox/dropboxd}} wrappers allow only one instance and when started they will kill the one already running.
    else
+
 
      add_daemon dropboxd
+
== Dropbox on laptops ==
      stat_done
+
 
    fi
+
Dropbox itself is pretty good at dealing with connectivity problems. If you have a laptop and roam between different network environments, Dropbox will have problems reconnecting if you do not restart it. '''Try one of the methods described below first,''' if for some reason the problem remains, you may try one of these hackish solutions: [https://bbs.archlinux.org/viewtopic.php?pid=790905], [https://bbs.archlinux.org/viewtopic.php?pid=1012343#p1012343].
    ;;
+
 
  stop)
+
{{Note|When using any of these methods, you need to prevent Dropbox from doing a standard autostart by unchecking ''Dropbox - Preferences - General - Start Dropbox on system startup''. This prevents Dropbox from creating the {{ic|~/.config/autostart/dropbox.desktop}} file and thus from starting twice.}}
    stat_busy "Stopping Dropbox Service"
+
 
    [ ! -z "$PID" ] && kill $PID > /dev/null
+
=== Using netctl ===
    if [ $? -gt 0 ]; then
+
 
      stat_fail
+
For [[netctl]], use {{ic|ExecUpPost}} and {{ic|ExecDownPre}} respectively in every network profile you use, or for example in {{ic|/etc/netctl/interfaces/wlan0}} to start Dropbox automatically whenever profile on {{ic|wlan0}} is active. Add '|| true' to your command to make sure [[netctl]] will bring up your profile, although Dropbox fails to start.
    else
+
 
      rm_daemon dropboxd
+
ExecUpPost="''any other code''; su -c 'DISPLAY=:0 /usr/bin/dropbox &' ''your_user'' || true"
      stat_done
+
ExecDownPre="''any other code''; killall dropbox"
    fi
+
 
    ;;
+
Obviously, {{ic|''your_user''}} has to be edited and {{ic|''any other code'';}} can be omitted if you do not have any. The above will make sure that Dropbox is running only if there is a network profile active.
  restart)
+
 
    $0 stop
+
=== Using NetworkManager ===
    sleep 3
+
 
    $0 start
+
For [[NetworkManager]], use its [[NetworkManager#Network services with NetworkManager dispatcher|dispatcher]] feature.
    ;;
+
 
  *)
+
Create the following file:
    echo "usage: $0 {start|stop|restart}"
+
{{hc|/etc/NetworkManager/dispatcher.d/10-dropbox.sh|<nowiki>
    ;;
+
#!/bin/sh
 +
USER=''your_user''
 +
status=$2
 +
case $status in
 +
      up)
 +
su -c 'DISPLAY=:0 /usr/bin/dropbox & ' $USER
 +
      ;;
 +
      down)
 +
      killall dropbox
 +
      ;;
 +
esac
 +
</nowiki>}}
 +
 
 +
or, for the systemd alternative:
 +
 
 +
{{hc|/etc/NetworkManager/dispatcher.d/10-dropbox.sh|<nowiki>
 +
#!/bin/sh
 +
USER=''your_user''
 +
status=$2
 +
 
 +
case $status in
 +
      up)
 +
systemctl start dropbox@$USER.service
 +
      ;;
 +
      down)
 +
      systemctl stop dropbox@USER.service
 +
      ;;
 
esac
 
esac
exit 0
+
</nowiki>}}
</pre>
+
 
 +
Do not forget to change scripts to be owned by root and to make them executable.
 +
 
 +
=== Using wicd ===
 +
 
 +
Create {{ic|/etc/wicd/scripts/postconnect/dropbox}}:
 +
#!/usr/bin/env bash
 +
su -c 'DISPLAY=:0 /usr/bin/dbus-launch dropbox &' your_username
 +
 
 +
or, if you use Dropbox with systemd:
 +
 
 +
#!/usr/bin/env bash
 +
systemctl restart dropbox@<user>
 +
 
 +
Create {{ic|/etc/wicd/scripts/postdisconnect/dropbox}}:
 +
#!/usr/bin/env bash
 +
killall dropbox
 +
 
 +
or, if you use Dropbox with systemd:
 +
 
 +
#!/usr/bin/env bash
 +
systemctl stop dropbox@<user>
 +
 
 +
Do not forget to make the above scripts executable.
 +
 
 +
== Troubleshooting ==
 +
 
 +
=== Using Dropbox with non-ext4 filesystems ===
 +
 
 +
{{Note|In July, 2019, Dropbox Client build 77.3.127 added support for [[ZFS]], [[eCryptfs]], [[XFS]] and [[Btrfs]].[https://www.dropboxforum.com/t5/Desktop-client-builds/Beta-Build-77-3-127/td-p/354660] It once dropped support for all file systems except plain [[Ext4]] in November, 2018.[https://www.dropboxforum.com/t5/Syncing-and-uploads/Dropbox-client-warns-me-that-it-ll-stop-syncing-in-Nov-why/m-p/290065/highlight/true#M42255]}}
 +
 
 +
Workarounds have been created, see for example {{AUR|dropbox-fix2}}. These workarounds are based on substituting the filesystem detection functions by the use of LD_PRELOAD.
 +
 
 +
It is also possible to create an ext4 formatted [[sparse file]] within a non-ext4 filesystem. It can then be mounted to the desired location for the Dropbox folder. On btrfs systems, it's recommended to [[Btrfs#Disabling_CoW|disable copy-on-write]].
 +
 
 +
=== Dropbox keeps saying Downloading files ===
 +
 
 +
But in fact now files are synced with your box. This problem is likely to appear when your Dropbox folder is located on a NTFS partition whose mount path contains spaces, or permissions are not set for that partition. See more in the [https://bbs.archlinux.org/viewtopic.php?id=153368 forums]. To resolve the problem pay attention to your entry in {{ic|/etc/fstab}}. Avoid spaces in the mount path and set write permissions with the "default_permissions" option:
 +
 
 +
UUID=01CD2ABB65E17DE0 /run/media/username/Windows ntfs-3g uid=username,gid=users,default_permissions 0 0
 +
 
 +
=== Change the Dropbox location from the installation wizard ===
 +
 
 +
Some users experience the problem during setting-up Dropbox that they cannot select a Dropbox folder other than {{ic|/home/username/Dropbox}}. In this case when the window for changing the path is shown , hit {{ic|Ctrl+l}}, enter the location (e.g. /mnt/data/Dropbox) and click on the ''Choose'' or ''Open'' button.
 +
 
 +
=== Context menu entries in file manager do not work ===
 +
 
 +
Several file managers such as Thunar, GNOME Files or its fork Nemo come with extensions that provide context menu entries for files and folders inside your Dropbox. Most of them will result in a browser action such as opening the file or folder in dropbox.com or sharing the link. If you experience these entries not working, then it is likely you have not set the {{ic|$BROWSER}} variable which Dropbox requires. See [[Environment variables]] for details.
 +
 
 +
=== Connecting... ===
 +
 
 +
It may happen that Dropbox cannot connect successfully because it was loaded before an internet connection was established. This can happen on wireless connections, or fast loading machines on wired networks. The best solution to this problem, for wired and wireless connections, is [[#Dropbox on laptops]] which will ensure that Dropbox is started only after the connection is established.
 +
 
 +
An alternative solution, for those not using netctl or NetworkManager, is to delay the startup of Dropbox:
 +
 
 +
* {{ic|cp ~/.config/autostart/dropbox.desktop ~/.config/autostart/dropbox-delayed.desktop}}
 +
* Prevent Dropbox from doing a standard autostart by unchecking Dropbox - Preferences - General - Start Dropbox on system startup. This removes {{ic|~/.config/autostart/dropbox.desktop}}.
 +
* Edit {{ic|~/.config/autostart/dropbox-delayed.desktop}} and replace {{ic|1=Exec=dropbox}} with {{ic|1=Exec=bash -c "sleep ''timeout'' && dropbox"}}. Tweak the ''timeout'' parameter, the value of {{ic|3}} is a good start.
 +
 
 +
=== Dropbox does not start - "This is usually because of a permission error" ===
 +
 
 +
==== Check permissions ====
 +
 
 +
Make sure that you own Dropbox's directories before running the application. This includes
 +
*{{ic|~/.dropbox}} - Dropbox's configuration directory
 +
*{{ic|~/Dropbox}} - Dropbox's download directory (default)
 +
You can ensure this by changing their owner with {{ic|chown -R}}.
  
Make the file executable with
+
This error could also be caused by {{ic|/var}} being full.
# chmod +x /etc/rc.d/dropboxd
 
  
This allows you to start or stop dropboxd just like any other service.  place it in the daemons array in rc.conf for it to start at boot.
+
==== Re-linking your account ====
  
# /etc/rc.d/dropboxd start
+
[https://www.dropbox.com/help/72 Dropbox's FAQ] suggests that this error may be caused by misconfiguration and is fixed by (re)moving the current configuration folder
  # /etc/rc.d/dropboxd stop
+
  # mv ~/.dropbox ~/.dropbox.old
# /etc/rc.d/dropboxd restart
+
and restarting Dropbox.
  
And in rc.conf:
+
==== Errors caused by running out of space ====
DAEMONS=(... '''@dropboxd''' ...)
 
  
==Without Nautilus (Another Way)==
+
A common error that might happen is that there is no more available space on your {{ic|/tmp}} and {{ic|/var}} partitions. If this happens, Dropbox will crash on startup with the following error in its log:
  
Another way to use Dropbox without Nautilus but with another file manager like Thunar is described below:
+
Exception: Not a valid FileCache file
  
1. Create a fake Nautilus script that will launch Thunar:
+
A detailed story of such an occurrence can be found in the [https://bbs.archlinux.org/viewtopic.php?pid=973458 forums]. Make sure there is enough space available before launching Dropbox.
    $ sudo touch /usr/bin/nautilus && sudo chmod +x /usr/bin/nautilus && sudo nano /usr/bin/nautilus
 
  
2. Insert this text into the file, then save and exit:
+
Another case is when the root partition is full:
    #!/bin/bash
 
    exec thunar $@
 
    exit 0
 
  
3. Launch Dropbox
+
OperationalError: database or disk is full
    $ dropboxd
 
  
4. Click on the dropbox tray icon to open your dropbox folder in Thunar.
+
Check to see the available space on partitions with {{ic|df}}.
  
'''Note:''' in this way there is no need to create a dropbox daemon in /etc/rc.d and to start it at boot via /etc/rc.conf or to make it start via your session manager: just leave the "Start dropbox on system startup" option flagged in the Preferences window.
+
==== Locale caused errors ====
  
'''Note:''' If you already have nautilus instaled but don't want to use it, neither modify the existing file under /usr/bin, just change the /usr/bin for /opt/dropbox in the step 2 above, like this: $ sudo touch /opt/dropbox/nautilus && sudo chmod +x /opt/dropbox/nautilus && sudo nano /opt/dropbox/nautilus. Dropbox will look this path first!
+
Try starting {{Ic|dropbox}} with this code:
  
==Securing your Dropbox==
+
LANG=$LOCALE
 +
dropbox
  
If you want to store sensitive data in your Dropbox, you should encrypt it before. Syncing to Dropbox is encrypted, but all files are (for the time being) stored on the server just as you put them in your Dropbox.
+
(You can also use a different value for LANG; it must be in the format "en_US.UTF-8")
 +
This helps when running from a Bash script or Bash shell where {{ic|/etc/rc.d/functions}} has been loaded
  
* Dropbox works with [[Truecrypt]], and after you initially uploaded the Truecrypt volume to Dropbox, performance is quite ok, because of Dropbox has a working binary diff.
+
==== Filesystem monitoring problem ====
  
* Another possibility is to use [[EncFS]], which has the advantage that all files are encrypted separately, i.e. you don't have to determine in advance the size of the content you want to encrypt and your encrypted directory grows and shrinks while you add/delete/modify files in it. You can also mount an encrypted volume at startup using the -S option of encfs to avoid having to input the passphrase, but note that your encrypted files are not secure from someone who has direct access to your computer.
+
If you have a lot of files to sync in your Dropbox folder, you might get the following error:
  
==Multiple dropbox instances==
+
Unable to monitor filesystem
 +
Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem.
  
If you need to separate or distinguish your data, personal and work usage for example, you can subscribe to dropbox with different email addresses and have multiple directories synced to different instances.
+
This can be fixed easily by adding
  
The basic principle and general howto are described in the [http://wiki.dropbox.com/TipsAndTricks/MultipleInstancesOnUnix Dropbox Wiki].
+
fs.inotify.max_user_watches = 100000
  
'''Only thing to keep in mind: when dealing with multiple instances you have to select the dropbox destination folder, which the dropbox installer asks in the last step; usage examples may be /home/dropbox-personal, /home/dropbox-work and so on.'''
+
to {{ic|/etc/sysctl.d/99-sysctl.conf}} and then reload the kernel parameters
  
For convenience, here is a script that I use to accomplish the task: just add a dir in the "dropboxes" list to have another instance of dropbox, referring to the dir, loaded at script startup.
+
# sysctl --system
  
<pre>
+
=== Proxy settings ===
#!/bin/bash
 
  
#*******************************
+
The easiest way to set Dropbox's proxy settings is by defining them manually in the Proxies tab of the Preferences window. Alternatively, you can also set it to 'Auto-detect' and then export your proxy server to the http_proxy env variable prior to starting Dropbox (HTTP_PROXY is also usable)
# Multiple dropbox instances
 
#*******************************
 
  
dropboxes=".dropbox-personal .dropbox-work"
+
{{bc|<nowiki>env http_proxy=http://your.proxy.here:port /usr/bin/dropbox</nowiki>}}
  
for dropbox in $dropboxes
+
or
do
 
    if ! [ -d $HOME/$dropbox ];then
 
        mkdir $HOME/$dropbox
 
    fi
 
    HOME=$HOME/$dropbox /usr/bin/dropbox start -i
 
done
 
</pre>
 
  
==Dropbox on laptops==
+
{{bc|<nowiki>
 +
export http_proxy=http://your.proxy.here:port
 +
/usr/bin/dropbox
 +
</nowiki>}}
  
Dropbox itself is pretty good at dealing with connectivity problems. If you have a laptop and roam between different network environments, dropbox will have problems reconnecting if you do not restart it. The easiest way to solve this with [[netcfg]] is to use POST_UP and PRE_DOWN.
+
{{Note|Dropbox will only use proxy settings of the form {{ic|<nowiki>http://your.proxy.here:port</nowiki>}}, not {{ic|<nowiki>your.proxy.here:port</nowiki>}} as some other applications do.}}
  
In every network profile you use, add the appropriate commands:
+
=== Missing tray icon in GNOME ===
<pre>
 
POST_UP="any other code; su -c '/usr/bin/dropboxd &' your_user"
 
PRE_DOWN="any other code; killall dropbox"
 
</pre>
 
Obviously, your_user has to be edited and 'any other code;' can be omitted if you do not have any. The above will make sure that dropbox is running only if there is a network profile active.
 
  
==Alternatives==
+
GNOME 3.26 removed support for tray icons in [https://bugzilla.gnome.org/show_bug.cgi?id=785956 bug 785956] which will prevent the Dropbox icon from showing. To restore tray icons an appropriate extension such as [https://extensions.gnome.org/extension/615/appindicator-support/ App Indicator] needs to be installed.
*[https://one.ubuntu.com/ Ubuntu One], available in [http://aur.archlinux.org/packages.php?ID=30081 AUR].
 
*[https://spideroak.com/ Spideroak], available in [http://aur.archlinux.org/packages.php?ID=24401 AUR].
 
*[http://kdropbox.deuteros.es/ KFileBox], available in [http://aur.archlinux.org/packages.php?ID=41169 AUR].
 

Latest revision as of 15:42, 21 February 2020

Dropbox is a file sharing system with a GNU/Linux client. Use it to transparently sync files across computers and architectures. Simply drop files into your ~/Dropbox folder, and they will automatically sync to your centralized repository.


Installation

AUR

dropboxAUR can be installed. As a last resort, the Dropbox website has instructions for a headless install via command line.

  1. After installing the package, you can start Dropbox from your application menu or run dropbox from the command-line. The client icon will appear in the system tray.
  2. A pop-up will notify you that Dropbox is running from an unsupported location. Click on Don't ask again since you know that you have installed it from AUR rather than from the official homepage.
  3. Eventually a pop-up will ask you to log in to your Dropbox account or create a new account. Enter your credentials.
  4. After some time you will see a "Welcome to Dropbox" pop-up, which will give you the opportunity to view a short tour of Dropbox.
  5. Press the "Finish and go to My Dropbox".

Optional packages

command-line interface dropbox-cliAUR
GNOME/Files integration nautilus-dropboxAUR
Nemo integration nemo-dropboxAUR
Thunar integration thunar-dropboxAUR
Dolphin integration dolphin-plugins
Caja integration caja-dropboxAUR
KDE client kfileboxAUR

Note that in order to access the GUI and the settings, the only way is via a tray icon. You need an X panel with a system tray or a standalone system tray application for that.

Prevent automatic updates

Since at least version 2.4.6 (see comments around 2013-11-06 on AUR), Dropbox has had an auto-update capability which downloads a new binary to the ~/.dropbox-dist/ folder. The service then attempts to hand over control to this binary and dies, causing systemd to re-start the service, generating a conflict and an endless loop of log-filling, CPU-eating misery.

A workaround is to prevent Dropbox from downloading the automatic update by creating the ~/.dropbox-dist/ folder and making it read-only:

$ rm -rf ~/.dropbox-dist
$ install -dm0 ~/.dropbox-dist

This appears to be necessary for modern Dropbox clients to operate successfully from systemd on arch.

Also see the relevant Dropbox forum post.

Autostart

In the Dropbox preferences, under the "General" tab there should be a "Start Dropbox on system startup" checkbox. Try checking this box and seeing if Dropbox starts automatically.

If that does not work, uncheck the box and use one of the following methods instead:

Autostart with your WM/DE

For KDE users, no further steps are required, as KDE saves running applications when logging out and restarts them automatically. Similarly for Xfce users, Dropbox will be restarted automatically next time you login since the dropbox.desktop file has been placed in ~/.config/autostart.

For Cinnamon users, it's recommended to start Dropbox client by configuring Startup Applications with a little delay (Cinnamon issue #4396). Starting Dropbox with systemd works, running in background, but there's is no icon on systray due to some Cinnamon bugs (#481, #2846).

If that does not work, you can start the Dropbox sync client along with your window manager by adding /usr/bin/dropbox & to your xinitrc (or ~/.config/openbox/autostart, depending on your setup).

Autostart on boot with systemd

Note: If systemd keeps restarting Dropbox, see #Prevent automatic updates.

To have Dropbox automatically start when your system boots, simply enable the systemd service, passing your username as the instance identifier. The service unit to be enabled takes the format dropbox@username.

By default, running the service does not give you an icon in the system tray because it does not know which X display to use. If you want to have tray support, you must edit the provided service:

# systemctl edit dropbox@username
[Service]
Environment=DISPLAY=:0

Autostart on login with systemd

To have Dropbox automatically start when you log in, simply enable the user service.

If you want Dropbox to appear in your system tray, you will need to edit the service unit so that it knows which X display the system tray is in:

$ systemctl --user edit dropbox
[Service]
Environment=DISPLAY=:0

Accessing the files without installing a sync client

If all you need is basic access to the files in your Dropbox, you can use the web interface at https://www.dropbox.com/ to upload and download files to your Dropbox. This can be a viable alternative to running a Dropbox daemon and mirroring all the files on your own machine.

Alternatively, the AUR package droxiAUR provides a command-line interface to Dropbox similar to the GNU ftp client.

Encrypting your Dropbox files

If you want to store sensitive data in your Dropbox, you should encrypt it before doing so. Syncing to Dropbox is encrypted, but all files are (for the time being) stored on the server unencrypted just as you put them in your Dropbox.

  • Dropbox works with TrueCrypt, and after you initially uploaded the TrueCrypt volume to Dropbox, performance is quite okay, because Dropbox has a working binary diff.
  • Another possibility is to use EncFS, which has the advantage that all files are encrypted separately, i.e. you do not have to determine in advance the size of the content you want to encrypt and your encrypted directory grows and shrinks while you add/delete/modify files in it. You can also mount an encrypted volume at startup using the -S option of encfs to avoid having to input the passphrase, but note that your encrypted files are not secure from someone who has direct access to your computer.
  • A third option is to use gocryptfs. It is similar to EncFS, except that gocryptfs uses authenticated encryption, for protecting both confidentiality and integrity (tamper-resistance) of the data.

Setup EncFS with Dropbox

Follow the Wiki instructions to install EncFS.

Assuming you have set your Dropbox directory as ~/Dropbox:

Create a folder. Files you want synced to Dropbox will go in here.

$ mkdir ~/Private

Run the following and enter a password when asked:

$ encfs ~/Dropbox/Encrypted ~/Private

Your secure folder is ready for use; creating any file inside ~/Private will automatically encrypt it into ~/Dropbox/Encrypted, which will then be synced to your cloud storage.

To mount your EncFS folder on every boot, follow the instructions in the EncFS wiki page.

Tip: Consider using the ENCFS6_CONFIG variable and moving the .encfs6.xml file to another location (like a USB stick), to help ensure that your encrypted data and the means to realistically decrypt it do not exist together online.

Multiple Dropbox instances

If you need to separate or distinguish your data, personal and work usage for example, you can subscribe to Dropbox with different email addresses and have their directories synced by different Dropbox instances running on a single machine.

The basic principle and general how-to are described in the Dropbox Wiki.

To summarize, you can setup new or additional instances with:

mkdir /path/to/.dropbox-alt-1
HOME=/path/to/.dropbox-alt-1 /usr/bin/dropbox start -i

Once that is done, stop any Dropbox instance still running and start them like this:

HOME=/path/to/.dropbox-alt-1 /path/to/.dropbox-alt-1/.dropbox-dist/dropboxd
HOME=/path/to/.dropbox-alt-2 /path/to/.dropbox-alt-2/.dropbox-dist/dropboxd

Pay attention to use different .../.dropbox-dist/dropboxd binaries. Even when setting a custom HOME value, the /opt/dropbox/dropbox or /opt/dropbox/dropboxd wrappers allow only one instance and when started they will kill the one already running.

Dropbox on laptops

Dropbox itself is pretty good at dealing with connectivity problems. If you have a laptop and roam between different network environments, Dropbox will have problems reconnecting if you do not restart it. Try one of the methods described below first, if for some reason the problem remains, you may try one of these hackish solutions: [1], [2].

Note: When using any of these methods, you need to prevent Dropbox from doing a standard autostart by unchecking Dropbox - Preferences - General - Start Dropbox on system startup. This prevents Dropbox from creating the ~/.config/autostart/dropbox.desktop file and thus from starting twice.

Using netctl

For netctl, use ExecUpPost and ExecDownPre respectively in every network profile you use, or for example in /etc/netctl/interfaces/wlan0 to start Dropbox automatically whenever profile on wlan0 is active. Add '|| true' to your command to make sure netctl will bring up your profile, although Dropbox fails to start.

ExecUpPost="any other code; su -c 'DISPLAY=:0 /usr/bin/dropbox &' your_user || true"
ExecDownPre="any other code; killall dropbox"

Obviously, your_user has to be edited and any other code; can be omitted if you do not have any. The above will make sure that Dropbox is running only if there is a network profile active.

Using NetworkManager

For NetworkManager, use its dispatcher feature.

Create the following file:

/etc/NetworkManager/dispatcher.d/10-dropbox.sh
#!/bin/sh
USER=''your_user''
status=$2
case $status in
       up)
		su -c 'DISPLAY=:0 /usr/bin/dropbox & ' $USER
       ;;
       down)
       		killall dropbox
       ;;
esac

or, for the systemd alternative:

/etc/NetworkManager/dispatcher.d/10-dropbox.sh
#!/bin/sh
USER=''your_user''
status=$2

case $status in
       up)
		systemctl start dropbox@$USER.service
       ;;
       down)
       		systemctl stop dropbox@USER.service
       ;;
esac

Do not forget to change scripts to be owned by root and to make them executable.

Using wicd

Create /etc/wicd/scripts/postconnect/dropbox:

#!/usr/bin/env bash
su -c 'DISPLAY=:0 /usr/bin/dbus-launch dropbox &' your_username

or, if you use Dropbox with systemd:

#!/usr/bin/env bash
systemctl restart dropbox@<user>

Create /etc/wicd/scripts/postdisconnect/dropbox:

#!/usr/bin/env bash
killall dropbox

or, if you use Dropbox with systemd:

#!/usr/bin/env bash
systemctl stop dropbox@<user>

Do not forget to make the above scripts executable.

Troubleshooting

Using Dropbox with non-ext4 filesystems

Note: In July, 2019, Dropbox Client build 77.3.127 added support for ZFS, eCryptfs, XFS and Btrfs.[3] It once dropped support for all file systems except plain Ext4 in November, 2018.[4]

Workarounds have been created, see for example dropbox-fix2AUR. These workarounds are based on substituting the filesystem detection functions by the use of LD_PRELOAD.

It is also possible to create an ext4 formatted sparse file within a non-ext4 filesystem. It can then be mounted to the desired location for the Dropbox folder. On btrfs systems, it's recommended to disable copy-on-write.

Dropbox keeps saying Downloading files

But in fact now files are synced with your box. This problem is likely to appear when your Dropbox folder is located on a NTFS partition whose mount path contains spaces, or permissions are not set for that partition. See more in the forums. To resolve the problem pay attention to your entry in /etc/fstab. Avoid spaces in the mount path and set write permissions with the "default_permissions" option:

UUID=01CD2ABB65E17DE0 /run/media/username/Windows ntfs-3g uid=username,gid=users,default_permissions 0 0

Change the Dropbox location from the installation wizard

Some users experience the problem during setting-up Dropbox that they cannot select a Dropbox folder other than /home/username/Dropbox. In this case when the window for changing the path is shown , hit Ctrl+l, enter the location (e.g. /mnt/data/Dropbox) and click on the Choose or Open button.

Context menu entries in file manager do not work

Several file managers such as Thunar, GNOME Files or its fork Nemo come with extensions that provide context menu entries for files and folders inside your Dropbox. Most of them will result in a browser action such as opening the file or folder in dropbox.com or sharing the link. If you experience these entries not working, then it is likely you have not set the $BROWSER variable which Dropbox requires. See Environment variables for details.

Connecting...

It may happen that Dropbox cannot connect successfully because it was loaded before an internet connection was established. This can happen on wireless connections, or fast loading machines on wired networks. The best solution to this problem, for wired and wireless connections, is #Dropbox on laptops which will ensure that Dropbox is started only after the connection is established.

An alternative solution, for those not using netctl or NetworkManager, is to delay the startup of Dropbox:

  • cp ~/.config/autostart/dropbox.desktop ~/.config/autostart/dropbox-delayed.desktop
  • Prevent Dropbox from doing a standard autostart by unchecking Dropbox - Preferences - General - Start Dropbox on system startup. This removes ~/.config/autostart/dropbox.desktop.
  • Edit ~/.config/autostart/dropbox-delayed.desktop and replace Exec=dropbox with Exec=bash -c "sleep timeout && dropbox". Tweak the timeout parameter, the value of 3 is a good start.

Dropbox does not start - "This is usually because of a permission error"

Check permissions

Make sure that you own Dropbox's directories before running the application. This includes

  • ~/.dropbox - Dropbox's configuration directory
  • ~/Dropbox - Dropbox's download directory (default)

You can ensure this by changing their owner with chown -R.

This error could also be caused by /var being full.

Re-linking your account

Dropbox's FAQ suggests that this error may be caused by misconfiguration and is fixed by (re)moving the current configuration folder

# mv ~/.dropbox ~/.dropbox.old

and restarting Dropbox.

Errors caused by running out of space

A common error that might happen is that there is no more available space on your /tmp and /var partitions. If this happens, Dropbox will crash on startup with the following error in its log:

Exception: Not a valid FileCache file

A detailed story of such an occurrence can be found in the forums. Make sure there is enough space available before launching Dropbox.

Another case is when the root partition is full:

OperationalError: database or disk is full

Check to see the available space on partitions with df.

Locale caused errors

Try starting dropbox with this code:

LANG=$LOCALE
dropbox

(You can also use a different value for LANG; it must be in the format "en_US.UTF-8") This helps when running from a Bash script or Bash shell where /etc/rc.d/functions has been loaded

Filesystem monitoring problem

If you have a lot of files to sync in your Dropbox folder, you might get the following error:

Unable to monitor filesystem
Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem.

This can be fixed easily by adding

fs.inotify.max_user_watches = 100000

to /etc/sysctl.d/99-sysctl.conf and then reload the kernel parameters

# sysctl --system

Proxy settings

The easiest way to set Dropbox's proxy settings is by defining them manually in the Proxies tab of the Preferences window. Alternatively, you can also set it to 'Auto-detect' and then export your proxy server to the http_proxy env variable prior to starting Dropbox (HTTP_PROXY is also usable)

env http_proxy=http://your.proxy.here:port /usr/bin/dropbox

or

export http_proxy=http://your.proxy.here:port
/usr/bin/dropbox
Note: Dropbox will only use proxy settings of the form http://your.proxy.here:port, not your.proxy.here:port as some other applications do.

Missing tray icon in GNOME

GNOME 3.26 removed support for tray icons in bug 785956 which will prevent the Dropbox icon from showing. To restore tray icons an appropriate extension such as App Indicator needs to be installed.