[systemd-devel] Oneshot killed by timeout

Henti Smith henti at gaydonsmith.co.uk
Tue Jan 28 14:42:33 UTC 2025


Good day all.

I'm having some timeouts on a oneshot service and I cannot explain the
failure based on the documentation.

We have a service that runs a script that checks for a valid upstream NTP
server before dependent services can start to set PTP master for other
slaves on the network to use to set system time. The service file looks
like this:

[Unit]
Description=NTP boot-time synch

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/timesync-master/ntpsync_start.sh
TimeoutStartSec=infinity

[Install]
WantedBy=multi-user.target

For the most part this seems to work, but we're seeing failures like this:
root at server:~# systemctl status custom.check.serviceroot at server:~#
systemctl status custom.ntpsync.service
* oxbotica.ntpsync.service - NTP boot-time synch
     Loaded: loaded (/lib/systemd/system/custom.ntpsync.service; enabled;
vendor preset: enabled)
     Active: failed (Result: timeout) since Mon 2024-06-17 20:31:23 UTC; 4
days ago
    Process: 1695 ExecStart=/opt/timesync-master/ntpsync_start.sh
(code=killed, signal=TERM)
   Main PID: 1695 (code=killed, signal=TERM)

This seems to indicate that this was a timeout error and systemd sent TERM
to the script, but according to the docs ands and since we don't set
TimeoutStartSec and Type=oneshot is used, timeout is disabled by default.

I'm not sure how the process got killed if it's oneshot and timeout is
disabled, but the error seems to indicate it was a timeout TERM ?

To paint a fuller picture, these computers are ARM without hardware clocks,
hence the need for NTP from external source, and on default boot they
revert back to epoch and during boot get's set to a more up to date time,
which changes with each firmware update from the vendor.

I really don't know if any of this is relevant, there are so many moving
parts to this.

Any assistance to figure this out would be most welcome.

Kind regards
Henti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250128/0d9a5ede/attachment.htm>


More information about the systemd-devel mailing list