[systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

Alvin Šipraga alsi at bang-olufsen.dk
Tue Sep 8 21:54:15 UTC 2020


Hi,

On 9/8/20 4:12 PM, Colin Guthrie wrote:

> 2. Set your /etc/ master image to make /etc/localtime to be a symlink to
> /run/localtime and then ensure /run/localtime is a symlink to the
> appropriate file in /usr during early boot (e.g. in initramfs). Then
> when you want to to change the timezone, just update the /run/ symlink.

This might not work as expected - systemd sometimes assumes that
/etc/localtime is a symlink into /usr/share/zoneinfo and will not
understand double symlinks. See src/basic/time-util.c:get_timezone() for
at least one example.

It's not too difficult to work around and I can provide a patch if
anybody wants it, although I don't think it will safely deal with
circular symlinks. It isn't something that upstream will be interested
in accommodating, based on Lennart's reasoning in this thread.

If you choose to go this way, /etc/localtime could also point to a
symlink on a rw mounted filesystem, allowing for writable and persistent
storage of timezone settings. But as Colin points out, you won't be able
to make such changes with systemd tooling.

The bind mount solution will probably work without patching systemd,
assuming that it doesn't disagree with the mender restrictions you
mentioned.

Alvin


More information about the systemd-devel mailing list