Systemd service crashes when I start my OS (Manjaro).
I put around 5GB files into a mounted folder, sync started, before finish I reboot the system, thought that it would continue syncing since I'm using a cache directory.
But the systemd service crashes. journalctl shows several unsuccesfull file syncs and timeout:
systemd[1]: rclone.service: Consumed 7min 32.555s CPU time.
and it deactivates the service.
During the timeout some traffic is generated from the rclone process, I assume it tried to upload all files but since timeout is not enough the service terminates the process.
I guess I need to continue the process but same time not crash the service and mount the folder, but how can it be
What is your rclone version (output from rclone version)
rclone v1.56.2
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)
Log goes on like this even now, indexing and uploading files, after filling 20mb I turn off logging, it goes on...
This is log from journalctl -xeu:
Nov 07 15:00:25 xxx systemd[1]: Starting rclone gdrive mount...
░░ Subject: A start job for unit rclone.service has begun execution
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit xxx.service has begun execution.
░░
░░ The job identifier is 24299.
Nov 07 15:01:55 xxx systemd[1]: rclone.service: start operation timed out. Terminating.
Nov 07 15:01:55 xxx systemd[1]: rclone.service: Failed with result 'timeout'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ The unit rclone.service has entered the 'failed' state with result 'timeout'.
Nov 07 15:01:55 xxx systemd[1]: Failed to start rclone gdrive mount.
░░ Subject: A start job for unit rclone.service has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit rclone.service has finished with a failure.
░░
░░ The job identifier is 24299 and the job result is failed.
Nov 07 15:01:55 xxx systemd[1]: rclone.service: Consumed 1.931s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ The unit rclone.service completed and consumed the indicated resources.
Nov 07 15:02:06 xxx systemd[1]: rclone.service: Scheduled restart job, restart counter is at 190.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ Automatic restarting of the unit rclone.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Nov 07 15:02:06 xxx systemd[1]: Stopped rclone gdrive mount.
░░ Subject: A stop job for unit rclone.service has finished
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A stop job for unit rclone.service has finished.
░░
░░ The job identifier is 24398 and the job result is done.
Nov 07 15:02:06 xxx systemd[1]: rclone.service: Consumed 1.931s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ The unit rclone.service completed and consumed the indicated resources.
Nov 07 15:02:06 xxx systemd[1]: Starting rclone gdrive mount...
░░ Subject: A start job for unit rclone.service has begun execution
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit rclone.service has begun execution.
░░
░░ The job identifier is 24398.
The log file is full of PII, there is no any kind of error, failure in the log file, only similar entries what I already posted but for different files, nothing else
Fuse mounts are somewhat challenging to shut down depending on what you have going on.
If you don't set a KillMode in your service file, it'll finally result to killing the process, which leaves things in an odd state as it doesn't fully stop until all the IO against the mount is stopped.
I use:
KillMode=none
and I also make sure anything program/application that is going to use my fuse mount (rclone), it has a service dependency back to that process.
You want to be sure to stop all IO to the mount point, stop the service which is really doing a fusermount and it won't exit rclone until all the IO is done. If systemd doesn't have that killmode set, it'll kill the process forcefully and you get into a bad state.
vfs cache: delaying writeback as --transfers exceeded
That by default, it does 4 transfers at a time based on the transfers default so anything past that gets queued up.
So what I would do:
stop the service
ensure any IO processes against the mountpoint are stoped (if you have root, you can validate that with lsof
start the rclone command via command line and let things settle. It has to empty the queue out.
Once that finishes, add the KillMode=none, systemctl daemon-reload to refresh the service and validate that way. In the end, you do not want systemd killing rclone for you.
Hmm, I was doing some testing and I didn't have any luck with fuser.
I tried doing:
fusermount first and that made fuser not find a mount point since it was kind of dismounted.
If I swapped order, no real change.
My use case:
rclone mount to some mount point
cd into mountpoint which makes it in use
I tried fusermount/fuser and fuser/fusermount in order
I think the issue with systemd comes with it does a regular kill and after that doesn't work, it -9 the process which leaves the non connected transport state since some IO is still pegged to it.
I just try to make systemd services dependent so if rclone stops, anything that needs it also stops so I never get into that situation. Honestly, I never have had rclone crash or be unstable so it just runs for me with very little interaction.