6

I used to be able to edit /etc/sysconfig/clock, but now I need to use timedatectl, which I believe is a systemd command.

What has that got to do with booting the system?

aaa90210
  • 351
  • 6
  • 15

1 Answers1

4

There is only one place on a Linux system that is the source of truth regarding the system timezone for userland processes, that is /etc/localtime. And indeed, timedatectl is managing that file, creating a symbolic link to the appropriate zoneinfo file.

[root@yaungol ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 23 Oct 17 00:55 /etc/localtime -> ../usr/share/zoneinfo/UTC
[root@yaungol ~]# timedatectl set-timezone Europe/London
[root@yaungol ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 35 Feb 12 09:27 /etc/localtime -> ../usr/share/zoneinfo/Europe/London
[root@yaungol ~]# timedatectl set-timezone UTC
[root@yaungol ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 25 Feb 12 09:27 /etc/localtime -> ../usr/share/zoneinfo/UTC

Editing /etc/sysconfig/clock was a bad design to begin with, since it was redundant, (as mentioned before, /etc/localtime is what the system really uses!) and it's good that it's gone now.

If you don't wish to use timedatectl you can always manage the symbolic link yourself with puppet, ansible or whatever.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • That's not *quite* right. The timezone can be set through the TZ environment variable as well. If that is set it will override the /etc/localtime file. See man 3 tzset. – Kristof Provost Aug 25 '17 at 10:15