Why does the Linux system time keep changing?

藏色散人
Release: 2023-03-17 09:14:54
Original
3250 people have browsed it

Solutions to the Linux system time always changing: 1. Check the system time zone link file through "/etc/localtime"; 2. By executing "lrwxrwxrwx. 1 root root 33 Mar 29 16:55 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai" command to change the time zone to Shanghai.

Why does the Linux system time keep changing?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Why does the Linux system time always change?The Linux server time is always wrong?

Some people are curious that their server time has been changed correctly, but after a while, the system time becomes wrong again.

The way people modify the time is generally to use the date command to modify the time, or to use the ntp command to synchronize the time

In this case, if your server is not a physical machine, but a virtual machine , it is not a problem with the hardware time hwclock, but that the default time zone was used or the wrong time zone was selected when installing the system.

Check your system time zone link file: (Obviously New York is selected as the time zone here)

[root@localhost ~]# ll /etc/localtime 
lrwxrwxrwx. 1 root root 38 May 31  2018 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
Copy after login

Modification: (Change the time zone to Shanghai)

[root@localhost ~]# rm /etc/localtime 
rm: remove symbolic link ‘/etc/localtime’? y
[root@localhost ~]# ll /etc/localtime 
ls: cannot access /etc/localtime: No such file or directory
[root@localhost ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@localhost ~]# ll /etc/localtime 
lrwxrwxrwx. 1 root root 33 Mar 29 16:55 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai
Copy after login

Use the date command to check whether the time has been restored. If not, use the ntp command to synchronize the time, and the time will not be wrong later.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of Why does the Linux system time keep changing?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template