Skip to main content

CentOS 7 instance incorrect time

The time is incorrect on a CentOS 7 instance, which can cause the instance to lose its IP when attempting to renew its DHCP lease.

The instance is set to maintain the real time clock (RTC) in local time instead of universal time (UTC). Maintaining RTC in local time is not fully supported by the OS and causes multiple problems with time zone changes.

If the boot disk is listed, perform the installation and all the disks are present in the instance after it completes. If the boot disk is not listed, edit the instance profile to delete disks until seven or fewer remain. Then reboot the instance and perform the installation. After the installation is done, re-add the disks.

Verify that RTC is maintained in local time:

  1. Execute the following command:

    timedatectl status

  2. If RTC is maintained in local time, the following message is present in the previous command output:

    RTC in local TZ: yes

  3. Exevute the following command to set RTC to be maintained in UTC:

    timedatectl set-local-rtc 0