/etc/localtime dumb, log different timezones

Hello,
I see that /etc/localtime is symlink to /tmp/localtime which does not exist:

# ls -l /etc/localtime
lrwxrwxrwx    1 root     root            14 May 15 10:20 /etc/localtime -> /tmp/localtime
# ls -l /tmp/localtime
ls: /tmp/localtime: No such file or directory

I have logs with multiple timezones:

May 20 07:59:01 gw /usr/sbin/cron[18291]: (root) CMD (/usr/bin/rainbow_button_sync.sh)
May 20 09:59:21 gw kernel: [430381.451226] mv88e6085 f1072004.mdio-mii:10 lan3: Link is Up - 1Gbps/Full - flow control off
May 20 09:59:21 gw kernel: [430381.459716] br-lan: port 4(lan3) entered blocking state
May 20 09:59:21 gw kernel: [430381.465056] br-lan: port 4(lan3) entered forwarding state
May 20 07:59:21 gw netifd: Network device ‘lan3’ link is up

Is this expected behaviour?

The symlink is expected for the build toolchain of glibc https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/libs/toolchain/Makefile#l555

What is unexpected is the absence of /tmp/localtime, that should been generated according to https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/base-files/files/etc/init.d/system#l26

but then /usr/share/zoneinfo/$zonename does not seem been generated and could be a bug.


It seems to be known issue https://gitlab.labs.nic.cz/turris/turris-os-packages/issues/471

It is not a bug but a missing package, installing zoneinfo-core seems to remedy the issue - the missing symlink as well as the timestamps in the logs.

That’s a good finding! Thank you.
We will take a look.

I have installed zoneinfo-core, after install nor reboot /tmp/localtime does not exist. I have set

/etc/config/system: option zonename ‘Europe/Bratislava’

and the /etc/init.d/system script searches for /usr/share/zoneinfo/$zonename

My zone is contained in zoneinfo-europe package. After installing this and running /etc/init.d/system start /tmp/localtime exists, but cron logs are still in UTC
… I’ll reboot again and post the result

Set it via LuCI as it will generate the corresponding timezone and then reboot. Have tried with various zones and it worked, i.e. after the reboot the symlink always been present and no discrepancies in syslog’s timestamps.

The only setting where the symlink is absent is with UTC which is logical.

I have tried that, but the result is the same:

# ls -l /etc/localtime /tmp/localtime /etc/config/system
-rw-------    1 root     root           455 May 21 21:02 /etc/config/system
lrwxrwxrwx    1 root     root            14 May 15 10:20 /etc/localtime -> /tmp/localtime
lrwxrwxrwx    1 root     root            37 May 21 21:02 /tmp/localtime -> /usr/share/zoneinfo/Europe/Bratislava

which means, I still need to have zoneinfo-europe package installed.
Should I expect different results without the package, or will luci install it for me?

Which version of TurrisOS are you running?
I am in version 3 and the timezone is on /tmp/TZ, and /etc/TZ is a symlink.
Still the above method didn’t work for me.

It’s 4.0.5 and TZ is different file than localtime. TZ is removed if zonename exists:

echo "$timezone" > /tmp/TZ
[ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && \
        ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ

so now I have dangling symlink /etc/TZ:

# ls -l  /etc/TZ /tmp/TZ
ls: /tmp/TZ: No such file or directory
lrwxrwxrwx    1 root     root             7 May 15 10:20 /etc/TZ -> /tmp/TZ

and times are still inconsistent:

May 22 10:34:40 gw kernel: [  100.376726] br-lan: port 7(wlan0) entered forwarding state
May 22 08:34:40 gw hostapd: wlan0: interface state DFS->ENABLED
1 Like