What's new

Entware Timezone Issue

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

sbsnb

Very Senior Member
I have an RT-AC88U on Merlin 3.84.7_2 with:
Code:
/etc/locatime -> /opt/share/zoneinfo/US/Pacific
AND
Code:
export TZ=:/opt/share/zoneinfo/US/Pacific
in /opt/etc/profile and yet my Entware applications are putting GMT times in the system log. I have rebooted the router several times and the above changes survive the reboots, but the issues remain. /opt/share/zoneinfo/US/Pacific exists with the proper permissions. What am I missing?
 
This post gave me the idea to try:
Code:
/opt/etc/localtime -> /opt/share/zoneinfo/US/Pacific
Which also did not fix the issue.
 
It appears that it's only dnscrypt-proxy2 that's having this issue. The other Entware apps are behaving.
 
Try exporting TZ in the command line that launches dnscrypt, to ensure it's available to that process.
 
I tried this as well.
Sorry, just wanna confirm: Did you really click the link and use the one command there?
Because based on the stuff you posted, it looked like they were taken from old guides. I overlooked and used the old Entware-ng repo guide, it took me a half hour to realize that.
 
Sorry, just wanna confirm: Did you really click the link and use the one command there?
Because based on the stuff you posted, it looked like they were taken from old guides. I overlooked and used the old Entware-ng repo guide, it took me a half hour to realize that.
Yep. Here's the screenshot from PuTTY.
O9gknbL.png
 
I think this goes beyond entware. I just noticed that service restart_foo also creates UTC times in the syslog instead of local time.
 
Thank you. I do already have

export TZ=:/opt/share/zoneinfo/US/Pacific

in my /opt/etc/profile. I'm starting to think it has to be a problem with the zoneinfo. None of the files are human-readable, but all of these configuration suggestions imply that it should be. For example if I open /opt/share/zoneinfo/US/Pacific in nano, it looks like this:
Code:
TZif2^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^E^@^@^@^E^@^@^@^@^@^@^@�^@�^@�^@�^@�^$
�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^F�^
���^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^K�^$
�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�$
�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�$
���^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^@�^$
�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�^P�$
����������������������
 
Thank you. I do already have

export TZ=:/opt/share/zoneinfo/US/Pacific
in my /opt/etc/profile. I'm starting to think it has to be a problem with the zoneinfo.
Please try it as in the post which sets it to the contents of /etc/TZ
The syslog is driven from the base kernel, not entware. I don't think the logger may recognize the format you are using. On my system TZ=GMT7
 
Please try it as in the post which sets it to the contents of /etc/TZ
The syslog is driven from the base kernel, not entware. I don't think the logger may recognize the format you are using. On my system TZ=GMT7
Btw, I'm at GMT+7, my /etc/TZ is GMT-7, but the date command would show this:
Thu Nov 22 22:59:55 GMT 2018
Don't know if this is normal?
 
Please try it as in the post which sets it to the contents of /etc/TZ
The syslog is driven from the base kernel, not entware. I don't think the logger may recognize the format you are using. On my system TZ=GMT7
No luck.
Code:
admin@RT-AC88U:/# cat /opt/etc/profile
#!/bin/sh

# Please note it's not a system-wide settings, it's only for a current
# terminal session. Point your f\w (if necessery) to execute /opt/etc/profile
# at console logon.

is_substring(){
    case "$2" in
        *$1*) return 0;;
        *) return 1;;
    esac
}

# Set CHECK_OPT_PATH to 1 to check /opt/bin and /opt/sbin in PATH
CHECK_OPT_PATH=0
if [ $CHECK_OPT_PATH = 1 ]; then
    is_substring "/opt/bin" $PATH
    [ $? == 1 ] && export PATH=/opt/bin:$PATH
    is_substring "/opt/sbin" $PATH
    [ $? == 1 ] && export PATH=/opt/sbin:$PATH
else
    export PATH=/opt/bin:/opt/sbin:$PATH
fi
export TERMINFO=/opt/share/terminfo
export TERM=xterm
export TMP=/opt/tmp
export TEMP=/opt/tmp
unset LD_PRELOAD
unset LD_LIBRARY_PATH
alias mc="mc -c"

# You may define localization
#export LANG='ru_RU.UTF-8'
#export LC_ALL='ru_RU.UTF-8'
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
export TZ=$(cat /etc/TZ)

admin@RT-AC88U:/# echo $TZ
PST8DST,M3.2.0/2,M10.2.0/2

syslog entries from dnscrypt are still GMT after reboot (and before).
 
syslog entries from dnscrypt are still GMT after reboot (and before).
Is dnscrypt the only one now misbehaving? If you go back in the dnscrypt history, the author had to make a change for the date to be correctly picked up. Sounds like he may have broken it again.
 
Could be an issue with go. According to the comments in the sources, go expects the TZ variable to be the name of the zoneinfo file:

Code:
// $TZ="foo" means use /usr/share/zoneinfo/foo.

Of course, trying to read /usr/share/zoneinfo/PST8DST,M3.2.0/2,M10.2.0/2 will return an error and go will default to UTC.
 
maybe try setting the timezone in /jffs/configs/profile.add to the /etc/TZ value, so it's read in what the router expects when the shell opens, then reset it to what dnscrypt expects in the entware start script?
 
maybe try setting the timezone in /jffs/configs/profile.add to the /etc/TZ value, so it's read in what the router expects when the shell opens, then reset it to what dnscrypt expects in the entware start script?

There's something more going on. The go source suggests it will read /etc/localtime if TZ isn't set, but dnscrypt-proxy isn't doing that. This is starting to seem like a lot of work just to get the time to appear right in the syslog. I just don't know why time is such a difficult issue for this particular application.
 
Could try this from one of our old threads...
in: /opt/etc/init.d/rc.func

right before $PRECMD line in start() function add:
Code:
export TZ=$(cat /etc/TZ)
This is generic then to all Entware apps which might have the issue. No per app based change needed. No hand crafting TZ string either.
 
After extensive testing I can report that dnscrypt-proxy2 is looking for /etc/localtime to be linked appropriately AND TZ is not set. If TZ is set dnscrypt-proxy2 will ignore /etc/localtime, and it wants TZ to be the path to the TZ file, not the usual timezone info.
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top