Changing systemd.service TimeoutSec value to "infinity" has no effect
If you are using a version of systemd older than 229, you may need to use 0 instead of infinity to disable the timeout.
Related videos on Youtube
Sid Sahay
Updated on September 18, 2022Comments
-
Sid Sahay over 1 year
My app.service file's [Service] part is the following:-
[Service] Type=forking Restart=no IgnoreSIGPIPE=no GuessMainPID=no ExecStart=/opt/app/appl_init.d start ExecStop=/opt/app/appl_init.d stop TimeoutSec=infinity
After which I installed the app, and the file is correctly copied to
/usr/lib/systemd/system/app.service
.I ran
systemctl daemon-reload
, but it seems to have no effect on the start up time! It fails just as I runsystemctl start app
orsystemctl reload app.service
with the following error:-Job for app.service failed because a fatal signal was delivered to the control process. See "systemctl status app.service" and "journalctl -xe" for details
Output of
systemctl status app
is:-● app.service - ApplicationTest Loaded: loaded (/opt/app/appl_init.d; enabled; vendor preset: disabled) Active: failed (Result: signal) since Tue 2017-03-21 01:55:22 EDT; 1min 4s ago Docs: man:app(8) Process: 4126 ExecStart=/opt/app/appl_init.d start (code=killed, signal=KILL) Mar 21 01:55:22 centosvm systemd[1]: Starting ApplicationTest... Mar 21 01:55:22 centosvm systemd[1]: app.service start operation timed out. Terminating. Mar 21 01:55:22 centosvm systemd[1]: app.service stop-final-sigterm timed out. Killing. Mar 21 01:55:22 centosvm systemd[1]: app.service: control process exited, code=killed status=9 Mar 21 01:55:22 centosvm systemd[1]: Failed to start ApplicationTest. Mar 21 01:55:22 centosvm systemd[1]: Unit app.service entered failed state. Mar 21 01:55:22 centosvm systemd[1]: app.service failed.
Another queer thing that I noticed is when I run
systemctl show app.service -p TimeoutSec
, I don't get any result; it's blank?I have tried doing a
systemctl reboot
, but still, no dice.Of course, when I change the value to anything else like
TimeoutSec=5min
, then it works perfectly fine. But I really need this application to take up infinity.Where am I going wrong?
-
JdeBP about 7 yearsIn editing and altering your output and your service unit to not show people what's really there, you have actually edited out some important clues for answerers. What you show here is not what a systemd operating system does, and you have intentionally obscured information that would tell answerers which of several possibilities is what is going on here. Even guessing which of two different things you may have altered leads down two completely different roads. Start by giving answerers the full, undoctored, and accurate contents of the service unit.
-
Sid Sahay about 7 yearsI just changed the name of the application to "app", which I really can't help. What is the information that you think I've edited out?
-
Sid Sahay about 7 years@JdeBP I can post the entire .service file, if that is what you're looking for.
-
-
Sid Sahay about 7 yearsThat's perfect, could you add your source?
-
nithinj about 7 years
-
nithinj about 7 years
Most configurable timeouts in systemd now expect an argument of "infinity" to turn them off, instead of "0" as before. The semantics from now on is that a timeout of "0" means "now", and "infinity" means "never". To maintain backwards compatibility, "0" continues to turn off previously existing timeout settings.