Search code examples
yoctosystemdreadonly

How to change timezone in read-only rootfs in Yocto poky warrior


I am trying to change the timezone on an embedded Linux (Yocto poky warrior) for Raspberry-pi Cm3. But I am unable to do so. I get an error message stating

root@raspberrypi-cm3:~# timedatectl set-timezone "America/New_York"
Failed to set time zone: Failed to set time zone: Read-only file system

This worked before changing the rootfs to read-only.

How can I change timezone on read-only rootfs?


Solution

  • /etc/localtime is recreated (by an equivalent of ln -fs) by timedated when needed... which obviously can't be done because it's on an RO FS.

    It's not really possible out of the box, you'll need to either pick (and maintain) the following patch or use overlayfs or other kinds of work-arounds.

    See this for full explanation.