Does anyone else needs to use SuccessExitStatus=143 with systemd?

I was noticing that when i did systemctl stop vfs it was not doing a clean shutdown, the rclone logs didn't say the usual signal received, exiting, etc

I noticed that I had this in my systemd:

ExecStop=/bin/fusermount -uz /mnt/remote

I removed this, and then a systemctl stop vfs was doing a clean shutdown like the logs says:

2025/04/06 01:30:50 INFO  : Signal received: terminated
2025/04/06 01:30:50 ERROR : /mnt/remote: Unmounted rclone mount
2025/04/06 01:30:50 INFO  : Exiting...

But then when looking at systemctl status vfs there was this weird error :frowning:

systemctl status vfs
× vfs.service - Rclone VFS Mount
     Loaded: loaded (/etc/systemd/system/vfs.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2025-04-06 01:29:08 -03; 13s ago
    Process: 1610978 ExecStartPre=/bin/sleep 120 (code=exited, status=0/SUCCESS)
    Process: 1611463 ExecStart=/usr/bin/rclone mount --config=/home/lol/.config/rclone/rclone.conf --allow-other --cache-dir=/mnt/cache --vfs-cache-max-age=8766h --vfs-cache-max-size=17.8T --vfs-cache-mode=full --vfs-cache-min-free-space=5G --vfs-read-chunk-size=0 --buffer-size=0 --vfs-read-ahead=256M --vfs>
   Main PID: 1611463 (code=exited, status=143)
     Status: "[01:28] vfs cache: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)"
        CPU: 207ms

Apr 06 01:26:27 V27 systemd[1]: Starting Rclone VFS Mount...
Apr 06 01:28:27 V27 systemd[1]: Started Rclone VFS Mount.
Apr 06 01:29:08 V27 systemd[1]: Stopping Rclone VFS Mount...
Apr 06 01:29:08 V27 systemd[1]: vfs.service: Main process exited, code=exited, status=143/n/a
Apr 06 01:29:08 V27 systemd[1]: vfs.service: Failed with result 'exit-code'.
Apr 06 01:29:08 V27 systemd[1]: Stopped Rclone VFS Mount.

So my fix was adding SuccessExitStatus=143 on my service.

Am I doing something wrong or this is expected? Can I trust that rclone is getting killed cleanly if it logs Exiting ?

This is my full systemd

[Unit]
Description=Rclone VFS Mount
RequiresMountsFor=/mnt/cache
After=mnt-cache.mount
Requires=mnt-cache.mount

[Service]
User=root
Group=root
Type=notify
ExecStartPre=/bin/sleep 1
ExecStart=/usr/bin/rclone mount \
   lots of stuff
  cf: /mnt/remote
SuccessExitStatus=143
LimitNOFILE=infinity
TimeoutSec=1500

[Install]
WantedBy=default.target

Not sure it matters but I'm running rclone v1.69.1, I also believe the backends doesn't matter so I'm not posting them since this is all systemd stuff.

It seems it was a deliberate choice by the rclone team to exit with this status code like java does correct?

SuccessExitStatus=143 is the right way to handle it if you worry about it.

This exit status simply means that it received SIGTERM signal and obbeyed.

Such exit code gets you a chance to find out which signal.
Value above 128 indicates that it is synthetic status: 143-128=15 which corresponds to SIGTERM.
The SIGTERM signal has a numeric value of 15 ( see man signal).

But I have read that this can hide other errors that could get the service killed ?

Like this

Your link concludes with the following "fix":

But feel free to explore it more and maybe even suggest some better way of handling it. Nobody claims that rclone deos everything perfectly.

What is actually the real issue you are trying to solve?

FWIW, fusermount is the correct way to stop a fuse mount. RClone does log the unmount in those cases, it's just at the DEBUG level, rather than ERROR (as is the case for exit on signal):

@ncw can probably shed more light on why the DEBUG vs. ERROR difference here.

1 Like