'Linux Time Zone Warning

I'd like to know the meaning of the alert message that occurs in the Linux time zone.

timedatectl Warning: Ignoring the TZ variable. Reading the system's time zone setting only.

Local time: Mon 2019-11-18 12:12:50 JST
Universal time: Mon 2019-11-18 03:12:50 UTC
RTC time: Mon 2019-11-18 03:12:50
Time zone: Asia/Tokyo (JST, +0900)

Tell me the cause of the warning message and how to resolve it.



Solution 1:[1]

timedatectl e hwclock

This command, hwclock --localtime, returns UTC time listed by timedatectl, instead to local.

Solution 2:[2]

First run

sudo timedatectl

if it showed the right timezone then skip ahead to ls -al /etc/localtime, otherwise correct it using

sudo timedatectl set-timezone <your region>/<your location>

as an example if you lived in Sweden you would run:

sudo timedatectl set-timezone Europe/Stockholm

then after running this check the output of

ls -al /etc/localtime

if this points to the wrong timezone then run

sudo rm /etc/localtime

followed by

sudo ln -sf /usr/share/zoneinfo/<your region>/<your location> /etc/localtime

substituting your region and your location with the same ones used in the last command.

That should fix it, though you might need to reboot for the changes to take affect.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P
Solution 2 depsterr