Resolving systemd service ordering cycle conflict
0
votes
1
answer
20
views
I have two service files (serva and servb) as shown below. I want serva to start first (on boot, once network is available), and servb to start only after serva has started. This should be easy, but after playing with several service file parameters I'm still facing this error:
> serva.service: Job servb.service/start deleted to break ordering
> cycle starting with serva.service/start
How do I fix servb.service to achieve what I want?
the **serva.service** file is:
[Unit]
Description=Test Service A (serva)
ConditionPathExists=/usr/local/serva
ConditionFileIsExecutable=/usr/local/serva/serva
ConditionPathIsReadWrite=/tmp
Requires=network.target
After=network-online.target postgresql.service multi-user.target
Wants=postgresql.service
[Service]
Type=forking
PIDFile=/run/serva.pid
WorkingDirectory=/usr/local/serva
ExecStartPre=/bin/sleep 10
ExecStart=/usr/local/serva/serva
SuccessExitStatus=129 200
[Install]
WantedBy=multi-user.target
The **servb.service** file is:
[Unit]
Description=Test Service B (servb)
ConditionPathExists=/usr/local/servb
ConditionFileIsExecutable=/usr/local/servb
ConditionPathIsReadWrite=/var/tmp
Requires=serva.service
After=serva.service
[Service]
Type=forking
PIDFile=/run/servb.pid
WorkingDirectory=/usr/local/servb
ExecStart=/usr/local/servb/servb
SuccessExitStatus=129 200
[Install]
WantedBy=serva.service
I tried modifying servb to use PartOf=haast.service instead of Requires=, but no change in behaviour. I suspect the 10 second delay in serva is contributing to the problem (but this is essential).
Asked by TSG
(1983 rep)
May 13, 2025, 02:53 PM
Last activity: May 13, 2025, 03:44 PM
Last activity: May 13, 2025, 03:44 PM