Rclone system start mount trouble and PMS read trouble

I've been trying to get rclone to mount my goole remote on system startup and have Plex read that mount. Been trying to do this for what feels like an age now.

I'm running everything on Linux Mint 19.2

I've started again from a clean slate as I might have messed things up over the last few days.

I've just done a clean install of rclone and gone through the config to set up a new remote to my google drive.

This is the output of my rclone lsd

clone lsd gdrive:
-1 2019-11-05 13:09:32 -1 .config
-1 2019-11-05 13:09:30 -1 .local
-1 2019-11-05 13:09:29 -1 Desktop
-1 2019-09-29 16:41:36 -1 Movies
-1 2019-09-18 11:31:07 -1 TV
-1 2019-10-21 13:10:58 -1 gdrive

I've created a mount point for the remote and updated the permissions for it.

sudo mkdir /home/christof21/Media

I've gone on to install fuse by following the guide from @Animosity022 and edited /etc/fuse.conf to comment out "user_allow_other"

I can now mount the remote by doing the following "rclone mount gdrive:TV/Chris /home/christof21/Media" and can navigate to those files and run the contents of them fine.

This is where I have then become stuck. I want to have that remote mount on startup and be able to read from it via Plex Media Server.

At the moment I haven't gone any further as this is where I've messed things up in the past. I've not created any other commands or service files.

The below is what happens when I try to set the library up in PMS

It's set up on the corrent path where the remote is mounted. I then just get a screen saying no items in the library.

I've not even got into refining rclone settings at all yet either.

You need to add "--allow-other" to your mount command so the Plex User can read it as well.

1 Like

That seems to have worked for that part so now Plex can actually read the mount :slight_smile: so I'm getting a little further now.

I messed up last time trying to create a .service to have rclone mount on system restart but I don't know where I messed up following different guides

Assuming you have root access on the box, service files are located here:

root@gemini:/etc/systemd# cd system
root@gemini:/etc/systemd/system# ls -al rclone.service
-rw-r--r-- 1 root root 604 Nov  2 08:13 rclone.service

It needs to have the .service on it.

There is a little primer here:

1 Like

I've not created the rclone.service yet as this is what I get from the command

ls: cannot access 'rclone.service': no such file or directory

@Animosity022 I've created the rclone.service and added to /etc/systemd/system using some of your examples from other posts.

[Unit]
Description=RClone Service

[Service]
Type=notify
Environment=RCLONE_CONFIG=/data/rclone/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media
--allow-other
--bind 192.168.1.30
--buffer-size 256M
--dir-cache-time 72h
--drive-chunk-size 32M
--log-level INFO
--log-file /home/christof21/Documents/rclone.log
--umask 002
--vfs-read-chunk-size 128M
--vfs-read-chunk-size-limit off
--rc
ExecStop=/bin/fusermount -uz /home/christof21/Media
Restart=on-failure
User=christof21
Group=christof21

[Install]
WantedBy=multi-user.target

When I run systemctl start rclone I get this error See "systemctl status rclone.service" and "journalctl -xe" for details.

Looking at the systemctl status rclone.service gives me this

rclone.service - RClone Service
Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-11-05 16:06:11 GMT; 30s ago
Process: 6581 ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media --allow-other --bind 192.168.1.30 --buffer-size 256M --dir-cache-time 72h --drive-chunk-size
Main PID: 6581 (code=exited, status=1/FAILURE)

Nov 05 16:06:11 chrisproxmox systemd[1]: rclone.service: Service hold-off time over, scheduling restart.
Nov 05 16:06:11 chrisproxmox systemd[1]: rclone.service: Scheduled restart job, restart counter is at 5.
Nov 05 16:06:11 chrisproxmox systemd[1]: Stopped RClone Service.
Nov 05 16:06:11 chrisproxmox systemd[1]: rclone.service: Start request repeated too quickly.
Nov 05 16:06:11 chrisproxmox systemd[1]: rclone.service: Failed with result 'exit-code'.
Nov 05 16:06:11 chrisproxmox systemd[1]: Failed to start RClone Service.

I'm afraid I'm a bit stuck at this point as it's exhausted my terminal/linux knowledge.

Can you put the script in three backtics (This thing ` )

You put 3 backtics before and after to put a code block around something

like this

and put your service file in that.

You can run

journalctl -u rclone -b

That should show the output of the logs.

Description=RClone Service

[Service]
Type=notify
Environment=RCLONE_CONFIG=/data/rclone/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media \
   --allow-other \
   --bind 192.168.1.30 \
   --buffer-size 256M \
   --dir-cache-time 72h \
   --drive-chunk-size 32M \
   --log-level INFO \
   --log-file /home/christof21/Documents/rclone.log \
   --umask 002 \
   --vfs-read-chunk-size 128M \
   --vfs-read-chunk-size-limit off \
   --rc
ExecStop=/bin/fusermount -uz /home/christof21/Media
Restart=on-failure
User=christof21
Group=christof21

[Install]
WantedBy=multi-user.target
   Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-11-05 16:17:36 GMT; 22min ago
  Process: 829 ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media --allow-other --bind
 Main PID: 829 (code=exited, status=1/FAILURE)

Nov 05 16:17:36 chrisproxmox systemd[1]: Failed to start RClone Service.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Service hold-off time over, scheduling restart.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Scheduled restart job, restart counter is at 5.
Nov 05 16:17:36 chrisproxmox systemd[1]: Stopped RClone Service.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Start request repeated too quickly.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Failed with result 'exit-code'.
Nov 05 16:17:36 chrisproxmox systemd[1]: Failed to start RClone Service.

Can you:

cat /home/christof21/Documents/rclone.log

I get an error

2019/11/05 16:17:35 NOTICE: Config file "/data/rclone/rclone.conf" not found - using defaults
2019/11/05 16:17:35 Failed to create file system for "gdrive:TV/Chris": didn't find section in config file```

You'd need to fix this first.

Where is your rclone config file?

felix@gemini:/etc$ rclone config file
Configuration file is stored at:
/opt/rclone/rclone.conf

ahh ok so mine looks like it's stored at

/home/christof21/.config/rclone/rclone.conf

@Animosity022 I've updated the rclone.service file now to include the above log path

Description=RClone Service

[Service]
Type=notify
Environment=RCLONE_CONFIG=/home/christof21/.config/rclone/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media \
   --allow-other \
   --bind 192.168.1.30 \
   --buffer-size 256M \
   --dir-cache-time 72h \
   --drive-chunk-size 32M \
   --log-level INFO \
   --log-file /home/christof21/Documents/rclone.log \
   --umask 002 \
   --vfs-read-chunk-size 128M \
   --vfs-read-chunk-size-limit off \
   --rc
ExecStop=/bin/fusermount -uz /home/christof21/Media \
Restart=on-failure
User=christof21
Group=christof21

[Install]
WantedBy=multi-user.target

When I do systemctl status rclone I still get this error though

   Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-11-05 16:17:36 GMT; 15h ago
 Main PID: 829 (code=exited, status=1/FAILURE)

Nov 05 16:17:36 chrisproxmox systemd[1]: Failed to start RClone Service.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Service hold-off time over, scheduling restart.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Scheduled restart job, restart counter is at 5.
Nov 05 16:17:36 chrisproxmox systemd[1]: Stopped RClone Service.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Start request repeated too quickly.
Nov 05 16:17:36 chrisproxmox systemd[1]: rclone.service: Failed with result 'exit-code'.
Nov 05 16:17:36 chrisproxmox systemd[1]: Failed to start RClone Service.

And when I repeat this step cat /home/christof21/Documents/rclone.log I still get the below

2019/11/05 16:17:36 NOTICE: Config file "/data/rclone/rclone.conf" not found - using defaults
2019/11/05 16:17:36 Failed to create file system for "gdrive:TV/Chris": didn't find section in config file

After you update the file, you need to run:

systemctl daemon-reload

Which should refresh the file from disk and you can start it after that.

Yeah I tried that this morning and it didn't work and then started poking about in the .service file again.

I ended up removing the --bind 192.168 line as I don't have anything on that IP so removed it.

Changed the Type=to simple and split the -uz on the ExecStop line. Reloaded the daemon and everything seems to work now. Go figure lol

[Unit]
Description=RClone Service
After=rclone.service

[Service]
Type=simple
Environment=RCLONE_CONFIG=/home/christof21/.config/rclone/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive:TV/Chris /home/christof21/Media \
   --allow-other \
   --buffer-size 256M \
   --dir-cache-time 72h \
   --drive-chunk-size 32M \
   --log-level INFO \
   --log-file /home/christof21/Documents/rclone.log \
   --umask 002 \
   --vfs-read-chunk-size 128M \
   --vfs-read-chunk-size-limit off \
   --rc
ExecStop=/bin/fusermount -z -u /home/christof21/Media \
Restart=on-failure
User=christof21
Group=christof21

[Install]
WantedBy=multi-user.target