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)
FWIW, I had a fixed
/etc/localtimefile created with the Anniversary version, Ubuntu 14, which persisted through an Insider update to 14965 and subsequent upgrade to Xenial.Running
dpkg-reconfigure tzdatareplaced it with a symlink and nowdateshows EST instead of STD.TL;DR Agree, but in reality, I think the best we can hope for is to have
/etc/localtimebe 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/localtimefile instead, as explained here.I also think the WSL should symlink
/etc/localtimerather 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/Berlinis any less nonsense than/usr/share/zoneinfo/Msft/localtimeAnother possibility is to set the
TZenvironment value in your.bashrcas mentioned here. For programs that honorTZ, this should work. For example, add:And now it doesn’t matter who messes up
/etc/localtime