Timezone permissions Issue

Hi all,

I am currently facing a permission issue for setting the timezone. I have an application which uses the timedated-dbus interface in order to set the timezone. Running the application with sudo works without any problem.

Now when I run the application as a non-root user, I get a permission-denied error:

Failed to set timezone: DBus error: org.freedesktop.DBus.Error.AccessDenied: Permission denied

which I reckon comes from the missing Polkit rule, which is used as mentioned in the timedate1 page (under security). Only after having add a rule I noticed that the polkit systemd service actually does not use polkit, but it is only used during the build to install polkit library, see bbappend: meta-toradex-torizon/recipes-extended/polkit/polkit_%.bbappend at scarthgap-7.x.y · torizon/meta-toradex-torizon · GitHub

So my guess is that the timedate1 internal polkit call to check permissions will always return false, giving me the permission error.

What can I do about this? Should I install polkit again, or will this trigger other potential issues?
Or should I not use the dbus interface at all for setting the timezone?

Note: I am using Torizon Minimal (7.4.0) on a Verdin IMX8MP.

Best regards
Tim

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Based on your description, you’re encountering a permission issue with the timedate1 D-Bus interface on Torizon Minimal. This is indeed related to the Polkit configuration as you’ve identified.

Understanding Torizon Minimal Limitations

Your analysis is correct - Torizon Minimal has Polkit disabled by design(1). As explained in the Torizon documentation, Torizon Minimal is “nothing more, nothing less than the ‘Full’ Torizon OS without a container engine”(1). However, this seemingly simple change impacts various system features and workflows(1).

Solutions for Timezone Management

Since you’re using Torizon Minimal on a Verdin iMX8MP, you have several approaches:

Option 1: Custom Yocto Build with Polkit

You could modify your Torizon Minimal build to re-enable Polkit by creating a custom layer that overrides the Polkit configuration. However, this requires maintaining your own Yocto build infrastructure(1).

Option 2: Alternative Timezone Setting Methods

Instead of using the D-Bus interface, consider these alternatives:

  • Use direct file system operations (writing to /etc/timezone and updating /etc/localtime)
  • Use the timedatectl command-line tool with appropriate sudo permissions
  • Implement a privileged service that handles timezone changes on behalf of your application

Option 3: Application Architecture Changes

Since your application works with sudo, you could:

  • Run the timezone-setting portion of your application with elevated privileges
  • Create a separate privileged service that handles system configuration changes
  • Use capability-based permissions instead of full root access

Recommendation

Given that you’re on Torizon Minimal, the most straightforward approach would be to avoid the D-Bus interface for timezone setting and instead use direct system calls or the timedatectl command with appropriate privilege escalation. This avoids the complexity of rebuilding your image with Polkit enabled.

The documentation indicates that with Torizon Minimal, “application development is not detached from the base OS updates and dependencies”(1), so any system-level changes like enabling Polkit would require maintaining your own custom build.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Greetings @TimSiegrist,

Just to understand, is your ultimate goal here to be able to change timezone as a non-root user?

If so, this is a bit tricky since most traditional ways to change timezone/time on Linux require elevate permissions. As you noted, without Polkit, this is difficult to bypass.

For what it’s worth we originally started to remove polkit because it in turn depends on mozjs which is a relatively large package and increased the overall size of the OS: polkit: allow to build without polkitd · torizon/meta-toradex-torizon@2326edf · GitHub

Of course if you don’t mind this, then it should be no problem to re-add polkit as a package to the OS.

Otherwise, off the top of my head the other idea I have is to set the TZ variable in the current shell/session:

torizon@verdin-imx8mp-06849059:~$ export TZ='Europe/Warsaw'
torizon@verdin-imx8mp-06849059:~$ date
Thu Apr  9 19:00:47 CEST 2026
torizon@verdin-imx8mp-06849059:~$ export TZ=''
torizon@verdin-imx8mp-06849059:~$ date
Thu Apr  9 17:00:53 UTC 2026

This does not require root permissions at all. Though it only affects the current shell session rather than the system permanently. I guess though you could set this in your .bashrc file to make it pseudo-permanent in a way.

Best Regards,
Jeremias