Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Fix CentOS 7 and motherboard clock UTC problem

If you have a freshly installed CentOS 7 system, and when you reboot the time is a few hours off, you might find this info useful. A probably reason for this error is the system is fetching the hardware clock which is not set in UTC, and so the offset is basically doubled. Or possible the hardware clock is set in UTC but GNU/Linux doesn't know that. Here's how to fix it (courtesy of Michael Hampton at Stack Overflow-- what doesn't he know?). Fix the date.

# You might need to stop ntpd first.
#systemctl stop ntpd
ntpdate 192.168.1.10

Ensure the date is correct

date





# sync hardware clock to the system time
hwclock -wu

And just remember to start up ntpd if you need it.

Comments