How to fix the issue of time automatically reverting back after changing it in Linux?
If you make changes to the time in the Linux system but it automatically reverts back, it may be due to the following reasons:
- NTP Synchronization: In Linux systems, NTP (Network Time Protocol) is typically used to automatically synchronize time. If the time on the NTP server is different from the time you changed, the system will automatically reset the time back to the NTP server’s time.
Solution: You can resolve this issue by stopping or disabling the NTP service. The specific method will depend on the Linux distribution and version you are using. For example, on Ubuntu, you can run the following command to stop the NTP service:
Stop the ntp service using sudo systemctl.
- Some computers have the option for the BIOS to automatically sync the time. If the time you change on the computer is different from the time set in the BIOS, the system will automatically reset the time to match the BIOS.
Solution: You can access your computer’s BIOS settings and disable the option for automatic time synchronization. The specific method will depend on the brand and model of your computer. Typically, pressing the corresponding key (such as F2, Delete, or Esc) when the computer is starting up will allow you to enter the BIOS settings.
- Time Zone Setting: If you change the system time without adjusting the time zone setting, the system will automatically adjust the time to match the time zone.
Solution: You can change the time zone settings by using the timedatectl command. For example, to change the time zone to Beijing time, you can run the following command:
Change the timezone to Asia/Shanghai using the sudo timedatectl command.
These are the common reasons and solutions that may cause the Linux system to automatically reset the time. Please choose the appropriate solution based on your specific situation.