Having recently reimaged and patched several ODA in version 19.8 and 19.9, I could see an issue with NTP. During my troubleshooting I could determine the root cause and find appropriate solution. Through this blog I would like to share my experience with you.
Symptom/Analysis
ODA version 19.6 or higher is coming with Oracle Linux 7. Since Oracle Linux 7 the default synchronization service is not ntp any more but chrony. In Oracle Linux 7, ntp is still available and can still be used. But ntp service will disappear in Oracle Linux 8.
What I could realize from my last deployments and patching is that :
- Patching your ODA to version 19.8 or 19.9 from 19.6 : The system will still use ntpd and chronyd service will be deactivated. All is working fine.
- You reimage your ODA to version 19.8 : chronyd will be activated and NTP will not work any more.
- You reimage your ODA to version 19.9 : ntpd will be activated and NTP will be working with no problem.
So the problem is only if you reimage your ODA to version 19.8.
Problem explanation
The problem is due to the fact that the odacli script deploying the appliance will still update the ntpd configuration (/etc/ntpd.conf) with the IP address provided and not chronyd. But chronyd will be, by default, activated and started then with no configuration.
Solving the problem
There is 2 solutions.
A/ Configure and use chronyd
You configure /etc/chrony.conf with the NTP addresses given during appliance creation and you restart chronyd service.
Configure chrony :
oracle@ODA01:/u01/app/oracle/local/dmk/etc/ [rdbms19.8.0.0] vi /etc/chrony.conf oracle@ODA01:/u01/app/oracle/local/dmk/etc/ [rdbms19.8.0.0] cat /etc/chrony.conf # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.pool.ntp.org iburst #server 1.pool.ntp.org iburst #server 2.pool.ntp.org iburst #server 3.pool.ntp.org iburst server 212.X.X.X.103 prefer server 212.X.X.X.100 server 212.X.X.X.101 # Record the rate at which the system clock gains/losses time. driftfile /var/lib/chrony/drift # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC). rtcsync # Enable hardware timestamping on all interfaces that support it. #hwtimestamp * # Increase the minimum number of selectable sources required to adjust # the system clock. #minsources 2 # Allow NTP client access from local network. #allow 192.168.0.0/16 # Serve time even if not synchronized to a time source. #local stratum 10 # Specify file containing keys for NTP authentication. #keyfile /etc/chrony.keys # Specify directory for log files. logdir /var/log/chrony # Select which information is logged. #log measurements statistics tracking
And you restart chrony service :
[root@ODA01 ~]# service chronyd restart Redirecting to /bin/systemctl restart chronyd.service
B/ Start ntp
Starting ntp will automatically stop chrony service.
[root@ODA01 ~]# ntpq -p ntpq: read: Connection refused [root@ODA01 ~]# service ntpd restart Redirecting to /bin/systemctl restart ntpd.service
Checking synchronization :
[root@ODA01 ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== lantime. domain_name .STEP. 16 u - 1024 0 0.000 0.000 0.000 *ntp1. domain_name 131.188.3.223 2 u 929 1024 377 0.935 -0.053 0.914 +ntp2. domain_name 131.188.3.223 2 u 113 1024 377 0.766 0.184 2.779
Checking both ntp and chrony services :
[root@ODA01 ~]# service ntpd status Redirecting to /bin/systemctl status ntpd.service ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2020-11-27 09:40:08 CET; 31min ago Process: 68548 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 68549 (ntpd) Tasks: 1 CGroup: /system.slice/ntpd.service └─68549 /usr/sbin/ntpd -u ntp:ntp -g Nov 27 09:40:08 ODA01 ntpd[68549]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16 Nov 27 09:40:08 ODA01 ntpd[68549]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123 Nov 27 09:40:08 ODA01 ntpd[68549]: Listen normally on 1 lo 127.0.0.1 UDP 123 Nov 27 09:40:08 ODA01 ntpd[68549]: Listen normally on 2 btbond1 10.X.X.10 UDP 123 Nov 27 09:40:08 ODA01 ntpd[68549]: Listen normally on 3 priv0 192.X.X.24 UDP 123 Nov 27 09:40:08 ODA01 ntpd[68549]: Listen normally on 4 virbr0 192.X.X.1 UDP 123 Nov 27 09:40:08 ODA01 ntpd[68549]: Listening on routing socket on fd #21 for interface updates Nov 27 09:40:08 ODA01 ntpd[68549]: 0.0.0.0 c016 06 restart Nov 27 09:40:08 ODA01 ntpd[68549]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM Nov 27 09:40:08 ODA01 ntpd[68549]: 0.0.0.0 c011 01 freq_not_set [root@ODA01 ~]# service chronyd status Redirecting to /bin/systemctl status chronyd.service ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fri 2020-11-27 09:40:08 CET; 32min ago Docs: man:chronyd(8) man:chrony.conf(5) Process: 46183 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS) Process: 46180 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 46182 (code=exited, status=0/SUCCESS) Nov 27 09:18:25 ODA01 systemd[1]: Starting NTP client/server... Nov 27 09:18:25 ODA01 chronyd[46182]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG) Nov 27 09:18:25 ODA01 chronyd[46182]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift Nov 27 09:18:25 ODA01 systemd[1]: Started NTP client/server. Nov 27 09:40:08 ODA01 systemd[1]: Stopping NTP client/server... Nov 27 09:40:08 ODA01 systemd[1]: Stopped NTP client/server.
You might need to deactivate chronyd service with systemctl to avoid chronyd starting automatically after server reboot.
Are you getting a socket error with chrony?
If you are getting following error starting chrony, you will need to give appropriate option to start chronyd with IPv4 :
Nov 27 09:09:19 ODA01 chronyd[35107]: Could not open IPv6 command socket : Address family not supported by protocol.
Example of error encountered :
[root@ODA01 ~]# service chronyd status Redirecting to /bin/systemctl status chronyd.service ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-11-27 09:09:19 CET; 5min ago Docs: man:chronyd(8) man:chrony.conf(5) Process: 35109 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS) Process: 35105 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 35107 (chronyd) Tasks: 1 CGroup: /system.slice/chronyd.service └─35107 /usr/sbin/chronyd Nov 27 09:09:19 ODA01 systemd[1]: Starting NTP client/server... Nov 27 09:09:19 ODA01 chronyd[35107]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG) Nov 27 09:09:19 ODA01 chronyd[35107]: Could not open IPv6 command socket : Address family not supported by protocol Nov 27 09:09:19 ODA01 chronyd[35107]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift Nov 27 09:09:19 ODA01 systemd[1]: Started NTP client/server.
Chronyd system service is using a variable to set options :
[root@ODA01 ~]# cat /usr/lib/systemd/system/chronyd.service [Unit] Description=NTP client/server Documentation=man:chronyd(8) man:chrony.conf(5) After=ntpdate.service sntp.service ntpd.service Conflicts=ntpd.service systemd-timesyncd.service ConditionCapability=CAP_SYS_TIME [Service] Type=forking PIDFile=/var/run/chrony/chronyd.pid EnvironmentFile=-/etc/sysconfig/chronyd ExecStart=/usr/sbin/chronyd $OPTIONS ExecStartPost=/usr/libexec/chrony-helper update-daemon PrivateTmp=yes ProtectHome=yes ProtectSystem=full [Install] WantedBy=multi-user.target
Need to put options -4 to chronyd service configuration file :
[root@ODA01 ~]# cat /etc/sysconfig/chronyd # Command-line options for chronyd OPTIONS="" [root@ODA01 ~]# vi /etc/sysconfig/chronyd [root@ODA01 ~]# cat /etc/sysconfig/chronyd # Command-line options for chronyd OPTIONS="-4"
You will just need to restart chrony service :
[root@ODA01 ~]# service chronyd restart Redirecting to /bin/systemctl restart chronyd.service [root@ODA01 ~]# service chronyd status Redirecting to /bin/systemctl status chronyd.service ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-11-27 09:18:25 CET; 4s ago Docs: man:chronyd(8) man:chrony.conf(5) Process: 46183 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS) Process: 46180 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 46182 (chronyd) Tasks: 1 CGroup: /system.slice/chronyd.service └─46182 /usr/sbin/chronyd -4 Nov 27 09:18:25 ODA01 systemd[1]: Starting NTP client/server... Nov 27 09:18:25 ODA01 chronyd[46182]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG) Nov 27 09:18:25 ODA01 chronyd[46182]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift Nov 27 09:18:25 ODA01 systemd[1]: Started NTP client/server.
Finally you can then use following command to check NTP synchronisation with chronyd :
[root@ODA01 ~]# chronyc tracking
Cet article NTP is not working for ODA new deployment (reimage) in version 19.8? est apparu en premier sur Blog dbi services.