When I use timedatectl to set the timezone, it happens
[root@localhost ~]# timedatectl set-timezone "America/New_York"
Failed to set time zone: Access denied
This's my host infomation
Static hostname: rolin
Icon name: computer-vm
Chassis: vm
Machine ID: 699591c5339c2ae6d7e7b25151eaa987
Boot ID: 40dc52c07c85444c9514f7d92a24448e
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.18.2.el7.x86_64
Architecture: x86-64
What can I do now?
NTP stands for Network Time Protocol is an internet protocol, which is used to synchronize the system clock between computers. The timedatectl utility enables you to automatically sync your Linux system clock with a remote group of servers using NTP.
The timedatectl command allows you to both query and change the system clock and its settings on Linux systems. To display the current settings, use the command by itself—with no arguments.
If timesync-status is invoked and this option is passed, then timedatectl monitors the status of systemd-timesyncd. service(8) and updates the outputs. Use Ctrl+C to terminate the monitoring.
The root cause of this problem is probably an SELinux labeling issue. The fix is to relabel the /etc directory:
restorecon -Rv /etc
Then re-run the timedatectl command.
Source: https://access.redhat.com/solutions/3366211 (link requires a RedHat login).
Or if you can't do that for some reason, as a workaround you could temporarily set SELinux to permissive mode, update the time zone, and then re-enable SELinux.
However, that second approach will not fix the underlying problem. A mis-labeling in /etc may well cause other problems down the road.
I find that my /etc/localtime is not a symbolic links pointing to /usr/share/zoneinfo/... .
so I changed that file like this ,it works:
lrwxrwxrwx. /etc/localtime ->../usr/share/zoneinfo/Asia/Shanghai
I used this commands to change timezone for my vicidial server with cent os 7 :
rm /etc/localtime
rm: remove regular file `/etc/localtime'
ln -s /usr/share/zoneinfo/Europe/Rome localtime
date and you will see that it is changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With