Unable to start rclone service

What is the problem you have with rclone?

Hi, the problem I am having is that the service that starts rclone does not mount the drive for the plex server.
It is all mounted with google drive.

That is, if I use this command that I put below the drive if it is mounted, but what I want is that it is mounted as a service.

rclone mount --allow-other --allow-non-empty -v drive: /home/rclone &

The mount is done on drive:/home/rclone

I have the service file located at:
/etc/systemd/system

The name you have set is:
rclonescript.service (with permissions 777)

The commands I use to start the service:
systemctl daemon-reload
systemctl start rclonescript.service
systemctl enable rclonescript.service (not very necessary yet as I don't want it to run at startup)

I have a configuration that I found browsing but I don't know how it would work for me, as I can't run it I don't know how it works for the plex server.
I would also appreciate if someone could give me some suitable values adjusting to the characteristics of the server (200GB NVME, 30GB RAM, 8vCores), mostly to be able to play 4K, Remux, etc ....

The configuration is as follows:

/etc/systemd/system/rclonescript.service
[Unit]
Description=Google Drive (rclone)
AssertPathIsDirectory=/home/rclone
After=plexdrive.service

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount drive:/ /home/rclone
--config=/root/.config/rclone/rclone.conf
--allow-other
--cache-tmp-upload-path=/tmp/rclone/upload \ --allow-other
--cache-chunk-path=/tmp/rclone/chunks \ --cache-workers=20.0
--cache-workers=20
--cache-writes
--cache-db-path=/tmp/rclone/db \ --cache-db-path=/tmp/rclone/db
--no-modtime
--buffer-size=256M
--drive-chunk-size=256M \ --drive-chunk-size=256M
--drive-server-side-across-configs=true \ --drive-pacer-min-sleep=256M
--drive-pacer-min-sleep 10ms
--drive-pacer-burst 200
--dir-cache-time 5000h \ --poll-interval 60s
--poll-interval 60s
--cache-dir=/tmp/rclone/vfs
--vfs-cache-mode full \ --vfs-cache-mode full
--vfs-cache-max-size 100G
--vfs-cache-max-age 5000h
--vfs-cache-poll-interval 5m
--vfs-read-ahead 4G --vfs-read-chunk-size 4G
--vfs-read-chunk-size 256M
--vfs-cache-dir=/home/rclone
--rc --vfs-read-chunk-size 256M
--log-file=/tmp/rclone/rclone.log
--log-level DEBUG
--drive-use-trash
--stats=0
--checkers=24
--bwlimit-file=400M \ --cache-info-age=400M
--cache-info-age=120m drive:/ /home/rclone
ExecStop=/bin/fusermount -u /home/rclone
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

Run the command 'rclone version' and share the full output of the command.

rclone v1.59.0

  • os/version: ubuntu 20.04 (64 bit)
  • os/kernel: 5.4.0-105-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.18.3
  • go/linking: static
  • go/tags: none

What cloud storage system are you using (e.g. Google Drive)?

Google Drive

hello and welcome to the forum,

that is a terrible config, no point in trying to fix it.

for rclone+plex+gdrive, this is a well tested systemd service file.
https://github.com/animosity22/homescripts/blob/master/systemd/rclone-drive.service
and should read
https://github.com/animosity22/homescripts

Thank you for the welcome message.
Looking at the configuration you have passed me, I have put it according to the route of my assemblies, but I do not know if it is well constructed.

[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount drive: /home\rclone 
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 5000h \
# Log file location
--log-file /opt/rclone/logs/rclone.log \
# Set the log level
--log-level NOTICE \
# I reduce the poll interval down to 10 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 10s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# Please set this to your own value below
--user-agent someappname101 \
# This sets up the remote control daemon so you can issue rc commands locally
--rc \
# This is the default port it runs on
--rc-addr :5572 \
# no-auth is used as no one else uses my server and it is not a shared seedbox
--rc-no-auth \
# The local disk used for caching
--cache-dir=/tmp/cache \
#
# My quota per user / per 100 seconds is 20,000 requests. This can be found in your quota section.
# This changes the sleep calls to something much lower to take advantage of the API boost.
# change the min sleep from 100ms
--drive-pacer-min-sleep 10ms \
# Changing to have the ability to burst higher
--drive-pacer-burst 200 \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 250G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 5000h \
# The polling interval for increased based on there is enough buffer space
--vfs-cache-poll-interval 5m \
# This sets a per file bandwidth control and I limit this to a little bigger than my largest bitrate I'd want to play
--bwlimit-file 32M
ExecStop=/bin/fusermount -uz /home/rclone
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
User= I don't know which is my user, by default it can be root?
Group= I don't know what my group is, I guess it's the default one but I don't know which one it is.

[Install]
WantedBy=multi-user.target

Considering that with this command if it worked for me:

rclone mount --allow-other --allow-non-empty -v drive: /home/rclone &

Well, I just want to see if I have built the configuration right.

Thank you very much for the help.

sure, but at this point, i cannot advise about that config.
no worries, as soon .....

Nothing, I can't get it to work with this configuration.....

[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf \
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount drive: /home\rclone 
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 5000h \
# Log file location
--log-file /opt/rclone/logs/rclone.log \
# Set the log level
--log-level NOTICE \
# I reduce the poll interval down to 10 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 10s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# Please set this to your own value below
--user-agent someappname101 \
# This sets up the remote control daemon so you can issue rc commands locally
--rc \
# This is the default port it runs on
--rc-addr :5572 \
# no-auth is used as no one else uses my server and it is not a shared seedbox
--rc-no-auth \
# The local disk used for caching
--cache-dir=/tmp/cache \
#
# My quota per user / per 100 seconds is 20,000 requests. This can be found in your quota section.
# This changes the sleep calls to something much lower to take advantage of the API boost.
# change the min sleep from 100ms
--drive-pacer-min-sleep 10ms \
# Changing to have the ability to burst higher
--drive-pacer-burst 200 \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 250G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 5000h \
# The polling interval for increased based on there is enough buffer space
--vfs-cache-poll-interval 5m \
# This sets a per file bandwidth control and I limit this to a little bigger than my largest bitrate I'd want to play
--bwlimit-file 32M
ExecStop=/bin/fusermount -uz /home/rclone
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
User=root
Group=root

[Install]
WantedBy=multi-user.target

Where could the error be?

not an expert that systemd but
--- Environment, why is there a trailing slash?
--- ExecStart, perhaps /home\rclone should be /home/rclone

need to do some basic checking of logs

for systemd, you can read about it at
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

for rclone, have to use a rclone debug log
change --log-level NOTICE to --log-level DEBUG

I made the changes you told me and it still doesn't work.
The configuration looks like this:

[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf 
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount drive: /home/rclone 
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 5000h \
# Log file location
--log-file /opt/rclone/logs/rclone.log \
# Set the log level
--log-level NOTICE \
# I reduce the poll interval down to 10 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 10s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# Please set this to your own value below
--user-agent someappname101 \
# This sets up the remote control daemon so you can issue rc commands locally
--rc \
# This is the default port it runs on
--rc-addr :5572 \
# no-auth is used as no one else uses my server and it is not a shared seedbox
--rc-no-auth \
# The local disk used for caching
--cache-dir=/tmp/cache \
#
# My quota per user / per 100 seconds is 20,000 requests. This can be found in your quota section.
# This changes the sleep calls to something much lower to take advantage of the API boost.
# change the min sleep from 100ms
--drive-pacer-min-sleep 10ms \
# Changing to have the ability to burst higher
--drive-pacer-burst 200 \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 250G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 5000h \
# The polling interval for increased based on there is enough buffer space
--vfs-cache-poll-interval 5m \
# This sets a per file bandwidth control and I limit this to a little bigger than my largest bitrate I'd want to play
--bwlimit-file 32M
ExecStop=/bin/fusermount -uz /home/rclone
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
User=root
Group=root

[Install]
WantedBy=multi-user.target


try that, it wil produce a debug log, have to look into it.

I just don't know how to use it.
In which command should I put it?

Like this?
rclone mount --allow-other --allow-non-empty -v drive: /home/rclone & --log-level NOTICE to --log-level DEBUG

i would remove --allow-non-empty unless you have a very specific reason?

both commands should output at debug level
rclone mount drive: /home/rclone --allow-other --log-level DEBUG
or
rclone mount drive: /home/rclone --allow-other -vv

This is what the log tells me

root@vmi938308:~# rclone mount drive: /home/rclone --allow-other --log-level DEBUG
2022/07/30 20:55:29 DEBUG : rclone: Version "v1.59.0" starting with parameters ["rclone" "mount" "drive:" "/home/rclone" "--allow-other" "--log-level" "DEBUG"]
2022/07/30 20:55:29 DEBUG : Creating backend with remote "drive:"
2022/07/30 20:55:29 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/07/30 20:55:29 DEBUG : Google drive root '': Mounting on "/home/rclone"
2022/07/30 20:55:29 DEBUG : : Root:
2022/07/30 20:55:29 DEBUG : : >Root: node=/, err=<nil>
2022/07/30 20:56:28 DEBUG : Google drive root '': Checking for changes on remote
2022/07/30 20:57:28 DEBUG : Google drive root '': Checking for changes on remote
2022/07/30 20:58:28 DEBUG : Google drive root '': Checking for changes on remote
2022/07/30 20:59:28 DEBUG : Google drive root '': Checking for changes on remote
2022/07/30 21:00:28 DEBUG : Google drive root '': Checking for changes on remote

And later it starts to check everything I have on the drive.

(2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r), err=<nil>
2022/07/30 21:14:42 DEBUG : ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv: >Open: fh=&{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r)}, err=<nil>
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r)}: Flush:
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r)}: >Flush: err=<nil>
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r)}: Release:
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E15 - Episodio 15.mkv (r)}: >Release: err=<nil>
2022/07/30 21:14:42 DEBUG : ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv: Open: flags=OpenReadOnly
2022/07/30 21:14:42 DEBUG : ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv: Open: flags=O_RDONLY
2022/07/30 21:14:42 DEBUG : ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv: >Open: fd=ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv (r), err=<nil>
2022/07/30 21:14:42 DEBUG : ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv: >Open: fh=&{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv (r)}, err=<nil>
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv (r)}: Flush:
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - S01E16 - Episodio 16.mkv (r)}: >Flush: err=<nil>
2022/07/30 21:14:42 DEBUG : &{ANIME/Blue Dragon (2007)      [720p][ES]/Temporada 01 [720p][ES]/Blue Dragon - 


the command is a but confusing
the command is run at root user however, the mountpoint is /home/rclone

in any event, if the command worked, the files should be located at the mountpoint

Yes, the command worked.
But it only works that way.

The service, on the other hand, there is no way to make it work.

Does the /opt/rclone/logs/rclone.log file exist at the location specified? In my experience rclone will not start if the file isn't there. I would check all other paths in the service file too. If the log file exists check it also for any errors from rclone.

That's not correct as you just need permissions to write the log file.

If the directory path is missing or there are not correct permissions it would create an error.

rclone mount GD: /home/felix/test --log-file /not/real/rclone.log -vvv
2022/08/07 17:10:06 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2022/08/07 17:10:06 Failed to open log file: open /not/real/rclone.log: no such file or directory

and

felix@gemini:~$ ls /tmp/rclone.log
ls: cannot access '/tmp/rclone.log': No such file or directory
felix@gemini:~$ rclone mount GD: /home/felix/test --log-file /tmp/rclone.log -vvv
2022/08/07 17:10:31 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
^Cfelix@gemini:~$ ls /tmp/rclone.log
/tmp/rclone.log
felix@gemini:~$ tail -5 /tmp/rclone.log
2022/08/07 17:10:31 DEBUG : : Root:
2022/08/07 17:10:31 DEBUG : : >Root: node=/, err=<nil>
2022/08/07 17:10:33 INFO  : Signal received: interrupt
2022/08/07 17:10:33 ERROR : /home/felix/test: Unmounted rclone mount
2022/08/07 17:10:33 INFO  : Exiting...
felix@gemini:~$

Ah TIL! Thanks for correcting me @Animosity022. :+1:

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