CentOS7/Red Hat7 NTP service fails to start automatically

Original address: http://blog.csdn.net/babyfish13/article/details/52502522


CentOS 7 is different from the previous linux operation, and the command is different for the adjustment of boot-up. chkconfig --list view the self startup status of non system built-in services

  1. [root@master ~]# chkconfig --list  
  2.   
  3. Note: This output shows SysV services only and does not include native  
  4.       systemd services. SysV configuration data might be overridden by native  
  5.       systemd configuration.  
  6.   
  7.       If you want to list systemd services use 'systemctl list-unit-files'.  
  8.       To see services enabled on particular target use  
  9.       'systemctl list-dependencies [target]'.  
  10.   
  11. iprdump         0:off   1:off   2:on    3:on    4:on    5:on    6:off  
  12. iprinit         0:off   1:off   2:on    3:on    4:on    5:on    6:off  
  13. iprupdate       0:off   1:off   2:on    3:on    4:on    5:on    6:off  
  14. netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off  
  15. network         0:off   1:off   2:on    3:on    4:on    5:on    6:off  
  16. vmware-tools    0:off   1:off   2:on    3:on    4:on    5:on    6:off  

According to the prompt, to view the built-in service self starting status of the system, you need to use the command systemctl list unit files, which lists the self starting status of all built-in services of the system.
So adjusting ntp self start needs to be adjusted here.

  1. [root@master ~]# systemctl enable  ntpd.service / / booting
  2.     Restart the system after adjustment, but it is found that ntp It didn't start  
  3.   
  4. [root@master ~]#pgrep ntpd / / unable to view related processes
  5. [root@master ~]# systemctl status ntpd  
  6. ntpd.service - Network Time Service  
  7.    Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)  
  8.    Active: inactive (dead)                                  //It shows that the power is started automatically, but the status is inactive

Through the query, it is found that a cronyd service is set to start from the start, which causes ntp to fail to start from the start

  1. [root@master ~]# systemctl status chronyd  
  2. chronyd.service - NTP client/server  
  3.    Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)  
  4.    Active: inactive (dead) since Tue 2014-11-11 08:28:14 CST; 1min 45s ago  
  5. Main PID: 3033 (code=exitedstatus=0/SUCCESS)  
  6.    CGroup: /system.slice/chronyd.service  
  7.   
  8. Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Starting NTP clien...  
  9. Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: chronyd version...  
  10. Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: Linux kernel ma...  
  11. Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: hz=100 shift_hz...  
  12. Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Started NTP client...  
  13. Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopping NTP clien...  
  14. Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopped NTP client...  
  15. Hint: Some lines were ellipsized, use -l to show in full.  

By disabling the cronyd service from starting up and then restarting the system

  1. [root@master ~]# systemctl disable chronyd.service   
  2. rm '/etc/systemd/system/multi-user.target.wants/chronyd.service'  
  3.   
  4. [root@master ~]# pgrep ntpd  
  5. 2981  
  6. [root@master ~]# ntpq -p  
  7.      remote           refid      st t when poll reach   delay   offset  jitter  
  8. ==============================================================================  
  9. 10.70.213.132   10.70.91.148     3 u   21   64    1    1.252    0.029   0.000  
  10. *10.70.213.133   10.70.91.148     3 u   21   64    1    1.139   -0.191   0.000  

At this time, NTP service has been started and started. It is finished!

Frankly, in a word, because the chronyd is not disabled, ntpq can not start even if it is configured!


remarks:

Chrony is an open-source free software, which can keep the system clock and clock server (NTP) in synchronization and keep the time accurate. It is the new NTP time synchronization service in RHEL7.

Tags: network Linux CentOS Vmware

Posted on Wed, 20 May 2020 11:25:35 -0400 by mightymouse