Hi,
I’m trying to modify the timezone of my Balena device and I have been unable to do it so far… I’ve tried using DBus (preferred way), some accepted commands like timedatectl set-timezone America/New_York
and the Balena way command from https://github.com/balena-io-playground/balena-timezone/blob/master/start.sh --> dpkg-reconfigure tzdata
and and adaptation of that one from Ubuntu forums dpkg-reconfigure --frontend noninteractive tzdata
After trying all 4 ways I’ve been unable to make a single modification, my base image is “intel-nuc-python:3.6.9-run” which uses Ubuntu.
My python code to interact with DBus is:
class Time1ManagerDbus:
def __init__(self):
logger.info("Initializing Dbus controller to handle Time")
self.bus = dbus.SystemBus()
self.manager_proxy = self.bus.get_object(TIMEDATE1_NAME, TIMEDATE1_NAME_PATH)
self.manager_interface = dbus.Interface(self.manager_proxy, TIMEDATE1_NAME)
def set_timezone(self, zone, user_interaction=False):
try:
self.manager_interface.SetTimezone(zone, user_interaction)
except Exception as e:
logger.error("Error configuring device timezone")
logger.error(traceback.format_exc())
return None
else:
return True
if __name__ == "__main__":
time_manager_manager = Time1ManagerDbus()
time_manager_manager.set_timezone("America/New_York")
And the error that I get is:
2019-11-19 18:11:05,271 - root - ERROR - Traceback (most recent call last):
File "/src/src/handlers/dbus_manager.py", line 43, in set_timezone
self.manager_interface.SetTimezone(zone, user_interaction)
File "/usr/local/lib/python3.6/site-packages/dbus/proxies.py", line 72, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/local/lib/python3.6/site-packages/dbus/proxies.py", line 147, in __call__
**keywords)
File "/usr/local/lib/python3.6/site-packages/dbus/connection.py", line 653, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.InvalidArgs: Invalid time zone 'America/New_York'
Has anyone ever done something like this? I already checked the available timezones in /usr/share/zoneinfo/zone.tab
and all timezones are there, but for some reason, Balena does not accept them.
Thanks in advance,