Working, Working, Working...Broke

What is the problem you are having with rclone?

Getting service to start:
Everthing has been working fine until this morning when plex refused to play anything so rebooted the server after which the "rclone.service" fails to start from a timeout.

I didn't make any changes to the rclone config, I had downloaded some extra files ready to add to the gdrive using Plex Autoscan.

What is your rclone version (output from rclone version)

  • rclone v1.53.3
  • os/arch: linux/amd64
  • go version: go1.15.5

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

Debian 4.19.160-2 64bit

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

Google Drive

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

Mounting the gdrive using a service

# /etc/systemd/system/rclone.service
[Unit]
Description=GDrive (rclone)
RequiresMountsFor=/mnt/downloadhd/gdrive
After=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount gdrive: /mnt/downloadhd/gdrive \
        --config /home/container/.config/rclone/rclone.conf \
        --allow-other \
        --allow-non-empty \
        --cache-db-purge \
        --vfs-cache-mode writes \
        --log-level INFO \
        --log-file /home/container/logs/rclone.log
ExecStop=/bin/fusermount -uz /mnt/downloadhd/gdrive
Restart=always
RestartSec=10
User=container
Group=container

[Install]
WantedBy=default.target

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = Removed
client_secret = Removed
scope = drive
token = {Removed}

[gcache]
type = cache
remote = gdrive: /mnt/downloadhd/gdrive/
chunk_size = 20M
info_age = 3d
chunk_total_size = 20G

A log from the command with the -vv flag

systemctl status rclone.service

● rclone.service - GDrive (rclone)
   Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
   Active: activating (start) since Sat 2021-01-02 00:55:30 GMT; 1min 19s ago
 Main PID: 15581 (rclone)
    Tasks: 13 (limit: 4915)
   Memory: 182.9M
   CGroup: /system.slice/rclone.service
           └─15581 /usr/bin/rclone mount gdrive: /mnt/downloadhd/gdrive --config /home/container/.config/rclone/rclone.

Jan 02 00:55:30 Plex-Cloud systemd[1]: Starting GDrive (rclone)...

when i journal the service it has reams of the following:

Jan 02 01:00:21 Plex-Cloud systemd[1]: rclone.service: Start operation timed out. Terminating.
Jan 02 01:00:21 Plex-Cloud systemd[1]: rclone.service: Main process exited, code=killed, status=15/TERM
Jan 02 01:00:21 Plex-Cloud systemd[1]: rclone.service: Failed with result 'timeout'.
Jan 02 01:00:21 Plex-Cloud systemd[1]: Failed to start GDrive (rclone).
Jan 02 01:00:31 Plex-Cloud systemd[1]: rclone.service: Service RestartSec=10s expired, scheduling restart.
Jan 02 01:00:31 Plex-Cloud systemd[1]: rclone.service: Scheduled restart job, restart counter is at 18.
Jan 02 01:00:31 Plex-Cloud systemd[1]: Stopped GDrive (rclone).
Jan 02 01:00:31 Plex-Cloud systemd[1]: Starting GDrive (rclone)...

Here is the log file it starts ok and there are no errors listed

Happy to provide more detail if needed just point me in the right direction.

Thanks in advance :grinning:

The cache backend is buggy and not supported so it's recommended to change to vfs-cache-mode full instead.

This tends to be bad and allows for overmounting/hiding/multiple processes starting and shouldn't be used and possibly hiding the error..

I'd guess you probably have more than one going if systemd killed it or based on your status, it's actually running? Hard to tell.

What does a ps -ef | grep rclone show? Is there more than 1? Is it constantly restarting?

Those option make systemd restart over and over and over and just make things break too as you don't want those options.

I'd use:

Restart=on-failure

and you want to set killmode to none

KillMode=none

@Animosity022 As always thanks for such a prompt and efficiant response.

I have change the vfs-cache-mode full, does this move away from the cache backend or do i need to do anything else?

I've removed the --allow-nonempty \ this was an oversight on my part as you have said before it shouldn't be used :roll_eyes:

There should only be one rclone mount running but as said its hard to tell if the service is running or not and yes its constantly restarting the service

Here is the output of ps -ef | grep rclone:

root     18809  4038  0 08:41 pts/0    00:00:00 nano /etc/systemd/system/rclone.service
contain+ 21691     1 11 08:48 ?        00:00:01 /usr/bin/rclone mount gdrive: /mnt/downloadhd/gdrive --config /home/container/.config/rclone/rclone.conf --allow-other --allow-non-empty --cache-db-purge --vfs-cache-mode writes --log-level INFO --log-file /home/container/logs/rclone.log
root     21784 20870  0 08:48 pts/1    00:00:00 grep rclone

with all the suggested edits the rclone.service file looks like:

# /etc/systemd/system/rclone.service
[Unit]
Description=GDrive (rclone)
RequiresMountsFor=/mnt/downloadhd/gdrive
After=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount gdrive: /mnt/downloadhd/gdrive \
        --config /home/container/.config/rclone/rclone.conf \
        --allow-other \
        --cache-db-purge \
        --vfs-cache-mode full \
        --log-level INFO \
        --log-file /home/container/logs/rclone.log
ExecStop=/bin/fusermount -uz /mnt/downloadhd/gdrive
Restart=on-failure
RestartSec=10
KillMode=none
User=container
Group=container

[Install]
WantedBy=default.target

Is there anything else i should check or change in the config?

Many thanks

You'd need to adjust your rclone.conf to remove the cache backend.

Read a bit on the settings and decide what size cache and age you want to your setup.

Thanks @Animosity022, the changes you suggested has allowed the drive to mount as i need it for the moment, i think the docker yml is recreating the folders in my gdrive mount location as it wasn't until i removed them the drive mounted.

That link makes for some interesting reading, if I have read it right I will remove the [gcache] remote config and use the vfs-cache options as part of the [gdrive] mount options?

Thanks again

Based on your config, you don't use any encryption so you can just point directly to the first remote you have defined, which is "gdrive:" and use all the options when mounting that remote.

@Animosity022 Thank you so much for all your assitance, removing the cache and using the VFS option has vastly simplified my setup and I have learned along the way :smiley:

The last thing I wanted to ask was what is the optimal setting for the VFS option when using google drive in conjunction with Plex? I have Debian Server with 4TB of local storage and 32GB RAM to play with and the only other things the server runs is docker for the following containers (Plex, Sonarr/Radarr and Sabnzbd)

Any guidance on the above is appreciated.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.