Monthly Archives: January 2018

NTP – ntpdate works but does not update system time

Today I got a wired issue on AWS RHEL servers, ntpdate can’t update the time on it.

# ntpdate 0.centos.pool.ntp.org
ntpdate[23881]: step time server 142.54.181.202 offset -2770.345091 sec
# ntpdate 0.centos.pool.ntp.org
ntpdate[23882]: step time server 142.54.181.202 offset -2770.345357 sec

ntpdate can find out the time difference, but do not update system time.

And I did some research and found out this issue was caused by Wallclock Setting.

# hwclock --show
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
# cat /proc/sys/xen/independent_wallclock
0

Below are the solutions for this issue:

cat /proc/sys/xen/independent_wallclock

0 means that the virtual machine is getting time from the host and not using independent wallclock.
1 means that the virtual machine is using independent wallclock and managing its time independent from the host.

Permanently Changing the Independent Wallclock Setting

Log in to the virtual machine environment as root.

Edit the virtual machine’s /etc/sysctl.conf file.
Add or change the following entry:

xen.independent_wallclock=1

Enter 1 to enable or 0 to disable the wall clock settting.
Save the file and reboot the virtual machine operating system.

When it boots, a virtual machine gets its initial clock time from the host. Then, if the wallclock setting is set to 1 in the sysctl.conf file, it manages its clock time independently and does not synchronize with the host clock time.

Temporarily Changing the Independent Wallclock Setting

Log in to the virtual machine environment as root.
Enter the following command:

echo "1" > /proc/sys/xen/independent_wallclock

Enter 1 to enable or 0 to disable the wall clock settting.

Add or change the following entry:

xen.independent_wallclock=1

Enter 1 to enable or 0 to disable the wall clock settting.