Fusermount failed to unmount - service file not working

What is the problem you are having with rclone?

My service file (which works on other installs) isn't working. The journalctl tells me it's a 'failed to unmount' error

What is your rclone version (output from rclone version)

v1.57.0

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)


[Unit]

Description=gdrive mount (rclone)
AssertPathIsDirectory=/home/ubuntu/media
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive:/PMS  /home/ubuntu/media \
--allow-other \
--rc-no-auth
ExecStop=/bin/fusermount -u /home/ubuntu/media

Restart=always
RestartSec=10
[Install]

WantedBy=default.target

The rclone config contents with secrets removed.


[gdrive]
type = drive
token = {"access_token":"###############################################################################################","token_type":"Bearer","refresh_to>
team_drive =

A log from the command with the -vv flag

log file is empty

hi,

this is the service file for rclone+gdrive battle-tested by fellow rcloner @Animosity022.
https://github.com/animosity22/homescripts/blob/master/systemd/rclone-drive.service

just a guess, as he uses /bin/fusermount -uz, not ExecStop=/bin/fusermount -u

that seems to have fixed it !! thanks very much

nope, I lied. It fixed it for one reboot, on the next reboot it threw the same error. argh!

i would use the service file i shared, just change the rclone command, flags and paths.

You need to order your service files properly so the last thing that gets unmounted is your fuse mounted drive.

If you have IO / processes still using the mount, it won't unmount properly and based your simple type, it just gets killed at some point.

1 Like

Not to ask you to teach me linux or anything...but how do I tell the rclone service to wait until all other services have done their thing?

At the start of your service file, you can use a few things:

  • after
  • requires
  • wants
felix@gemini:/etc/systemd/system$ cat someservice.service
[Unit]
Description=Some Service Daemon
Wants=rclone.service
After=network-online.target
Requires=rclone.service

So in this case, if rclone stops, that service will as well.

This does a decent job at explaining it:

Systemd: Requires vs wants - Unix & Linux Stack Exchange

tyvm I'll try to school myself a bit

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