Dropbox won't mount on startup (service on Ubuntu)

What is the problem you are having with rclone?

Rclone dropbox service will not start/mount on reboot/startup.

What is your rclone version (output from rclone version)

rclone v1.52.1

  • os/arch: linux/amd64
  • go version: go1.14.4

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 18.04.5

Which cloud storage system are you using? (eg Google Drive)

dropbox

The command you were trying to run (eg rclone copy /tmp remote:tmp)

mount on startup

The rclone config contents with secrets removed.

[gdrive]
type = drive
scope = drive
token = {"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}

[dbremote]
type = dropbox
token = {"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

A log from the command with the -vv flag

Jan 22 18:42:30 Fermi-Plex systemd[1]: Starting Mount and cache dropbox  drive to /media/dropbox...
Jan 22 18:42:30 Fermi-Plex systemd[1]: Started Mount and cache dropbox  drive to /media/dropbox.
Jan 22 18:42:30 Fermi-Plex systemd[1]: dbrclone.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 18:42:30 Fermi-Plex systemd[1]: dbrclone.service: Failed with result 'exit-code'.
Jan 22 18:42:30 Fermi-Plex systemd[1]: dbrclone.service: Service hold-off time over, scheduling restart.
Jan 22 18:42:30 Fermi-Plex systemd[1]: dbrclone.service: Scheduled restart job, restart counter is at 1.
Jan 22 18:42:30 Fermi-Plex systemd[1]: Stopped Mount and cache dropbox  drive to /media/dropbox.

My service file (named dbrclone.service)

[Unit]
Description=Mount and cache dropbox  drive to /media/dropbox
After=syslog.target local-fs.target network.target
[Service]
Environment=RCLONEHOME=/home/kilgoretrout/.config/rclone
Environment=MOUNTTO=/media/dropbox
Environment=LOGS=/home/kilgoretrout/logs
Environment=UPLOADS=/home/kilgoretrout/uploads
Type=simple
User=root
ExecStartPre=/bin/mkdir -p ${MOUNTTO}
ExecStartPre=/bin/mkdir -p ${LOGS}
ExecStartPre=/bin/mkdir -p ${UPLOADS}
ExecStart=/usr/bin/rclone mount \
  --rc \
  --log-file ${LOGS}/rclone.log \
  --log-level INFO \
  --umask 022 \
  --allow-non-empty \
  --allow-other \
  --fuse-flag sync_read \
  --tpslimit 10 \
  --tpslimit-burst 10 \
  --dir-cache-time=160h \
  --buffer-size=64M \
  --attr-timeout=1s \
  --vfs-read-chunk-size=2M \
  --vfs-read-chunk-size-limit=2G \
  --vfs-cache-max-age=5m \
  --vfs-cache-mode=writes \
  --cache-dir ${UPLOADS} \
  --config ${RCLONEHOME}/rclone.conf \
  dbremote: ${MOUNTTO}
ExecStop=/bin/fusermount -u -z ${MOUNTTO}
ExecStop=/bin/rmdir ${MOUNTTO}
Restart=always

did you look at the rclone log?
perhaps use DEBUG instead of INFO

this is the goto guide for systemd+rclone
https://github.com/animosity22/homescripts/blob/master/systemd/rclone.service

I've looked at that but it doesn't offer any insight into why my mount isn't working. I'll check the log

No log was created. (I changed the log name in the startup script just to get a clean log).

in the forum almost 100% of the time, -allow-non-empty is not a good idea
also, some times you have to edit a fuse config file to enable that.

i would use that systemd template from that website, just change the very bare minimum to get it working, use as little flags as possible.
once working, then add more flags as needed.

Thanks for that. I just realized that part of the problem might be that I have two services. One for gdrive one for dropbox.

2021/01/22 19:22:07 DEBUG : rclone: Version "v1.52.1" starting with parameters ["/usr/bin/rclone" "mount" "--rc" "--log-file" "/home/kilgoretrout/logs/dbrclone.log" "--log-level" "DEBUG" "--umask" "022" $
2021/01/22 19:22:07 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5572: bind: address already in use
2021/01/22 19:22:07 DEBUG : rclone: Version "v1.52.1" starting with parameters ["/usr/bin/rclone" "mount" "--rc" "--log-file" "/home/kilgoretrout/logs/dbrclone.log" "--log-level" "DEBUG" "--umask" "022" $
2021/01/22 19:22:07 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5572: bind: address already in use
2021/01/22 19:22:07 DEBUG : rclone: Version "v1.52.1" starting with parameters ["/usr/bin/rclone" "mount" "--rc" "--log-file" "/home/kilgoretrout/logs/dbrclone.log" "--log-level" "DEBUG" "--umask" "022" $
2021/01/22 19:22:07 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5572: bind: address already in use
2021/01/22 19:22:08 DEBUG : rclone: Version "v1.52.1" starting with parameters ["/usr/bin/rclone" "mount" "--rc" "--log-file" "/home/kilgoretrout/logs/dbrclone.log" "--log-level" "DEBUG" "--umask" "022" $
2021/01/22 19:22:08 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5572: bind: address already in use
2021/01/22 19:22:08 DEBUG : rclone: Version "v1.52.1" starting with parameters ["/usr/bin/rclone" "mount" "--rc" "--log-file" "/home/kilgoretrout/logs/dbrclone.log" "--log-level" "DEBUG" "--umask" "022" $
2021/01/22 19:22:08 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5572: bind: address already in use

sure,
if you want two services at the same time, just change the port from 5572 to something else like 5573.
and perhaps use a different log for each.

1 Like

where do I do that?

https://rclone.org/rc/#rc-addr-ip
--rc-addr=:5573

I added that to my config - nothing at all happens when I run the service and - weirdly - nothing new in the logs. I'll keep trying stuff on my own - this isn't your problem - but if you have any ideas I'm all ears.

first make sure the commands runs from the command line.

Weirdly, I don't have a conflict when I run from the command line. Maybe when it's run from the command line it just finds an empty port? None the less, when I put this in the command line, it works:

sudo rclone mount dbremote:/PMS /media/dropbox --allow-other --daemon --rc-addr=localhost:5573

I put it in the config and get this error.

  Process: 2885 ExecStart=/usr/bin/rclone mount --rc --rc-addr= :5573 (code=exited, status=1/FAILURE)

config looks like this:

[Unit]
Description=Mount and cache Google drive to /media/Plex
After=syslog.target local-fs.target network.target
[Service]
Environment=RCLONEHOME=/home/kilgoretrout/.config/rclone
Environment=MOUNTTO=/media/dropbox
Environment=LOGS=/home/kilgoretrout/logs
Environment=UPLOADS=/home/kilgoretrout/uploads
Type=simple
User=root
ExecStartPre=/bin/mkdir -p ${MOUNTTO}
ExecStartPre=/bin/mkdir -p ${LOGS}
ExecStartPre=/bin/mkdir -p ${UPLOADS}
ExecStart=/usr/bin/rclone mount \
  --rc \
  --rc-addr=localhost:5573
  --log-file ${LOGS}/dbrclone.log \
  --log-level DEBUG \
  --umask 022 \
  --allow-non-empty \
  --allow-other \
  --fuse-flag sync_read \
  --tpslimit 10 \
  --tpslimit-burst 10 \
  --dir-cache-time=160h \
  --buffer-size=64M \
  --attr-timeout=1s \
  --vfs-read-chunk-size=2M \
  --vfs-read-chunk-size-limit=2G \
  --vfs-cache-max-age=5m \
  --vfs-cache-mode=writes \
  --cache-dir ${UPLOADS} \
  --config ${RCLONEHOME}/rclone.conf \
  dbremote: ${MOUNTTO}
ExecStop=/bin/fusermount -u -z ${MOUNTTO}
ExecStop=/bin/rmdir ${MOUNTTO}
Restart=always
[Install]
WantedBy=multi-user.target

Sorry, not meaning to be frustrating. An automated program built an rclone service for me for gdrive. It works perfectly so I have been trying to copy and just change the essentials for dropbox. That's why all the complicated extras - I'm working off someone elses working rclone.service file.

I'll try to make one from scratch based on what you linked me.

oh, you did not mention that the service was working for gdrive and now you are changing it for dropbox.

use --rc-addr=:5573 or --rc-addr=localhost:5573, not --rc-addr= :5573, there is an extra space character in your version

I'm adding dropbox, the gdrive will continue to be used as well.

what about the variables, for each command, such as ${UPLOADS}
`

Don't really understand it, just know that it all works.

When I work off the template you linked, there are references to settings with regard to gdrive and the API. But I am using dropbox. How do I know how to set/adjust those things?

And also there's stuff like

# Please set this to your own value below

--user-agent randomappname101 \

I haven't a clue what that means. Lots of these templates assume gdrive and assume I'm going to know how to set these variables - that's why I've been avoiding using them.

You unfortunately pick a really interesting choice and a super complex one that won't work well with Dropbox.

I'd avoid running things as root as generally it's best to run as a user.

simple should be notify

That does nothing unless you are custom compiling a kernel.

Those flags are more Google Drive related.

This one is particularly bad for Dropbox as it's not a polling remote so any change make outside the mount takes 160 hours to show up.

Not sure what the goal here was as this makes super small chunk range requests and would be slow to start until it buffered up.

KillMode=none

should get added.

That refers to this:

 --user-agent string                    Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.53.4")

At one point, Google throttled based on user agent and that was many moons again. If you aren't using Google (and I'm pretty sure even myself) can remove it.

I appreciate all the help here. I've tried to vastly simplify this service and to follow your examples.

So you don't have to go read the previous posts: I have a WORKING gdrive mount on this same server, that's taking up the default port. I want an additional service to mount a dropbox drive on startup. The grive config was built (automatically) by a third party program. It's weird and complicated but it works - though it can't be copied and modified to work with dropbox, it seems.

Here's what my 2nd service (the one to mount dropbox) looks like now (it's not working):

[Unit]

Description=Google Drive (rclone)
AssertPathIsDirectory=/media/dropbox
Wants=network-online.target
After=network-online.target

[Service]

Type=simple
Environment=RCLONE_CONFIG=/home/kilgoretrout/.config/rclone/rclone.conf

ExecStart=/usr/bin/rclone mount dbremote:/PMS \
--allow-other \

# This is the default port it runs on
--rc-addr :5573 \
# no-auth is used as no one else uses my server and it is not a shared seedbox
--rc-no-auth \

ExecStop=/bin/fusermount -u /media/dropbox

Restart=always

RestartSec=10


[Install]

WantedBy=default.target

And here's the error I get:

Loaded: error (Reason: Invalid argument)
Active: inactive (dead)

Jan 26 14:19:05 Fermi-Plex systemd[1]: /etc/systemd/system/dbrclone.service:15: Missing '='.
Jan 26 14:19:27 Fermi-Plex systemd[1]: /etc/systemd/system/dbrclone.service:15: Missing '='.

I'm no coder but it appears to tell me I'm missing an '=' in line 15. But I cannot figure out what that means. I'm using a cut and paste from the template you linked.