All Products
Search
Document Center

There is a delay in system time synchronization after the ECS instance Aliyun Linux 2.1903 the image is started or restarted.

Last Updated: Apr 29, 2020

Disclaimer: this document may contain information about third-party products that are for reference only. Alibaba Cloud does not make any guarantee, express or implied, with respect to the performance and reliability of third-party products, as well as potential impacts of operations on the products.

Problem Description

After you start or restart an ECS instance that meets the following conditions, the system time differs from the NTP server by 8 hours. Run the hwclock -w command cannot change kernel time.

  • The image version of the Aliyun Linux 2.1903.
  • kernel-4.19.24-10.al7.x86_64 or earlier versions.

Cause of problem

The hardware clock RTC is correct and is also set _set-local-rtc_ however, the System Time is not synchronized to the Local Time during startup. The following configurations need to be enabled on the kernel.

# Set system time from RTC on startup and resume
CONFIG_RTC_HCTOSYS=y
# RTC used to set the system time
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"

Solution

Alibaba Cloud reminds you that:

  • If you have any risky operations on an instance or data, pay attention to the disaster tolerance and fault tolerance capabilities of the instance to ensure data security.
  • If you modify the configuration and data of an instance (including but not limited to ECS and RDS), we recommend that you create snapshots or enable RDS log backup.
  • If you have granted permissions on the Alibaba Cloud platform or submitted security information such as the logon account and password, we recommend that you modify the information as soon as possible.

Temporary solution

Refer to the following command, in /etc/rc.d/rc.local file hwclock --hctosys to make the system synchronization time during startup.

echo "hwclock --hctosys" >>/etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

Fixed solution

Upgrade the kernel kernel-4.19.34-11.al7.x86_64 or a newer version.

Applicable to

  • Elastic Compute Service