[systemd-devel] cannot create hard dependencies on mounts
Henti Smith
henti at gaydonsmith.co.uk
Tue Sep 10 14:37:56 UTC 2024
Good day all.
I have a service that requires a disk, which is mounted via NFS.
I've used data.mount to mount the NFS as follows:
[Unit]
Description=Mount Data
[Mount]
What=192.168.60.10:/mnt/ta_data
Where=/data
Type=nfs
Options=vers=4,_netdev,auto
[Install]
WantedBy=multi-user.target
and then the service is managed with mission.service:
[Unit]
Description=Mission Control
After=network.target data.mount
Wants=network.target
[Service]
Type=simple
User=oxbotica
ExecStart=/opt/mission-bin/start-web-server.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Since mission.service requires data.mount I added:
Requires=data.mount
to mission.service [Unit]
This works perfectly, except when the NFS server is not available. This
does happen from time to time when the two machines are started at the same
time (these are not permanently running machines), then I need the server
the units are running on to wait for the NFS server.
To do this I added:
TimeoutSec=5m
to the [Mount] section.
While starting data.mount, this works correctly, as it waits for the NFS
share to become available before it mounts.. However, starting
mission.service without starting data.mount, it correctly requires
data.mount, but mission.service executes anyway.
I'm not entirely sure why this happens.
When I disconnect the NFS share from the network and run data.mount, it
gives the expected output of:
Sep 10 14:26:31 dcv1uk-mvc rpc.gssd[1081]: ERROR: unable to resolve
192.168.60.10 to hostname: Name or service not known
Sep 10 14:26:31 device01 rpc.gssd[1081]: ERROR: failed to parse
nfs/clnt3f/info
Sep 10 14:26:31 device01 rpc.gssd[1081]: ERROR: unable to resolve
192.168.60.10 to hostname: Name or service not known
Sep 10 14:26:31 device01 rpc.gssd[1081]: ERROR: failed to parse
nfs/clnt3f/info
until the NFS share is reconnected and then:
Sep 10 14:26:51 device01 systemd[1]: Mounted Mount GTA on Data.
When I start mission.services I get:
device01 systemd[1]: Started Mission Execution Manager.
device01 systemd[1]: missioncontrol_execution_manager.service: Main
process exited, code=exited, status=1/FAILURE
device01 systemd[1]: missioncontrol_execution_manager.service: Failed with
result 'exit-code'.
device01 systemd[1]: missioncontrol_execution_manager.service: Scheduled
restart job, restart counter is at 5.
device01 systemd[1]: Stopped Mission Execution Manager.
device01 systemd[1]: missioncontrol_execution_manager.service: Start
request repeated too quickly.
device01 systemd[1]: missioncontrol_execution_manager.service: Failed with
result 'exit-code'.
device01 systemd[1]: Failed to start Mission Execution Manager.
device01 rpc.gssd[1081]: ERROR: unable to resolve 192.168.60.10 to
hostname: Name or service not known
device01 rpc.gssd[1081]: ERROR: failed to parse nfs/clnt51/info
device01 rpc.gssd[1081]: ERROR: unable to resolve 192.168.60.10 to
hostname: Name or service not known
device01 rpc.gssd[1081]: ERROR: failed to parse nfs/clnt52/info
device01 rpc.gssd[1081]: ERROR: unable to resolve 192.168.60.10 to
hostname: Name or service not known
device01 rpc.gssd[1081]: ERROR: failed to parse nfs/clnt53/info
Am I misunderstanding how this is supposed to work ?
Kind regards
Henti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240910/05dd0776/attachment.htm>
More information about the systemd-devel
mailing list