netFIELD App Edge Monitor does not work on Fedora 35 due to missing /etc/timezone
netFIELD App Edge Monitor does not work on Fedora 35 due to missing /etc/timezone
Description and identification
netFIELD App Edge Monitor container crashes some seconds after start, stuck in a restart loop
does not publish any messages to the MQTT broker
related log records written by the container
Traceback (most recent call last):File "index.py", line 370, in <module>scheduler.add_job(File "/root/.local/lib/python3.8/site-packages/apscheduler/schedulers/base.py", line 420, in add_job'trigger': self._create_trigger(trigger, trigger_args),File "/root/.local/lib/python3.8/site-packages/apscheduler/schedulers/base.py", line 921, in _create_triggerreturn self._create_plugin_instance('trigger', trigger, trigger_args)File "/root/.local/lib/python3.8/site-packages/apscheduler/schedulers/base.py", line 906, in _create_plugin_instancereturn plugin_cls(**constructor_kwargs)File "/root/.local/lib/python3.8/site-packages/apscheduler/triggers/interval.py", line 38, in __init__self.timezone = astimezone(timezone)File "/root/.local/lib/python3.8/site-packages/apscheduler/util.py", line 86, in astimezoneraise ValueError(ValueError: Unable to determine the name of the local timezone -- you must explicitly specify the name of the local timezone. Please refrain from using timezones like EST to prevent problems with daylight saving time. Instead, use a locale based timezone name(such as Europe/Helsinki).
Analysis
The netFIELD App Edge Monitor application retrieves the timezone from the /etc/timezone file. The create options include a bind mount "/etc/timezone:/etc/timezone" to share the configured host timezone with the container.
Fedora 35 does not use /etc/timezone to store the configured timezone, the file does not even exist. The timezone info is available following the symlink /etc/localtime is pointing to.
|
Workaround
Generate a /etc/timezone file reflecting the currently set timezone:
this will not be automatically updated when changing the timezone, "snapshots" the currently set timezone and writes it to /etc/timezonesudo rm -rf /etc/timezone; timedatectl show | grep Timezone | awk -F '=' '{print $2}' | sudo tee /etc/timezonenote: due to the bind-mount used by netFIELD App Edge Monitor, there will be an auto-created directory /etc/timezone/ after deploying the container
example result:
[iot-test@tst-nfexts-6953-fedora35 ~]$ cat /etc/timezoneEurope/Berlin[iot-test@tst-nfexts-6953-fedora35 ~]$ ls -lh /etc/localtimelrwxrwxrwx.1root root35Apr508:27/etc/localtime -> ../usr/share/zoneinfo/Europe/Berlin