What is the problem you are having with rclone?
When restarting an rclone mount via systemd, the service doesn't finish starting until the vfs queue fully enumerates. For context, I restarted the service while there were a large number of items in the cache which were previously queued for upload. When troubleshooting, I tailed the log file on the right and a terminal prompt to restart the service on the left. When I issued systemctl start rclone.service
, the command hung while the log started listing all the files still in the vfs cache, noting which items were being queued up. However, the start command never actually finishes, so while rclone is listing vfs queue, systemd times out. The bug here, I believe, is that systemd never actually gets a successful start message from rclone until after the vfs queue list is made. I believe this to be true, since I can manually run the rclone mount+vfs command in the foreground with no issues.
What is your rclone version (output from rclone version
)
1.55.0
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Linux 64 bit - Debian
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
)
rclone.service
[Unit]
Description=Encrypted Vault 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 c-vault: /mnt/cvault \
--allow-other \
--attr-timeout 1000h \
--buffer-size 64M \
--dir-cache-time 20m \
--log-level INFO \
--log-file /opt/rclone/logs/cvault-service.log \
--poll-interval 30s \
--use-mmap \
--tpslimit 10 \
--tpslimit-burst 10 \
--cache-dir=/bufferpool/rclone-cache-cvault \
--vfs-cache-mode writes \
--transfers 1 \
--bwlimit "08:00,1M:off 23:59,off" \
--timeout 1h \
--umask 002 \
--user-agent vaultapp \
--rc \
--rc-addr 127.0.0.1:5573
ExecStop=/bin/fusermount -uz /mnt/cvault
Restart=on-failure
User=root
Group=root
[Install]
WantedBy=multi-user.target
A log from the command with the -vv
flag
After running systemctl start rclone.service
:
2021/05/21 14:28:32 INFO : Starting bandwidth limiter at 1M:offBytes/s
2021/05/21 14:36:03 INFO : Starting transaction limiter: max 10 transactions/s with burst 10
2021/05/21 14:36:03 NOTICE: Serving remote control on http://127.0.0.1:5573/
2021/05/21 14:36:06 INFO : path/to/file: vfs cache: queuing for upload in 5s
...
...
...
(100s of more vfs queue entries)
...
...
2021/05/21 14:30:07 INFO : Starting bandwidth limiter at 1M:offBytes/s
2021/05/21 14:30:07 INFO : Starting transaction limiter: max 10 transactions/s with burst 10
2021/05/21 14:30:07 Failed to start remote control: start server failed: listen tcp 127.0.0.1:5573: bind: address already in use
My systemctl settings cause the service to restart on failure after 5 seconds, which means the service failed after 90 seconds. However, the rclone service is still running (verified with htop) and the port is still in use.
To troubleshoot, I run the command manually in the foreground and everything seems to work just fine.
2021/05/21 14:36:03 INFO : Starting bandwidth limiter at 1M:offBytes/s
2021/05/21 14:36:03 INFO : Starting transaction limiter: max 10 transactions/s with burst 10
2021/05/21 14:36:03 NOTICE: Serving remote control on http://127.0.0.1:5573/
2021/05/21 14:36:06 INFO : path/to/file: vfs cache: queuing for upload in 5s
...
...
...
(100s of more vfs queue entries)
...
...
2021/05/21 14:39:07 INFO : last/file/to/upload: vfs cache: queuing for upload in 5s
As you can see from the real timestamps, the vfs queue list took 3 minutes to complete when manually running the command in the foreground.