WSL: /etc/localtime is not a symlink

As seen here and here, some applications and libraries rely on /etc/localtime to be a symlink.

Manually replacing the file with a symlink to the correct timezone file seems to be a valid workaround that persists through a reboot.

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

Executing dpkg-reconfigure tzdata breaks it again. Are there any better workarounds? Is this considered a bug and will it be fixed?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

FWIW, I had a fixed /etc/localtime file created with the Anniversary version, Ubuntu 14, which persisted through an Insider update to 14965 and subsequent upgrade to Xenial.

Running dpkg-reconfigure tzdata replaced it with a symlink and now date shows EST instead of STD.

TL;DR Agree, but in reality, I think the best we can hope for is to have /etc/localtime be a symlink by default, rather than a hard link.


@qis, I totally agree, it would be nice if it’s pointed to a standard meaningful timezone. However the difficulty of determining a Linux timezone from Windows is not straight forward, future proof, or language proof. So I understand why they went with the fake Msft/localtime file instead, as explained here.

I also think the WSL should symlink /etc/localtime rather than hard link by default. This would at least allow situations like #856 and HowardHinnant/date#102 to successfully run the symlink resolution. They shouldn’t realize that /usr/share/zoneinfo/Europe/Berlin is any less nonsense than /usr/share/zoneinfo/Msft/localtime


Another possibility is to set the TZ environment value in your .bashrc as mentioned here. For programs that honor TZ, this should work. For example, add:

TZ=/usr/share/zoneinfo/Europe/Berlin

And now it doesn’t matter who messes up /etc/localtime