Persistent timezone for specific standalone vms

as per this post, there are two mechanisms by which the time is set in a qube:

  1. at system boot, the dom0 timezone is read as part of qubes-early-vm-config.service, using the qubesdb-read /qubes-timezone command.
  2. regularly, as part of qubes-sync-time.service, using the qubes.GetDate RPC call. But this only pulls UTC time for synchronisation purposes and sets it using date -u; so it’s not relevant for timezones.

Using timedatectl set-timezone will work to change the timezone in a given qube, but with two caveats:

  1. At least in Debian 12 templates, as part of qubes-early-vm-config.service also the config file /etc/timezone will be set; this is a debian-specific file that is largely useless. This file is ignored by timedatectl set-timezone, so once it gets set, it will contain your dom0 timezone, unless you delete it. Presumably in R4.3 this stops being an issue if you use anon-timezone with qvm-features (but I haven’t checked).
  2. The timezone info still remains in qubesdb, unless you run qubesdb-rm /qubes-timezone to delete the entry (again, not necessary if you use anon-timezone).

tl;dr if you’re on R4.2, make sure you delete /etc/timezone and run qubesdb-rm /qubes-timezone

OTOH, timedatectl set-timezone does change /etc/localtime, so it’s not necessary to link it again manually.

1 Like