Pages

Tuesday, May 12, 2020

Updating the timezone

Today I was facing the issue, that my media center didn't show the right time. Instead it was always two hours back. The actual time was 08:42:1, while my media center showed this:

# date
Tue May 12 06:42:17 UTC 2020

When I checked the timezone with timedatectl, I got the following result:

# timedatectl
                      Local time: Tue 2020-05-12 06:42:58 UTC
                  Universal time: Tue 2020-05-12 06:42:58 UTC
                        RTC time: n/a
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no


UTC+0 is clearly the wrong one for me. So I first checked the content of /etc/timezone:

# cat /etc/timezone
Etc/UTC


And where the localtime file links to:

# ls -lah /etc/localtime
lrwxrwxrwx 1 root root 27 Oct  4  2019 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC


Then I updated everything to Europe/Berlin, which fits way more:

# vi /etc/timezone
Europe/Berlin


Then the link for the /etc/localtime file:

# rm /etc/localtime
# ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime


Finally I ran date again to check the current time on the media center:

# date
Tue May 12 08:45:22 CEST 2020


And checked the updated timezone again:

# timedatectl
                      Local time: Tue 2020-05-12 08:45:37 CEST
                  Universal time: Tue 2020-05-12 06:45:37 UTC
                        RTC time: n/a
                       Time zone: Europe/Berlin (CEST, +0200)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no


Nice, the correct time and date is now shown!

No comments:

Post a Comment