In my article Containers with SELinux: Dropbox on CentOS 7, I went through the process for using the headless Dropbox client on CentOS 7. This worked wonderfully until the latest releases of Dropbox and CentOS 7. I upgraded CentOS 7, which restarted the container. That, in turn, upgraded Dropbox. This caused the Dropbox container to fail miserably with a permission error on a library it required.
I do not use Dropbox on my Linux systems very often, but as I develop LinuxVSM, I use it to share out beta versions of the code. Thus, having Dropbox on Linux is very useful to me and, indirectly, to the virtualization community as a whole. My goal was to fix this useful tool so that it would run once more.
A bit of sleuthing was required, using:
docker logs dropbox
This showed that libdropbox_apex.so was not usable due to a permission problem. The solution, available on the Dropbox Forum, is to change the permissions of the offending file. However, none of the current Dropbox containers do this (and I tried quite a few). So, how to fix?
Docker Dropbox Container Change
The solution was to update the existing container for Dropbox that I used to build and deploy the container with the proper permissions. First, I cloned the docker-dropbox-master project. Next, I copied it to another directory, so I only acted on the copy. Then, I applied the following patch:
diff -b -c docker-dropbox-master/Dockerfile docker-dropbox-master.elh/Dockerfile *** docker-dropbox-master/Dockerfile 2016-10-03 13:22:27.000000000 -0500 --- docker-dropbox-master.elh/Dockerfile 2019-10-19 03:22:22.882612912-0500 *** 38,43 **** --- 38,44 ---- && chmod u-w /dbox \ && chmod o-w /tmp \ && chmod g-w /tmp \ + && chmod 755 /opt/dropbox/dropbox-lnx.*/libdropbox_apex.so \ # Prepare for command line wrapper && mv /usr/bin/dropbox /usr/bin/dropbox-cli diff -b -c docker-dropbox-master/run docker-dropbox-master.elh/run *** docker-dropbox-master/run 2016-10-03 13:22:27.000000000 -0500 --- docker-dropbox-master.elh/run 2019-10-19 00:46:37.189111692 -0500 *** 64,69 **** --- 64,71 ---- fi fi + chmod 755 /opt/dropbox/libdropbox_apex.so + echo "Starting dropboxd ($(cat /opt/dropbox/VERSION))…" umask 002 exec su dropbox -s /bin/bash -c /opt/dropbox/dropboxd
In this fashion, the Dropbox container would set the permissions at the container’s build and at its runtime. Perhaps only the runtime is necessary, but this way, we catch it as often as necessary.
Conclusion
These changes allowed Dropbox to run once more within a Docker container on my CentOS 7 desktop. The Dropbox-specific GUI does not work, but that is not a major issue; just copying the files into the Dropbox directory is sufficient, and there are myriad ways to do so on a Linux desktop.