Changing systemd.service TimeoutSec value to "infinity" has no effect

5,852

If you are using a version of systemd older than 229, you may need to use 0 instead of infinity to disable the timeout.

Share:
5,852

Related videos on Youtube

Sid Sahay
Author by

Sid Sahay

Updated on September 18, 2022

Comments

  • Sid Sahay
    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 run systemctl start app or systemctl 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
      JdeBP about 7 years
      In 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
      Sid Sahay about 7 years
      I 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
      Sid Sahay about 7 years
      @JdeBP I can post the entire .service file, if that is what you're looking for.
  • Sid Sahay
    Sid Sahay about 7 years
    That's perfect, could you add your source?
  • nithinj
    nithinj about 7 years
  • nithinj
    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.