Plex - rClone Settings - encrypted Google Drive

@Animosity022
@pontare

Hello,

i was really inspired from the following setup. [my-best-rclone-config-mount-for-plex/7441]

Now i sit here for about 5 hours but i dont get it running.

I really hope that someone can help me out to fix the problem.

I work on Debian and my Plex Server is running without any problems, my normal gDrives working since about 3 years on my other servers without any problems and they are filled with many TB stuff, but right now i am not able to stream cause i have buffering every 15 seconds when i try to stream 4k, so i started searching for better settings with caching.

I googled the settings above, but i dont get it running.

My rclone.conf is the following:
"
[google4-gcache]
type = cache
remote = google4:storage4-cached
plex_url = http://localhost:32400
plex_username = myPlexMail
plex_password = myPlexPassword
chunk_size = 16M
plex_token = myPlexToken
db_path = /mnt/rclone-cache
chunk_path = /mnt/rclone-cache
info_age = 2d
chunk_total_size = 10G
db_purge = true

[google4]
type = drive
scope = drive
token = MyGoogleDriveToken
use_trash = false
chunk_size = 16M

[storage4-cached]
type = crypt
remote = google4:storage4
filename_encryption = standard
directory_name_encryption = true
password = MyFirstPassword
password2 = MySecondPassword
"

I set the stuff above up, then i started creating my rclone.sevice file and placed it into: "/etc/systemd/system"
"
[Service]
Description=Google Drive (rclone)
AssertPathIsDirectory=/mnt/google-drive/storage4
After=plexdrive.service

[Service]
ExecStart=/usr/bin/rclone mount google4-gcache: /mnt/cloud_drive/storage4 \
--config=/root/.config/rclone/rclone.conf \
--allow-other \
--buffer-size 128M \
--dir-cache-time 72h \
--log-level INFO \
--log-file /root/plex_cache_mount.log \
--cache-chunk-path=/mnt/rclone-cache \
--cache-db-path=/mnt/rclone-cache \
--poll-interval 15s \
--timeout 1h \
--bind 127.0.0.1 \
--gid=1000 \
--uid=1000 \
--umask 002 \
--fast-list

[Install]
WantedBy=default.target

"

I tried running it with "systemctl rclone start" and i get it "running".

Whatever i tried i got the following errors In the logfile, i never got access to my encrypted drive.
Last error log i post here:
"2020/04/15 00:09:41 Failed to create file system for "storage-gcache:": didn't find section in config file
2020/04/15 00:10:04 ERROR : plex: websocket.Dial ws://localhost:32400/:/websockets/notifications?X-Plex-Token=myPlexToken: bad status
2020/04/15 00:10:04 INFO : google4-gcache: Cache DB path: /mnt/rclone-cache/google4-gcache.db
2020/04/15 00:10:04 INFO : google4-gcache: Cache chunk path: /mnt/rclone-cache/google4-gcache
2020/04/15 00:10:04 INFO : google4-gcache: Chunk Memory: true
2020/04/15 00:10:04 INFO : google4-gcache: Chunk Size: 16M
2020/04/15 00:10:04 INFO : google4-gcache: Chunk Total Size: 10G
2020/04/15 00:10:04 INFO : google4-gcache: Chunk Clean Interval: 1m0s
2020/04/15 00:10:04 INFO : google4-gcache: Workers: 4
2020/04/15 00:10:04 INFO : google4-gcache: File Age: 2d
2020/04/15 00:10:04 INFO : Google drive root 'storage4-cached': Failed to get StartPageToken: Get https://www.googleapis.com/drive/v3/changes/startPageToken?alt=json&prettyPrint=false&supportsAllDrives=true: dial tcp 127.0.0.1:0->172.xxx.xx.xx:443: connect: invalid argument

About my setup.

Following specs are on this server:
root@hostname ~ # cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

I have the following specs on my dedicated server:
x64 Operating System
AMD Opteron(tm) Processor 6172 - 2*12 Cores
RAM: 24 GB
Connection: 1Gbit
rClone Version:
root@hostname ~ # rclone --version
rclone v1.51.0

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

Thank you in advance and sorry for my bad english, i am not a native speaker.

Best Regards,
rode

hello and welcome to the forum,

you are using a old version of rclone, please update.

it is best to use the question template, when posting, as you would have been asked

What is the problem you are having with rclone?

What is your rclone version (output from rclone version)

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

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

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

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

Sorry, i copied wrong version in (now corrected), i am running the latest version on that server.

I think i filled out all your questions.

Best Regards,
rode

Hello,

i already checked it, i cant find the mistake. Help me out please.

2020/04/15 01:34:35 Failed to create file system for "google4-gcache:": failed to make remote google4:storage-cached to wrap: couldn't find root directory ID: Get https://www.googleapis.com/drive/v3/files/root?alt=json&fields=id&prettyPrint=false&supportsAllDrives=true: Post https://oauth2.googleapis.com/token: dial tcp 127.0.0.1:0->216.xx.xxx.xxx:443: connect: invalid argument

You don't want to bind to your loopback adapter as traffic has nowhere to go. You should remove that.

Does nothing on a mount and can be removed.

Thank you for your respone, i removed both commands from my rclone.service file.

"
The result on "plex_cache_mount.log" is the following:
2020/04/15 02:24:39 Failed to create file system for "google4-gcache:": failed to make remote google4:storage4-cached to wrap: couldn't find root directory ID: Get ####://www.googleapis.com/drive/v3/files/root?alt=json&fields=id&prettyPrint=false&supportsAllDrives=true: Post https://oauth2.googleapis.com/token: dial tcp 127.0.0.1:0->172.xxx.x.xxx:443: connect: invalid argument
2020/04/15 02:24:42 ERROR : plex: websocket.Dial ws://localhost:32400/:/websockets/notifications?X-Plex-Token=myPlexToken: bad status
2020/04/15 02:24:42 INFO : google4-gcache: Cache DB path: /mnt/rclone-cache/google4-gcache.db
2020/04/15 02:24:42 INFO : google4-gcache: Cache chunk path: /mnt/rclone-cache/google4-gcache
2020/04/15 02:24:42 INFO : google4-gcache: Chunk Memory: true
2020/04/15 02:24:42 INFO : google4-gcache: Chunk Size: 16M
2020/04/15 02:24:42 INFO : google4-gcache: Chunk Total Size: 10G
2020/04/15 02:24:42 INFO : google4-gcache: Chunk Clean Interval: 1m0s
2020/04/15 02:24:42 INFO : google4-gcache: Workers: 4
2020/04/15 02:24:42 INFO : google4-gcache: File Age: 2d
"

Any idea ?

You still have something running that's bound your to your loopback. Did you refresh systemd after making your changes?

systemctl daemon-reload

Hello,

yes i always have to sytemctl daemon-reload, otherwise i cant start rclone.service again without an error.

So i alway do:
systemctl stop rclone
systemctl daemon-reload
systemctl start rclone

I tried it with a reboot, but really nothing helps right now.

You have something else going on then. You only need to daemon-reload when you change the file as that re-reads the files from disk as they were loaded into memory before.

The error is saying that rclone can't get out to the internet to make a connection to Google as it's showing your loopback adapter for the connection, which seems odd.

Thank you for your advice, i will try this tomorrow/next days again with disabled fail2ban, but i dont think thats the problem at all cause it only blocks incoming bruteforce and not outgoing traffic. When i mounted my Google Drive (rClone encrypted) drive without cache, all was working fine, my streaming was okay, just at 4k ist started with problems, so i thought to give it a try with cache settings.

The connection is definitly open cause this plex running on a proxmox host, all other vm's running really smooth since about 2 years, thats the reason i started a thread here, i have actually no idea anymore what the problem could be.

I thought maybe something in my rclone.conf or rclone.service is wrong or with the soft/hardlinks is wrong, i am really at the end today.

Cache wouldn't really impact 4k streaming or not as if something wasn't working without it, it most likely won't work with the cache either. I stream very high bitrate 4k without cache as it's dependent on a number of factors.

Hm,

i guess my server is not that bad at all, that was the reason i started to search for a solution at all and i am sure right now you are my most searched person in google cause i am sure i tried everything i seen in your comments.

The thing is, my working mounts i started with direct commands in shell or with an automount script, maybe there is a difference ? Today first time I tried it with the rclone.service part.

My usual mount commands manually or in an x.sh script@reboot are:
rclone mount --log-file /home/my_user/1_logs/cloud_mount/storage.log --log-level INFO --allow-other --drive-chunk-size 16M --dir-cache-time 168h storage: /home/cloud_drive/storage &

I tried a lot, i changed nearly every parameter to try, but i really had bad buffering, then i started with adding cache parameters and it was not perfect, but i seen there was something working better, so i thought "okay, lets give it a try with cache mount". Could you post your personal mount or update your github to your working/mount settings right now? Last days i had some time, so i started playing around and creating autoupload scripts from my seedbox to another dedicated server, which is auto_uploading files to my encrypted rClone (GDrive) mount. Now i got this working, but hanging on the streaming server.

Thank you in advance for your really really really fast response in this forum

Regards,
rode

The challenge with Plex/Emby and playing 4k content is there are a lot of factors that go into it and it's very dependent on your devices and what you use to play.

You can't necessarily tune away some of the situations that you get into.

When you are playing the 4k content is it direct playing / streaming or transcoding? Are you using any subtitles?

I have my settings here:

I normally use FireTV 4K Sticks to play it, so i need transcoding on the server itself for this i took the not virtualized 24 core server which should be able to transcode a stream. When i start a 4k Movie (90 GB File) without cache settings, the fire tv buffering about 10 seconds, then it start and play around 2 Minutes or something then buffering for about 10 seconds and it goes on.

Files up to ~ 35-40 GB running without buffering, perfectly.

By the way, what exactly makes the difference with using "own-client-id" ?

The default rclone client ID tends to be over subscribed so making your own client ID gets around that. You do see errors in the logs if you have that issue.

You use the word "should" here so you'd want to check to make sure you aren't having any server bottlenecks. The number of cores doesn't matter much as you need enough CPU power to do the job which requires a higher end CPU.

You also want to make sure you have enough network bandwidth to play what you are trying to play as it does sound like you might be hitting a cap there with larger files.

Hello,

sorry for that delay, but i have lot to do privat.

I tried it on another server with simple mount command and just with the following:
rclone mount --dir-cache-time=160h --buffer-size 1024M --umask 002 --rc --log-level INFO --log-file /blabla/ storagegc2: /blabla/ &

It seems like buffering is much more better, when i run a 90 GB file, i just need to wait some seconds in pause mode to get a little advantage in buffering. Not perfekt, but right now acceptable.

@Animosity022
My next question is, how can i create the following file and how is it working ? I really dont understand while googeling.

It's mounting a mount, i understand, but what does Environment stuff means, what does Type=simple means, what does ExecStartPre=bla bla bla means and what does ExecStop "rmdir" + WantedBy=multi-user.target means ?

Where i have to place this file and how can i activate it ?

Right now i just used my mount command in an bash.sh script, and let it run at reboot over crontab.

Description=Mount and cache Google drive to /media/Gsuite

After=syslog.target local-fs.target network.target

[Service]

Environment=RCLONEHOME=/home/XXX/.config/rclone

Environment=MOUNTTO=/media/Gsuite

Environment=LOGS=/home/XXX/rclone/logs1

Environment=UPLOADS=/home/XXX/rclone/uploads1

Type=simple

User=root

ExecStartPre=/bin/mkdir -p ${MOUNTTO}

ExecStartPre=/bin/mkdir -p ${LOGS}

ExecStartPre=/bin/mkdir -p ${UPLOADS}

ExecStart=/usr/bin/rclone mount \

--log-file ${LOGS}/rclone.log
--log-level INFO
--cache-dir ${UPLOADS}
--config ${RCLONEHOME}/rclone.conf \

Gsuite: ${MOUNTTO}

ExecStop=/bin/fusermount -u -z ${MOUNTTO}

ExecStop=/bin/rmdir ${MOUNTTO}

Restart=always

[Install]

WantedBy=multi-user.target

You may want to check out something like:

As your questions are all related around systemd.

1 Like

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