When configuring rclone-drive.service, an error keeps appearing

I can't see anything wrong with that service file as when I paste it in, it works on my server.

Can you try one more thing:

cat -vet /etc/systemd/system/drive-rclone.service

and paste in the full output.

[root@racknerd-908778 ~]# cat -vet /etc/systemd/system/drive-rclone.service
cat: /etc/systemd/system/drive-rclone.service: 没有那个文件或目录
[root@racknerd-908778 ~]# cat -vet /etc/systemd/system/rclone-drive.service
M-oM-;M-?[Unit]$
Description=RClone Service$
Wants=network-online.target$
After=network-online.target$
$
[Service]$
Type=notify$
KillMode=none$
RestartSec=5$
ExecStart=/usr/bin/rclone mount plex: /home/gdrive \$
--dir-cache-time 5000h \$
# 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 50G \$
# 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 \$
# Add read ahead buffer to network latency issues$
--vfs-read-ahead 2G \$
# 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=/usr/bin/fusermount -uz /home/gdrive$
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[root@racknerd-908778 ~]# 

There we go.

On your first line, you have some garbage.

You want to delete that line and retype it.

A good file with no garbage looks like:

root@gemini:/opt/homescripts/systemd# cat rclone-drive.service -vet
[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 gcrypt: /GD \$
# 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 \$
# Add read ahead buffer to network latency issues$
--vfs-read-ahead 2G \$
# 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 /GD$
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true$
Restart=on-failure$
User=felix$
Group=felix$
$
[Install]$
WantedBy=multi-user.target$

Don't type in the $ as those are just returns that print out via the -vet cat command.

I have done as you said, but still can't start.

[root@racknerd-908778 ~]# cat -vet /etc/systemd/system/rclone-drive.service
[Unit]$
Description=RClone Service$
Wants=network-online.target$
After=network-online.target$
$
[Service]$
Type=notify$
KillMode=none$
RestartSec=5$
ExecStart=/usr/bin/rclone mount plex: /home/gdrive \$
--dir-cache-time 5000h \$
# 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 50G \$
# 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 \$
# Add read ahead buffer to network latency issues$
--vfs-read-ahead 2G \$
# 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=/usr/bin/fusermount -uz /home/gdrive$
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$
[root@racknerd-908778 ~]# systemctl daemon-reload
[root@racknerd-908778 ~]# systemctl start rclone-drive.service
Failed to start rclone-drive.service: Unit is not loaded properly: Bad message.
See system logs and 'systemctl status rclone-drive.service' for details.
[root@racknerd-908778 ~]# systemctl status rclone-drive.service -l
● rclone-drive.service - RClone Service
   Loaded: error (Reason: Bad message)
   Active: inactive (dead)

12月 14 10:49:14 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 10:49:31 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:00:43 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:01:12 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:01:34 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:01:34 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:01:34 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:01:39 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:03:41 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
12月 14 11:03:45 racknerd-908778 systemd[1]: [/etc/systemd/system/rclone-drive.service:11] Missing '='.
[root@racknerd-908778 ~]# 

Let's backtrack a bit.

As root, does this work?

/usr/bin/rclone mount plex: /home/gdrive \
--dir-cache-time 5000h \
--log-level NOTICE \
--poll-interval 10s \
--umask 002 \
--user-agent someappname101 \
--rc \
--rc-addr :5572 \
--rc-no-auth \
--cache-dir=/tmp/cache \
--drive-pacer-min-sleep 10ms \
--drive-pacer-burst 200 \
--vfs-cache-mode full \
--vfs-cache-max-size 50G \
--vfs-cache-max-age 5000h \
--vfs-cache-poll-interval 5m \
--vfs-read-ahead 2G \
--bwlimit-file 32M

It can be mounted, but the command will not exit after completion, it just keeps running. After the forced stop, the mount is gone.

Right. That's fine.

I wanted to validate the mount command itself was good and we did that.

Your last service file looks good to me as I don't see any odd characters/spaces/funkiness going on so I need to peer at it a little longer and see if something jumps out.

My file is from Ubuntu/Debian and you are on CentOS which is also systemd so (in theory) should work but not sure if some flag is tripping it up but the error message isn't helpful as it's complaining about a = which we fixed.

I have been accustomed to using centos, I can reinstall Ubuntu/Debian to try, but it will take a long time.

I'm not asking you to change anything, just clarifying it is a difference as systemd should work the same on both.

What should I do now? Create a screen and then manually mount it?

You can add --daemon on the end like:

/usr/bin/rclone mount plex: /home/gdrive \
--dir-cache-time 5000h \
--log-level NOTICE \
--poll-interval 10s \
--umask 002 \
--user-agent someappname101 \
--rc \
--rc-addr :5572 \
--rc-no-auth \
--cache-dir=/tmp/cache \
--drive-pacer-min-sleep 10ms \
--drive-pacer-burst 200 \
--vfs-cache-mode full \
--vfs-cache-max-size 50G \
--vfs-cache-max-age 5000h \
--vfs-cache-poll-interval 5m \
--vfs-read-ahead 2G \
--bwlimit-file 32M \
--daemon

That's run in the background for now.

I can use the above parameters to receive the mount, but after adding --daemon, it cannot be mounted.

[root@racknerd-908778 ~]# /usr/bin/rclone mount plex: /home/gdrive \
> --dir-cache-time 5000h \
> --log-level NOTICE \
> --poll-interval 10s \
> --umask 002 \
> --user-agent someappname101 \
> --rc \
> --rc-addr :5572 \
> --rc-no-auth \
> --cache-dir=/tmp/cache \
> --drive-pacer-min-sleep 10ms \
> --drive-pacer-burst 200 \
> --vfs-cache-mode full \
> --vfs-cache-max-size 50G \
> --vfs-cache-max-age 5000h \
> --vfs-cache-poll-interval 5m \
> --vfs-read-ahead 2G \
> --bwlimit-file 32M \
> --daemon
2021/12/14 12:18:58 NOTICE: Serving remote control on http://[::]:5572/
2021/12/14 12:19:58 Fatal error: mount not ready
[root@racknerd-908778 ~]# 

I'm not sure I'm versed enough in CentOS to figure out what's going on with your setup.

That file you shared works perfect on Ubuntu 20.04 LTS system.

You can mount it from the command line.
--daemon doesn't work though.
The kernel is a 3.x kernel which is the default on CentOS7.

I'd probably take it down to something much simpler.

[Unit]
Description=rclone service
After=network.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount plex: /home/gdrive 

[Install]
WantedBy=multi-user.target

Test and validate if that works or not.

[root@racknerd-908778 ~]# systemctl daemon-reload
[root@racknerd-908778 ~]# systemctl start rclone-drive.service
[root@racknerd-908778 ~]# systemctl status rclone-drive.service -l
● rclone-drive.service - rclone service
   Loaded: loaded (/etc/systemd/system/rclone-drive.service; disabled; vendor preset: disabled)
   Active: active (running) since 二 2021-12-14 12:43:42 EST; 18s ago
 Main PID: 31084 (rclone)
    Tasks: 8
   Memory: 13.3M
   CGroup: /system.slice/rclone-drive.service
           └─31084 /usr/bin/rclone mount plex: /home/gdrive

12月 14 12:43:41 racknerd-908778 systemd[1]: Starting rclone service...
12月 14 12:43:42 racknerd-908778 systemd[1]: Started rclone service.

wow,it can work!!!!

So I'd slowly add things back in.

Put back in ExecStop and validate you can stop/start it.

ExecStop=/usr/bin/fusermount -uz /home/gdrive

and then I'd slowly add in things and see what breaks it.

[root@racknerd-908778 ~]# systemctl daemon-reload
[root@racknerd-908778 ~]# systemctl start rclone-drive.service
[root@racknerd-908778 ~]# systemctl status rclone-drive.service -l
● rclone-drive.service - rclone service
   Loaded: loaded (/etc/systemd/system/rclone-drive.service; disabled; vendor preset: disabled)
   Active: active (running) since 二 2021-12-14 12:43:42 EST; 9min ago
 Main PID: 31084 (rclone)
   CGroup: /system.slice/rclone-drive.service
           └─31084 /usr/bin/rclone mount plex: /home/gdrive

12月 14 12:43:41 racknerd-908778 systemd[1]: Starting rclone service...
12月 14 12:43:42 racknerd-908778 systemd[1]: Started rclone service.
12月 14 12:46:59 racknerd-908778 systemd[1]: Current command vanished from the unit file, execution of the command list won't be resumed.
[root@racknerd-908778 ~]# 

It seems that there was an error. My computer is out of power, so I have to start again tomorrow. After counting the time difference, we can continue the discussion tomorrow night!

Tomorrow I will slowly add things to see what is causing the error

I seem to already know what it means. I have been adding things slowly, and the first error occurred when adding users.
This is the configuration before there was no error!

[Unit]
Description=rclone service
After=network.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount plex: /home/gdrive \
--dir-cache-time 5000h \
--log-level NOTICE \
--poll-interval 10s \
--umask 002 \
--user-agent someappname101 \
--rc \
--rc-addr :5572 \
--rc-no-auth \
--cache-dir=/tmp/cache \
--drive-pacer-min-sleep 10ms \
--drive-pacer-burst 200 \
--vfs-cache-mode full \
--vfs-cache-max-size 50G \
--vfs-cache-max-age 5000h \
--vfs-cache-poll-interval 5m \
--vfs-read-ahead 2G \
--bwlimit-file 32M
ExecStop=/usr/bin/fusermount -uz /home/gdrive
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
[Install]
WantedBy=multi-user.target

When i added the user

User=ying
Group=users

error

[root@racknerd-908778 ~]# systemctl status rclone-drive.service -l
● rclone-drive.service - rclone service
   Loaded: loaded (/etc/systemd/system/rclone-drive.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since 五 2021-12-17 02:16:54 EST; 4s ago
  Process: 22950 ExecStop=/usr/bin/fusermount -uz /home/gdrive (code=exited, status=1/FAILURE)
  Process: 23016 ExecStart=/usr/bin/rclone mount plex: /home/gdrive --dir-cache-time 5000h --log-level NOTICE --poll-interval 10s --umask 002 --user-agent someappname101 --rc --rc-addr :5572 --rc-no-auth --cache-dir=/tmp/cache --drive-pacer-min-sleep 10ms --drive-pacer-burst 200 --vfs-cache-mode full --vfs-cache-max-size 50G --vfs-cache-max-age 5000h --vfs-cache-poll-interval 5m --vfs-read-ahead 2G --bwlimit-file 32M (code=exited, status=1/FAILURE)
 Main PID: 23016 (code=exited, status=1/FAILURE)

12月 17 02:16:54 racknerd-908778 systemd[1]: Failed to start rclone service.
12月 17 02:16:54 racknerd-908778 systemd[1]: Unit rclone-drive.service entered failed state.
12月 17 02:16:54 racknerd-908778 systemd[1]: rclone-drive.service failed.
12月 17 02:16:54 racknerd-908778 systemd[1]: rclone-drive.service holdoff time over, scheduling restart.
12月 17 02:16:54 racknerd-908778 systemd[1]: Stopped rclone service.
12月 17 02:16:54 racknerd-908778 systemd[1]: start request repeated too quickly for rclone-drive.service
12月 17 02:16:54 racknerd-908778 systemd[1]: Failed to start rclone service.
12月 17 02:16:54 racknerd-908778 systemd[1]: Unit rclone-drive.service entered failed state.
12月 17 02:16:54 racknerd-908778 systemd[1]: rclone-drive.service failed.

This is my user information

[root@racknerd-908778 ~]# id ying
uid=544(ying) gid=100(users) 组=100(users),995(docker)

I don’t want to mount as root, because some applications cannot read the directory!

You can run the service as root. Inside the mounting flags give the permission user& group id like:

--uid your_user_number_comes_here \
--gid your_group_number_comes_here \