You are not logged in.
I have a raid mount where the OS flagged to be checked on every mount. So it takes a few seconds to show up.
I have one service that writes to that mount.
It fails every time as it tries to start before the boot.
I did:
# systemctl edit syncthing@syncuser.service
[Service]
UMask=0077
After=MyMountID.mount
and it still tries to start early. What's wrong with the after option there?
I got the mount name from `systemctl list-units -t mount`
Manually starting the service after a few seconds works fine, so it is really just the attempt to start before the mount is fully ready which fails it. (The actual failure is the service seeing there's missing dirs where it expects then, and try to create them from the mount point, which it does not have permission)
Last edited by gcb (2025-01-17 22:40:39)
Offline
Have you considered having the service be path activated?
Offline
I am reading that, but it looks like I will have to figure out how to make the path be managed by systemd and then in the end I will have to make my service "after=some.path"... won't that be the same problem I am having now with "after=some.mount"?
Offline
as with anything systemd, brute forcing worked.
A million ways to do anything and none work very well... thankfully they saved us from basic scripts.
Since i can't reason with it to start the service AFTER the mount point, i just bumped the retry time. sigh.
oh well, here's what i did. It WILL fail once, as it tries to use the system while it is mounting the FS... but after a few seconds it will try again and work.
[Service]
UMask=0077
# Does nothing at all:
After=some.mount
# wait 20s between failures, fixes stupid.
RestartSec=20
[Install]
# is wantedby even a pseudo-array like exec?.. sigh. clear just to be safe
# original is to be wantedby multiusernetwork or something.
WantedBy=
WantedBy=some.mount
# also don't work. Still tries to start while FS is mounting.
Offline
Will not mark solved because it is barely worked-around... if anyone knows what is wrong with After= pls let me know.
Offline
What about this instead of Requires
RequiresMountsFor=/some/path
Offline
Pays to read the log every single time you do a daemon reload
I had the attribute in the wrong section
[Service]
UMask=0077
RestartSec=20
[Unit]
After=some.mount
Offline
What about this instead of Requires
RequiresMountsFor=/some/path
thanks! That would have been good too! In fact, this is a little saner than required the abstract mount name as it points to a concrete path. Have to learn to use this one instead.
Offline