Catalina upgrade on other mac causing mount continuous mount/unmount

What is the problem you are having with rclone?

My mac mini which was running mojave until yesterday and stable rclone mount has been upgraded to catalina (same as my work macbook pro) and even using the exact same setup as before and also tested to use the exact same rclone setup as macbook, the mac mini when using the launchd plist keeps retrying to mount the mount(it appears and disappears continuously on the machine). If I run the manual mount command it works fine, so somehow launchctl on this macmini is misbehaving? I have tried a complete fresh install..

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

rclone v1.58.1

  • os/version: darwin 10.15.7 (64 bit)
  • os/kernel: 19.6.0 (x86_64)
  • os/type: darwin
  • os/arch: amd64
  • go/version: go1.17.9
  • go/linking: dynamic
  • go/tags: cmount

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

google drive

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

/usr/local/bin/rclone --config=/Users/Patrick/.config/rclone/rclone.conf mount $mount: /Users/Patrick/$mount --timeout 1h --allow-other --dir-cache-time 5000h --attr-timeout 5000h --poll-interval 10s --drive-pacer-min-sleep 10ms --drive-pacer-burst 1000 --vfs-cache-mode full --vfs-cache-max-size 40G --vfs-cache-max-age 5000h --vfs-cache-poll-interval 5m --vfs-read-ahead 2G --bwlimit-file 32M --daemon --daemon-timeout 599s

The rclone config contents with secrets removed.

[gdrive]
type = drive
scope = drive
token = {"access_token":"xxxx","token_type":"Bearer","refresh_token":"xxxx","expiry":"2022-05-13T13:33:41.780361+09:00"}
client_id = xxxx
client_secret = xxxx
root_folder_id = xxxx

[plex]
type = drive
scope = drive
token = {"access_token":"xxxx,"token_type":"Bearer","refresh_token":"xxxx","expiry":"2022-05-13T13:33:36.710146+09:00"}
client_id = xxxx
client_secret = xxxx
root_folder_id = xxxx

[plex_crypt]
type = crypt
remote = plex:
filename_encryption = standard
directory_name_encryption = true
password = xxxx
password2 = xxxx

[gdrive_crypt]
type = crypt
remote = gdrive:
filename_encryption = standard
directory_name_encryption = true
password = xxxx
password2 = xxx

A log from the command with the -vv flag

2022/05/13 13:00:35 DEBUG : Creating backend with remote "gdrive_crypt:"
2022/05/13 13:00:35 DEBUG : Using config file from "/Users/Patrick/.config/rclone/rclone.conf"
2022/05/13 13:00:35 DEBUG : Creating backend with remote "gdrive:"
2022/05/13 13:00:40 DEBUG : rclone: Version "v1.58.1" finishing with parameters ["/usr/local/bin/rclone" "--config=/Users/Patrick/.config/rclone/rclone.conf" "mount" "gdrive_crypt:" "/Users/Patrick/plex_crypt" "--allow-other" "--timeout=1h" "--dir-cache-time=5000h" "--attr-timeout=5000h" "--poll-interval=10s" "--vfs-cache-mode=full" "--vfs-cache-max-size=40G" "--vfs-cache-max-age=5000h" "--vfs-cache-poll-interval=5m" "--vfs-read-ahead=2G" "--bwlimit-file=32M" "--daemon" "--daemon-timeout=599s" "-vv"]

So, to be clear.
If I run the mount command in a terminal, it works, it mounts the mount fine and it is stable.
But I normally use it in a launchAgent script which is as follow:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>com.epatzie.rclonescript</string>
   <key>ProgramArguments</key>
   <array>
       <string>/Users/Patrick/script/mount.sh</string>
   </array>
   <key>RunAtLoad</key>
   <true/>
   <key>KeepAlive</key>
   <true/>
   <key>StandardErrorPath</key>
   <string>/Users/Patrick/.config/rclone/rclone.err</string>
   <key>StandardOutPath</key>
   <string>/Users/Patrick/.config/rclone/rclone.out</string>
</dict>
</plist>

mount.sh

#!/bin/sh
/Users/Patrick/script/rclonemount.sh plex_crypt 5572
/Users/Patrick/script/rclonemount.sh gdrive_crypt 5573
exit 0

rclonemount.sh

#!/bin/sh
mount=$1
if [[ -z "$mount" || $(grep "$mount" /Users/Patrick/.config/rclone/rclone.conf) != "[$mount]" ]]; then
	echo "no mount specified or not in rclone config"
	exit 1
fi
if [[ ! -d "/Users/Patrick/$mount" ]]; then
	mkdir /Users/Patrick/$mount
fi
if [ ! -z "$(ls -A /Users/Patrick/$mount)" ]; then
	exit 0
fi
port=$2
#/usr/local/bin/rclone --config=/Users/Patrick/.config/rclone/rclone.conf mount $mount: /Users/Patrick/$mount --timeout 1h --allow-other --dir-cache-time 5000h --attr-timeout 5000h --poll-interval 10s --drive-pacer-min-sleep 10ms --drive-pacer-burst 1000 --vfs-cache-mode full --vfs-cache-max-size 40G --vfs-cache-max-age 5000h --vfs-cache-poll-interval 5m --vfs-read-ahead 2G --bwlimit-file 32M --rc --rc-addr :"$port" --rc-no-auth --daemon --daemon-timeout 599s
/usr/local/bin/rclone --config=/Users/Patrick/.config/rclone/rclone.conf mount $mount: /Users/Patrick/$mount --timeout 1h --allow-other --dir-cache-time 5000h --attr-timeout 5000h --poll-interval 10s --drive-pacer-min-sleep 10ms --drive-pacer-burst 1000 --vfs-cache-mode full --vfs-cache-max-size 40G --vfs-cache-max-age 5000h --vfs-cache-poll-interval 5m --vfs-read-ahead 2G --bwlimit-file 32M --daemon --daemon-timeout 599s
#/usr/local/bin/rclone rc vfs/refresh recursive=true --rc-addr :"$port" _async=true
exit 0

the mount fails if I try to use -rc, not sure why, but that is why that version is commented out

when the launchd runs, it will mount and then unmount the folders in rapid succession.. in the rclone.err log it keeps showing the same as above (I modified the mount command to include -vv, only diff from original)

I have tried to use a launchd script that directly uses rclone as below, but it gives the same behaviour

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>KeepAlive</key>
			<true/>
		<key>Label</key>
			<string>com.epatzie.gdrivemount</string>
		<key>ProgramArguments</key>
			<array>
				<string>/usr/local/bin/rclone</string>
				<string>--config=/Users/Patrick/.config/rclone/rclone.conf</string>
				<string>mount</string>
				<string>gdrive_crypt:</string>
				<string>/Users/Patrick/plex_crypt</string>
				<string>--allow-other</string>
				<string>--timeout=1h</string>
				<string>--dir-cache-time=5000h</string>
				<string>--attr-timeout=5000h</string>
				<string>--poll-interval=10s</string>
				<string>--drive-pacer-min-sleep=10ms</string>
				<string>--drive-pacer-burst=1000</string>
				<string>--vfs-cache-mode=full</string>
				<string>--vfs-cache-max-size=40G</string>
				<string>--vfs-cache-max-age=5000h</string>
				<string>--vfs-cache-poll-interval=5m</string>
				<string>--vfs-read-ahead=2G</string>
				<string>--bwlimit-file=32M</string>
				<string>--daemon</string>
				<string>--daemon-timeout=599s</string>
				<string>-vv</string>
			</array>
		<key>RunAtLoad</key>
			<true/>
		<key>StandardErrorPath</key>
			<string>/Users/Patrick/.config/rclone/rclone.err</string>
		<key>StandardOutPath</key>
			<string>/Users/Patrick/.config/rclone/rclone.out</string>
	</dict>
</plist>

using the same script and launchd on my main macbook pro works perfectly fine.
I don't see anything strange in the mac console either..
any help is very appreciated

Try removing this. Maybe launchd is losing track of the rclone process when it daemonises itself.

I don't know exactly how launchd works, but if it is anything like systemd then it will prefer having commands which don't daemonise themselves.

I'll give it a try, would be very strange as it worked perfectly fine like this in the past and on my other machine as I mentioned..

hmm,well, yes, it seems to be working without --daemon..
But I'd love to know WHY? and why the exact same thing works on my mbp running same version,same os..

thanks, will monitor this for a while locally but would love if someone could chime in with details.
thansk

Great

I think it probably shouldn't have worked with --daemon at all, as launchd will think the program had died when it demonizes itself and restart it. Maybe it works on one and not the other due to subtle timing differences between exactly how long the daemonized rclone took to start up.