RClone seems unable to use background mode as intended

What is the problem you are having with rclone?

Hey there!

I'm a bit green around rclone, so sorry in advance if I missed something obvious.
I'm trying to use rclone to mount some specific OneDrive Personal folders to mapped directories for my Plex docker container, but I've been hitting a few snags along the way of getting it to work as intended.

Daemon mode seems not to be able to cleanly exit after mounting the FUSE fs, leading to scripting getting stuck at the first line. I have attached said commands and script just to be sure, but at least when running in foreground mode, I'm able to nano several of the .srt text files and even playback videos after restarting the container.

Trying to run the command from outside the script just leads to long wait times however, as in 6 hours and counting without ever getting out of line 2.

If anyone could lend me a hand I'd greatly appreciate it.

Script file used to call rclone

#!/bin/sh /etc/rc.common
START=10
STOP=15
 
start() {        
        echo start
        # commands to launch application
        rclone mount --daemon --syslog --syslog-facility KERN --attr-timeout 8700h --dir-cache-time 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cache-mode writes OneDrive:/Videos/Movies /etc/plex/movies/
	rclone mount --daemon --syslog --syslog-facility KERN --attr-timeout 8700h --dir-cache-time 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cache-mode writes OneDrive:/Music /etc/plex/music/
	rclone mount --daemon --syslog --syslog-facility KERN --attr-timeout 8700h --dir-cache-time 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cache-mode writes OneDrive:/Pictures /etc/plex/photos/
	rclone mount --daemon --syslog --syslog-facility KERN --attr-timeout 8700h --dir-cache-time 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cache-mode writes OneDrive:/Videos/Series /etc/plex/tvseries/
	docker restart Plex
}                 
 
stop() {          
        echo stop
        # commands to kill application
        fusermount -u /etc/plex/movies/
        fusermount -u /etc/plex/music/
        fusermount -u /etc/plex/photos/
        fusermount -u /etc/plex/tvseries/
        docker restart Plex 
}

The commands used to call for rclone end up being the following as to be able to use it with LuCI:

service rclone-mounts enable
service rclone-mounts start
service rclone-moounts stop

Calling for start gets the script stuck at line 8 (thus only mounting the Movies folder), though it seems to be actually mounting the volume since I'm able to open files at the destination mount, they are not shown using ls -la.

Calling stop works as expected, with the rare exception of sometimes sending a Device or resource busy error, but either rebooting or waiting a bit tends to solve these problems.

What is your rclone version (output from rclone version)

rclone v1.56.0

  • os/version: openwrt SNAPSHOT (64 bit)
  • os/kernel: 5.4.138 (aarch64)
  • os/type: linux
  • os/arch: arm64
  • go/version: go1.16.5
  • go/linking: static
  • go/tags: none

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

OpenWrt SNAPSHOT r17311-7057e05485 for Raspberry Pi 4B running in 64 bit mode (aarch64)

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

OneDrive Personal (Office 365 Home subscription)

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

Command in script:

rclone mount --daemon --syslog --syslog-facility KERN --attr-timeout 8700h --dir-cache-time 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cache-mode writes OneDrive:/Videos/Movies /etc/plex/movies/

Command for debugging:

rclone mount --daemon -vvv --log-file=/etc/rclone/daemon.log --attr-timeout 8700h --dir-cache-ti
me 8760h --vfs-cache-max-age 8760h --poll-interval 30s --allow-other --vfs-cache-max-size 24G --vfs-cache-poll-interval 20m --vfs-cach
e-mode writes OneDrive:/Videos/Movies /etc/plex/movies/

The rclone config contents with secrets removed.

[OneDrive]
type = onedrive
token = {REDACTED}
drive_id = REDACTED
drive_type = personal

A log from the command with the -vv flag

2021/08/18 13:39:16 Can't use --syslog and --log-file together
2021/08/18 13:40:01 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "mount" "--daemon" "-vv" "--log-file=/etc/rclone/daemon.log" "--attr-timeout" "8700h" "--dir-cache-time" "8760h" "--vfs-cache-max-age" "8760h" "--poll-interval" "30s" "--allow-other" "--vfs-cache-max-size" "24G" "--vfs-cache-poll-interval" "20m" "--vfs-cache-mode" "writes" "OneDrive:/Videos/Movies" "/etc/plex/movies/"]
2021/08/18 13:40:01 DEBUG : Creating backend with remote "OneDrive:/Videos/Movies"
2021/08/18 13:40:01 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2021/08/18 13:40:01 DEBUG : OneDrive: Loaded invalid token from config file - ignoring
2021/08/18 13:40:02 DEBUG : Saving config "token" in section "OneDrive" of the config file
2021/08/18 13:40:02 DEBUG : OneDrive: Saved new token in config file
2021/08/18 13:40:03 DEBUG : fs cache: renaming cache item "OneDrive:/Videos/Movies" to be canonical "OneDrive:Videos/Movies"
2021/08/18 13:40:03 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "mount" "--daemon" "-vv" "--log-file=/etc/rclone/daemon.log" "--attr-timeout" "8700h" "--dir-cache-time" "8760h" "--vfs-cache-max-age" "8760h" "--poll-interval" "30s" "--allow-other" "--vfs-cache-max-size" "24G" "--vfs-cache-poll-interval" "20m" "--vfs-cache-mode" "writes" "OneDrive:/Videos/Movies" "/etc/plex/movies/"]
2021/08/18 13:40:03 DEBUG : Creating backend with remote "OneDrive:/Videos/Movies"
2021/08/18 13:40:03 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2021/08/18 13:40:05 DEBUG : fs cache: renaming cache item "OneDrive:/Videos/Movies" to be canonical "OneDrive:Videos/Movies"
2021/08/18 13:40:05 INFO  : One drive root 'Videos/Movies': poll-interval is not supported by this remote
2021/08/18 13:40:05 DEBUG : vfs cache: root is "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:40:05 DEBUG : vfs cache: metadata root is "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:40:05 DEBUG : Creating backend with remote "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:40:05 DEBUG : One drive root 'Videos/Movies': Mounting on "/etc/plex/movies/"
2021/08/18 13:40:05 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2021/08/18 13:40:05 DEBUG : : Root: 
2021/08/18 13:40:05 DEBUG : : >Root: node=/, err=<nil>
2021/08/18 13:58:39 INFO  : Signal received: interrupt
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10e5d58]

goroutine 60 [running]:
github.com/rclone/rclone/cmd/mountlib.(*MountPoint).Wait.func1.1()
	github.com/rclone/rclone/cmd/mountlib/mount.go:256 +0x48
sync.(*Once).doSlow(0x4000a4cae0, 0x400010be08)
	sync/once.go:68 +0x11c
sync.(*Once).Do(...)
	sync/once.go:59
github.com/rclone/rclone/cmd/mountlib.(*MountPoint).Wait.func1()
	github.com/rclone/rclone/cmd/mountlib/mount.go:254 +0x5c
github.com/rclone/rclone/lib/atexit.Run.func1()
	github.com/rclone/rclone/lib/atexit/atexit.go:104 +0x70
sync.(*Once).doSlow(0x272a8a0, 0x17f96b8)
	sync/once.go:68 +0x11c
sync.(*Once).Do(...)
	sync/once.go:59
github.com/rclone/rclone/lib/atexit.Run()
	github.com/rclone/rclone/lib/atexit/atexit.go:102 +0xd4
github.com/rclone/rclone/lib/atexit.Register.func1.1()
	github.com/rclone/rclone/lib/atexit/atexit.go:52 +0xc4
created by github.com/rclone/rclone/lib/atexit.Register.func1
	github.com/rclone/rclone/lib/atexit/atexit.go:44 +0xa0
2021/08/18 13:58:53 DEBUG : vfs cache: cleaner exiting
2021/08/18 13:58:53 DEBUG : rclone: Version "v1.56.0" finishing with parameters ["rclone" "mount" "--daemon" "-vv" "--log-file=/etc/rclone/daemon.log" "--attr-timeout" "8700h" "--dir-cache-time" "8760h" "--vfs-cache-max-age" "8760h" "--poll-interval" "30s" "--allow-other" "--vfs-cache-max-size" "24G" "--vfs-cache-poll-interval" "20m" "--vfs-cache-mode" "writes" "OneDrive:/Videos/Movies" "/etc/plex/movies/"]
2021/08/18 13:59:05 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "mount" "--daemon" "-vvv" "--log-file=/etc/rclone/daemon.log" "--attr-timeout" "8700h" "--dir-cache-time" "8760h" "--vfs-cache-max-age" "8760h" "--poll-interval" "30s" "--allow-other" "--vfs-cache-max-size" "24G" "--vfs-cache-poll-interval" "20m" "--vfs-cache-mode" "writes" "OneDrive:/Videos/Movies" "/etc/plex/movies/"]
2021/08/18 13:59:05 DEBUG : Creating backend with remote "OneDrive:/Videos/Movies"
2021/08/18 13:59:05 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2021/08/18 13:59:06 DEBUG : fs cache: renaming cache item "OneDrive:/Videos/Movies" to be canonical "OneDrive:Videos/Movies"
2021/08/18 13:59:06 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "mount" "--daemon" "-vvv" "--log-file=/etc/rclone/daemon.log" "--attr-timeout" "8700h" "--dir-cache-time" "8760h" "--vfs-cache-max-age" "8760h" "--poll-interval" "30s" "--allow-other" "--vfs-cache-max-size" "24G" "--vfs-cache-poll-interval" "20m" "--vfs-cache-mode" "writes" "OneDrive:/Videos/Movies" "/etc/plex/movies/"]
2021/08/18 13:59:06 DEBUG : Creating backend with remote "OneDrive:/Videos/Movies"
2021/08/18 13:59:06 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2021/08/18 13:59:08 DEBUG : fs cache: renaming cache item "OneDrive:/Videos/Movies" to be canonical "OneDrive:Videos/Movies"
2021/08/18 13:59:08 INFO  : One drive root 'Videos/Movies': poll-interval is not supported by this remote
2021/08/18 13:59:08 DEBUG : vfs cache: root is "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:59:08 DEBUG : vfs cache: metadata root is "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:59:08 DEBUG : Creating backend with remote "/root/.cache/rclone/vfs/OneDrive/Videos/Movies"
2021/08/18 13:59:08 DEBUG : One drive root 'Videos/Movies': Mounting on "/etc/plex/movies/"
2021/08/18 13:59:08 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2021/08/18 13:59:08 DEBUG : : Root: 
2021/08/18 13:59:08 DEBUG : : >Root: node=/, err=<nil>

hello and welcome to the forum,

there is a known issue with --daemon and v1.56.0.
i also had segmentation violation with my pi4b, tho running ubuntu server 64bit

https://forum.rclone.org/t/daemon-mode-not-working/25601/3

1 Like

Oh, I see.

I guess in the meantime I'll try cross-compling from the main branch.

Thanks for the help!

or use v1.55.1, which is stable.
i tend to run paranoid so i am always one version behind...

1 Like

Even better then!

Probably should take that advice more frequently, I'll go ahead and do that then.

Thanks!

1 Like

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