We ship our product globally and and timezone is set by the customer via an UI as it may be the case with many embedded systems.
Using export TZ=‘fullzonename’ would change the timezone accordingly, but not persistently.
Using the “timedatectl set-timezone” command instead makes the edit persistent and changes the time zone by
- writing the file /etc/timezone while concurrently
- adding or changing the symlink /etc/localtime -> /usr/local/share/zoneinfo/…
This timezone setting must of-course survice OTA updates, therefore I wanted to create symlinks in the usual manner, for example: /etc/timezone -> /data/etc/timezone
First, I was optimistic that for /etc/localtime I could make a concatenated symlink, for example: /etc/localtime -> /data/etc/localtime/ -> /usr/local/share/zoneinfo/…
But: This doesn’t work because the “timedatectl set-timezone” command always overwrites any existing symlink named “/etc/localtime -> …” with its own new symlink.
Searching this forum I found this link
where using “mount -t bind /data/localtime /etc/localtime” is recomended.
I am unsure if “mount -t bind” is really necessary here because our rootfs is writable and also feel uncertain about the reliability of this solution.
Are there any ideas how to solve this satisfactory with on a writable rootfs with a persistent /data partition ?