Timezone resinos/docker

Not sure if its an addon, but a way to set timezone so that when you check your logs with
journalctl -f -u resin-supervisor.service
The timestamp is correct.

I guess this might not be a addon, but more like a function in the core.
Maybe it could be a function that checked the timezone set in configuration.yaml and then updated the core with the same timezone?

Feel free to move this post if it is not suitable in this thread.

The reason for timezone is that resinos run on UTC and docker default also. Since we support different system, I think we are not able to have a other solution for that.

But the only things that make “wrong” is the timezone from logs. HomeAssistant run internal also on UTC and the timezone settings are only for frontend.

At the end it is more easy to use UTC on every point of system like HomeAssistant does. The only things that we lost is the log file timestamp.

I’m open for a other solution. But they need easy handling, since the only benefit is for log files. It need to work with all add-ons and all docker system (OSX, Windows, all Linux systems). It need to Support resin-os.

Hi, Im having problems with the UTC time. UTC in HASS.io is +1 hour from the actual UTC.

On resinos or generic?

I see also a bug with OTA update from 0.7 to 0.8 that breake the sysemd timesync. I will look to new overlay in systemd on OTA update script. So should the next update fix that too

I found a easy solution for handling timezone. I add this to next release

The timesync issue would be good to get fixed as soon as possible as well. Some API requires that the timing is right (i suspect that telldus is one of them)

The time on my installations resets to may 19 when it is rebooted. So its quite alot off in time. (on three different installations)

Do you run with version 0.8 ? Do you have reflash from 0.7 or use OTA update for 0.8?

It would also be useful to have an api to manually set the time in the case NTP is not available.

I used the OTA to update to 0.8.

Now i added my ssh key to resin host os. And from what i can see systemd cant create the temp files it needs and timesyncd is dependant on that.

There is a bug from update 0.7 to 0.8 with OTA update. I try to find out how I can fix it. It lool like the systemd-timesync don’t run anymore. 0.8 based on resinos 2.0.3 and that use a persistant /var/lib/systemd and that should make that the time will be save over reboot. I need more tests do make at evening to look if that will work or need a other systemd service for timerestore.

I try to fix also the OTA updater for > resinos 2.0.3 so that the things will work after next OTA update correct agen.

ResinOS use this:
https://www.freedesktop.org/software/systemd/man/systemd-timesyncd.service.html

Is that running on your system?

Nope. As earlier systems scripts that timesyncd depends on fails it won’t start.

I think it is systemd-temp files something that fails

I’ll can check what it says in resin

If the issue is with docker, I simply add this: -v /etc/localtime:/etc/localtime:ro
by call from
docker run
(running on CentOS).

From journalctl -xe in resin

May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mhome-root-.rnd.mount: Failed to check directory /home/root/.rnd: Not a directory[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting OpenSSL random state bind mount…
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting NetworkManager system connections bind mount…
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39metc-resin\x2dsupervisor.mount: Directory /etc/resin-supervisor to mount over is not empty, mounting anyway.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting ResinOS supervisor configuration…
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting Docker key.json bind mount…
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39metc-systemd-system-resin.target.wants.mount: Directory /etc/systemd/system/resin.target.wants to mount over is not empty, mounting anyway.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting Resin target mount point to persistent location…
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39metc-hostname.mount: Failed to check directory /etc/hostname: Not a directory[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting ResinOS hostname…
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mhome-root-.ssh.mount: Directory /home/root/.ssh to mount over is not empty, mounting anyway.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Mounting SSH authorized_keys state bind mount…
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted NetworkManager system connections bind mount.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted OpenSSL random state bind mount.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted Docker key.json bind mount.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted ResinOS supervisor configuration.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted OpenSSL random state bind mount.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted SSH authorized_keys state bind mount.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted Resin target mount point to persistent location.
May 19 23:02:05 raspberrypi3 systemd[1]: Mounted ResinOS hostname.
May 19 23:02:05 raspberrypi3 systemd[1]: Started Bind mount volatile /var/lib.
May 19 23:02:05 raspberrypi3 systemd[1]: Reached target Local File Systems.
May 19 23:02:05 raspberrypi3 systemd[1]: Starting Tell Plymouth To Write Out Runtime Data…
May 19 23:02:05 raspberrypi3 systemd[1]: Starting Create Volatile Files and Directories…
May 19 23:02:05 raspberrypi3 systemd-tmpfiles[531]: [[0;1;31msymlink(…/proc/self/mounts, /etc/mtab) failed: Read-only file system[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Started udev Kernel Device Manager.
May 19 23:02:05 raspberrypi3 systemd-tmpfiles[531]: [[0;1;39m"/var/tmp" already exists and is not a directory.[[0m
May 19 23:02:05 raspberrypi3 systemd-tmpfiles[531]: [[0;1;39m"/var/log" already exists and is not a directory.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Main process exited, code=exited, status=1/FAILURE[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;31mFailed to start Create Volatile Files and Directories.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mDependency failed for ResinOS persistent systemd state location.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mDependency failed for Load/Save Random Seed.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39msystemd-random-seed.service: Job systemd-random-seed.service/start failed with result ‘dependency’.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mDependency failed for Network Time Synchronization.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39msystemd-timesyncd.service: Job systemd-timesyncd.service/start failed with result ‘dependency’.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39mvar-lib-systemd.mount: Job var-lib-systemd.mount/start failed with result ‘dependency’.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Unit entered failed state.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Failed with result ‘exit-code’.[[0m
May 19 23:02:05 raspberrypi3 systemd[1]: Starting Update UTMP about System Boot/Shutdown…
May 19 23:02:05 raspberrypi3 systemd[1]: Reached target System Time Synchronized.
May 19 23:02:05 raspberrypi3 systemd[1]: Started Tell Plymouth To Write Out Runtime Data.
May 19 23:02:05 raspberrypi3 systemd[1]: Started udev Coldplug all Devices.
May 19 23:02:05 raspberrypi3 systemd[1]: Starting udev Wait for Complete Device Initialization…
May 19 23:02:05 raspberrypi3 systemd[1]: Started Update UTMP about System Boot/Shutdown.
May 19 23:02:05 raspberrypi3 kernel: gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
May 19 23:02:05 raspberrypi3 kernel: bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
May 19 23:02:05 raspberrypi3 systemd[1]: Hardware watchdog ‘Broadcom BCM2835 Watchdog timer’, version 0
May 19 23:02:05 raspberrypi3 systemd[1]: Set hardware watchdog to 10s.
May 19 23:02:05 raspberrypi3 kernel: bcm2708_i2c 3f804000.i2c: BSC1 Controller at 0x3f804000 (irq 83) (baudrate 100000)
May 19 23:02:06 raspberrypi3 systemd[1]: Found device /dev/disk/by-label/resin-boot.
May 19 23:02:06 raspberrypi3 systemd[1]: Found device /dev/disk/by-label/resin-data.
May 19 23:02:06 raspberrypi3 kernel: usbcore: registered new interface driver brcmfmac
May 19 23:02:06 raspberrypi3 systemd[1]: Starting Expand resin-data partition…
May 19 23:02:06 raspberrypi3 systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
May 19 23:02:06 raspberrypi3 systemd[1]: Reached target Sound Card.
May 19 23:02:06 raspberrypi3 systemd[1]: Mounting Resin boot partition mountpoint…

May 19 23:02:06 raspberrypi3 systemd-tmpfiles[581]: [[0;1;31msymlink(…/proc/self/mounts, /etc/mtab) failed: Read-only file system[[0m
May 19 23:02:06 raspberrypi3 systemd-tmpfiles[581]: [[0;1;39m"/var/tmp" already exists and is not a directory.[[0m
May 19 23:02:06 raspberrypi3 systemd-tmpfiles[581]: [[0;1;39m"/var/log" already exists and is not a directory.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Main process exited, code=exited, status=1/FAILURE[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;31mFailed to start Create Volatile Files and Directories.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39mDependency failed for ResinOS persistent systemd state location.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39mDependency failed for Load/Save RF Kill Switch Status.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39msystemd-rfkill.service: Job systemd-rfkill.service/start failed with result ‘dependency’.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39mvar-lib-systemd.mount: Job var-lib-systemd.mount/start failed with result ‘dependency’.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Unit entered failed state.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Failed with result ‘exit-code’.[[0m
May 19 23:02:06 raspberrypi3 systemd[1]: Starting Create Volatile Files and Directories…
May 19 23:02:06 raspberrypi3 systemd-tmpfiles[585]: [[0;1;31msymlink(…/proc/self/mounts, /etc/mtab) failed: Read-only file system[[0m
May 19 23:02:06 raspberrypi3 systemd-tmpfiles[585]: [[0;1;39m"/var/tmp" already exists and is not a directory.[[0m
May 19 23:02:06 raspberrypi3 systemd-tmpfiles[585]: [[0;1;39m"/var/log" already exists and is not a directory.[[0m

So systemd-tmpfiles fails and everything that is ontop of that will then fail as well.

Don’t do that for Supervisor. That need to run with UTC! Use the supervisor timezone Settings for change that on addons/homeassistant too.

Strange, That is only happens with OTA update… I will look what will brake that. It have also not install all systemd stuff after OTA update. I think last change on 2.0.3 have brake the OTA client.

If you make a clean flash with 0.8 it works. I need to check if the /var/lib/systemd/clock now correct restore with 0.8

Ok. A clean flush with Image 0.8 work fine after restart. With resinos 2.0.3 it safe the time over reboot.

So I need only find out why the OTA update have break that and mabe we can make a manual fix.

I think I can make a script that try to wait on first boot to start the Supervisor after time sync.

Any progress on this? Bit of a pain to wipe my config out.

Also, should we be running NTP or something to keep the OS time right ?

Yes I know where the problem is and I need write a new OTA flush util.

But before I write a new OTA updater, I spend a backup/snapshot function to hass.io. So you can also easy reflash your device and with a easy way you can restore all of your machine.

If you affected with that time bug, you need new flash 0.8 or wait until 0.9 is out with new OTA updater.