Chef Infra Client Error : Clock has drifted by more than 15 minutes : CentOS 7

While running chef-client on the CentOS 7 VM it failed to authenticate to the Chef Server with below error:

[root@elkslave1 bin]# ./chef-client
Starting Chef Infra Client, version 16.4.41

================================================================================
Chef encountered an error attempting to load the node data for "server"
================================================================================

Authentication Error:
---------------------
Failed to authenticate to the chef server (http 401).
The request failed because your clock has drifted by more than 15 minutes.
Syncing your clock to an NTP Time source should resolve the issue.

Steps which i followed to fix the same on my VM:

  • install NTP daemon on CentOS 7 VM
yum install ntp
  • Start & enable the service
service ntpd start
chkconfig ntpd on
ntpdate time.google.com

#Check status
service ntpd status

In case you get below error(if NTPD is already running)
ntpdate time.google.com
28 Oct 15:34:30 ntpdate[28581]: the NTP socket is in use, exiting
ntpdate -u time.google.com
  • Run chef-client again, it should run fine without the time error

Leave a Reply

Your email address will not be published. Required fields are marked *