0

My ntp service running well but I can't start timedatectl, any one can help?

# systemctl status ntp 
● ntp.service - LSB: Start NTP daemon    Loaded: loaded (/etc/init.d/ntp; generated; vendor preset: enabled)    Active: active (exited) since Sat 2020-06-13 01:37:35 UTC; 2min 37s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 19660)    CGroup: /system.slice/ntp.service

Jun 13 01:37:35 localhost systemd[1]: Stopped LSB: Start NTP daemon. Jun 13 01:37:35 localhost systemd[1]: Starting LSB: Start NTP daemon... Jun 13 01:37:35 localhost systemd[1]: Started LSB: Start NTP daemon.

timedatectl

Failed to query server: Cannot send after transport endpoint shutdown

  • actually it's not running well, active (exited) means systemd has executed the commands successfully, but there's not any daemon to monitor. – binarysta Jun 13 '20 at 08:37

1 Answers1

1

timedatectl does not talk to ntpd. timedatectl talks to systemd-timedated.

In fact, that is not quite true either. timedatectl talks to dbus-daemon, which in its turn talks to systemd-timedated, which talks back to dbus-daemon, which talks to systemd, asking about the status of configured services such as ntpd and systemd-timesyncd.

Something somewhere in that chain is reporting an ESHUTDOWN error. Unfortunately, systemd's Desktop Bus error reporting is such that one cannot tell which link in the chain the error came from.

This could be anything, and you've given zero information to diagnose this further with. For all we know, systemd-timedated could be looking at completely the wrong services, or could be failing to start; or there could be some Desktop Bus problem. One would have to monitor the system-wide Desktop Bus with busctl monitor to find out more.

It won't help you, incidentally, that the systemd doco for systemd-timedated erroneously says "systemd-timesyncd" when it should say "systemd-timedated". ☺

As for why your ntp.service has no running process: You are starting it from an old van Smoorenburg rc script for some reason. systemd-sysv-generator's one-size-fits-all approach to such scripts is fooling you into wrongly thinking that your service is running successfully, as explained at https://unix.stackexchange.com/a/560998/5132 .

Stop using the van Smoorenburg rc script and the one-size-fits-all compatibility mechanism. Most Linux operating systems package their various NTP dæmons up with systemd service units nowadays. Again, you've provided zero information that can be used to diagnose this further, or to point you in the direction of such a unit. On Debian alone, there are at least three different possible sources of this ntpd, and you haven't told us which NTP software yours came from, or even what operating system you are using.

Further reading

JdeBP
  • 68,745