Closed pedrolamas closed 2 years ago
You have two different conflicting configurations, and tzlocal don't know which one is correct.
I get your point on the conflict, but I would also point out that it is quite common to map a host /etc/localtime
to a docker container (thus sharing the host localtime definition), and this was working just fine till a tzlocal update broke it!
Using the symlink to decide what is the timezone would seem to me like a last resort kind of thing (lower priority), as the symlink can be changed to something else, and the content pointed to something that has nothing to do with it (such as is the case here)
Which priority is a matter of opinion, and in different cases you want different things, which is why tzlocal no longer has an order but checks everything and fails if there is a conflict.
The way to fix that is to either fix the conflict or set up a TZ environment variable.
Changing the contents of the /usr/share/zoneinfo/Etc/UTC file is definitely NOT a valid way of setting the timezone, and this being done is certainly by mistake, like for example some software trying to overwrite /etc/localtime, but ending up overwriting the file it links to instead.
This of course all boils down to the problem that Unix does not have one official way of configuring this, but many. And that's nothing I can do anything about.
This of course all boils down to the problem that Unix does not have one official way of configuring this, but many. And that's nothing I can do anything about.
Fully agree with this one! 😁
The way to fix that is to either fix the conflict or set up a TZ environment variable.
This is what I've done since I started having this issue, and stopped mapping the /etc/localtime
.
At the time, I decided on raising this issue as my docker containers that were working fine, were now not even starting, so to me there was some breaking change on the tzlocal behavior that could have not been considered!
My personal problem was solved with the TZ
variable, so feel free to close this if there is no further action/documentation update required.
I added a note about this in the readme. Thanks!
I've noticed this with the latest ESPHome docker container:
As you can see on the above image, the host "/etc/localtime" has "GMT" timezone, and the same is shown inside the docker container, however there is an (incorrect) symlink to UTC!
I know I could use the
TZ
variable to fix this, however I've been mapping the "/etc/localtime" for a long time now and never had any issues until today!I've opened a similar issue against ESPHome here: https://github.com/esphome/issues/issues/2718