Linux – I messed up the system clock in Arch Linux

arch linuxdatelinuxtime

I installed Arch a couple of days ago. Just realized the date/time were off by a day and one hour.

I changed it using timedatectl set-time. Then used hwclock --systohc to set the hardware clock. After that I was not able to enter some sites like Gmail because of https certificate errors. I tried changing the time back but it did not work.

I rebooted and then had problems because the partitions had mounted on a different time so I used fsck /dev/sda on my partitions and I was able to boot up. Right now the clock is not a problem but I really need to check my mail. I had to use Facebook to log in to stackexchange cringe.

Help?

This is what Gmail's error page say:

The server's security certificate is not yet valid!
You attempted to reach gmail.com, but the server presented a certificate that is not yet valid. No information is available to indicate whether that certificate can be trusted. Chromium cannot reliably guarantee that you are communicating with gmail.com and not an attacker. Your computer's clock is currently set to Tuesday, January 10, 2012 12:14:47 PM. Does that look right? If not, you should correct your system's clock and then refresh this page.

You cannot proceed because the website operator has requested heightened security for this domain.

Best Answer

The correct way to do this would be by enabling ntpd.service via systemd.

# pacman -Syu ntp Installed the required package

# systemctl enable ntpd.service Enable it at boot so every time you boot the system the clock will be synchronized

# systemctl start ntpd.service Start it immediately

One could also run ntpd -qg as root.

Once you have systemd managing this operation, you should never have to worry about setting the clock agian.

note: there are some dual boot scenarios that will unsyncronize the clocks, there's also some registry hacks for the windows side of the dual boot to correct this issue.

Related Question