Disable NTP Daemon

We have an application that’s very sensitive to timing and I’d like to only selectively enable NTP when it is safe to do so. Is it possible to disable the default-on Host NTP daemon?

Hi @chachi,
You should be able to use dbus to disable chrony, but we want to make clear that this can be risky.
This has the potential of bricking the device and should at the very least be extremely very well tested before using on a device that you rely on.

WARNING: Stopping chrony has the caveat of potentially having TLS stop working if the system time ends up being wrong, making the device think that TLS certificates are expired or not yet valid, and as a result making it unable to connect to balena or any web server, and therefore losing all connectivity to the device.

Given the above warning, you should be able to do so with the following command:

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StopUnit string:'chrony.service' string:'fail'

and then you should be able to bring it start it again with:

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StartUnit string:'chrony.service' string:'fail'

Kind regards,
Thodoris

1 Like

For the record: the service is called chronyd.service now.

So the command should read:

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StopUnit string:'chronyd.service' string:'fail'