Timezone information is set from within a snap but is displayed as UTC by timedatectl
. Here is what I try:
I connect timezone-control
interface to my snap.
I set timezone from within the snap using timedatectl
, e.g. timedatectl set-timezone Europe/Berlin
I check the outcome:
$ timedatectl
Local time: Tue 2020-05-05 14:53:16 CEST
Universal time: Tue 2020-05-05 12:53:16 UTC
RTC time: n/a
Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 18 Apr 27 16:35 /etc/localtime -> writable/localtime
$ ls -l /etc/writable/localtime
lrwxrwxrwx 1 root root 33 May 5 14:53 /etc/writable/localtime -> /usr/share/zoneinfo/Europe/Berlin
$ date
Tue May 5 14:55:40 CEST 2020
$ journalctl | grep zone
May 05 14:41:47 iot-gw audit[1129]: AVC apparmor="ALLOWED" operation="open" profile="snap.osram-dispatcher.dispatcher//null-/usr/bin/sudo" name="/usr/share/zoneinfo/GB" pid=1129 comm="sudo" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
May 05 14:41:47 iot-gw audit[1137]: AVC apparmor="ALLOWED" operation="open" profile="snap.osram-dispatcher.dispatcher//null-/usr/bin/sudo//null-/bin/date" name="/usr/share/zoneinfo/GB" pid=1137 comm="date" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
May 05 14:44:14 iot-gw systemd-timedated[1671]: /etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.
May 05 14:52:51 iot-gw dbus-daemon[867]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.11' (uid=1000 pid=2908 comm="/usr/bin/timedatectl.real set-timezone Europe/Berl" label="unconfined")
May 05 14:52:51 iot-gw systemd-timedated[2910]: /etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.
May 05 14:53:04 iot-gw systemd-timedated[2910]: Changed time zone to 'Europe/Berlin'.
May 05 14:57:10 iot-gw systemd-timedated[3566]: /etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.
May 05 14:58:34 iot-gw audit[3769]: AVC apparmor="ALLOWED" operation="open" profile="snap.dalipro-iot.dalipro-iot//null-/bin/journalctl" name="/usr/share/zoneinfo/Europe/Berlin" pid=3769 comm="journalctl" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
May 05 14:58:47 iot-gw audit[3802]: AVC apparmor="ALLOWED" operation="open" profile="snap.dalipro-iot.dalipro-iot//null-/bin/journalctl" name="/usr/share/zoneinfo/Europe/Berlin" pid=3802 comm="journalctl" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
But if I check again after just a minute or two, timedatectl
displays the timezone as UTC:
$ timedatectl
Local time: Tue 2020-05-05 12:57:10 UTC
Universal time: Tue 2020-05-05 12:57:10 UTC
RTC time: n/a
Time zone: n/a (UTC, +0000)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no