Azure Rocky9 chronyd

Hi All.
Azure VM. Install Rocky9 ( image from rocky):

# cat /etc/redhat-release 
Rocky Linux release 9.0 (Blue Onyx)
# systemctl status chronyd
× chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-10-07 17:18:30 UTC; 9min ago
       Docs: man:chronyd(8)
             man:chrony.conf(5)
        CPU: 13ms

Oct 07 17:18:30 localhost.localdomain systemd[1]: Starting NTP client/server...
Oct 07 17:18:30 localhost.localdomain chronyd[730]: chronyd version 4.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +>
Oct 07 17:18:30 localhost.localdomain chronyd[730]: Could not open /dev/ptp_hyperv : No such file or directory
Oct 07 17:18:30 localhost.localdomain chronyd[730]: Fatal error : Could not open PHC
Oct 07 17:18:30 localhost.localdomain chronyd[718]: Could not open PHC
Oct 07 17:18:30 localhost.localdomain systemd[1]: chronyd.service: Control process exited, code=exited, status=1/FAILURE
Oct 07 17:18:30 localhost.localdomain systemd[1]: chronyd.service: Failed with result 'exit-code'.
Oct 07 17:18:30 localhost.localdomain systemd[1]: Failed to start NTP client/server.

What is this and Where from this error in the fresh installed Rocky9 in azure (source image from the Azure is " The Rocky Enterprise Software Foundation Inc
Virtual Machine
The Official Rocky Linux 9 Image from the Rocky Enterprise Software Foundation ")?

Serg

Is this something to do with chronyd trying to use the “host clock” as in hyper-v?

Found:

  1. Turn on the VM power from AZure portal
  2. The VM turned on
  3. via ssh logged in linux
  4. systemctl status chronyd shows the same error
  5. perform the following steps:
    5.1) systemctl stop chronyd
    5.2) systemctl start chronyd
    5.3) systemctl status chronyd - ALL OK !! Green !

Just by going to ssh and restarting chronyd it starts working normally, until the next machine reboot…

my workaround:
systemctl edit chronyd.service
and add this lines:
[Unit]
Description=NTP client/server
Documentation=man:chronyd(8) man:chrony.conf(5)
Wants=network-online.target
After=network-online.target ntpdate.service sntp.service ntpd.service
Conflicts=ntpd.service systemd-timesyncd.service
ConditionCapability=CAP_SYS_TIME

And save. After this shutdown -r now and service chronyd - GREEN(OK)
Key moments is:

  1. add this line:
    Wants=network-online.target
  2. modify second line to :
    After=network-online.target ntpdate.service sntp.service ntpd.service

why did I do that?
I assumed that chronyd started before the network interface went up.
as a consequence - chronyd could not find out the IP address of the 2.pool.ntp.org
i reconfigured the startup of the chronyd daemon so that it would start after UP the network interface.

Serg

1 Like