Why does an update overwrite the time zone?

I just updated OH from 5.1.3 to 5.1.4.

The Update log showed:

OK
2026-04-17_19:54:21_CEST [openHABian] Optimizing openHAB to run on low memory single board computers...
$ sed -i -e s|^EXTRA_JAVA_OPTS=.*$|EXTRA_JAVA_OPTS="-XX:-TieredCompilation -XX:TieredStopAtLevel=1 -XX:+ExitOnOutOfMemoryError -Dxtext.qn.interning=true"|g /etc/default/openhab 
OK
2026-04-17_19:54:21_CEST [openHABian] Setting openHAB HTTP/HTTPS ports...
$ sed -i -e s|^#*.*OPENHAB_HTTP_PORT=.*$|OPENHAB_HTTP_PORT=8080|g /etc/default/openhab 

$ sed -i -e s|^#*.*OPENHAB_HTTPS_PORT=.*$|OPENHAB_HTTPS_PORT=8443|g /etc/default/openhab 
OK
2026-04-17_19:54:21_CEST [openHABian] Setting openHAB timezone...
$ sed -ri s|^(EXTRA_JAVA_OPTS.*?)(interning=true)?"|\1\2 -Duser.timezone=Europe/London"|g /etc/default/openhab 
OK

Question -

  1. why is the setting for openHAB timezone overwritten at all?
  2. and if necessary, not set to “Europe/ Berlin” (MEZ) which should fit for the majority of users?

It would spare us editing the “/etc/default/openhab” after each update - or finding out later that a lot of stuff runs an hour too late…

Search the forum for linux.parameters.

I think you are on the wrong track, here :person_shrugging:

The start of the code in question is here

Based on the comment it is supposed to use the following order when setting the timezone.

 # tz sources order: 1) /etc/openhabian.conf  2) /etc/timezone  3) default UTC

Do you have a timezone defined in /etc/openhabian.conf? What is in /etc/timezone?

openHABian doesn’t know if this is the first run or an upgrade opr if you’ve changed something so it always runs all parts of the setup. It’s supposed to be idempotent but that’s really hard to do. There is definitely some sort of logic flaw here.

The error is one this line:

  tz=$(cat /etc/timezone 2>/dev/null); timezone=${timezone:=$tz}

If I understand that line correctly, the first “line” tries to read /etc/timezone into $tz. The second “line” sets $timezone to the value of $tz but only if it’s not already set.

So either /etc/timezone is set to Europe/Londonor $timezone was set elsewhere in the script already. So where is $timezone set? The only place that variable is set (besides the above line) is in openhabian.conf.

So the comment seems to be correct. The default unmodified openhabian.conf sets $timezone to Europe/London. If timezone doesn’t exist in openhabian.conf /etc/timezone is used.

Part of the logic flaw is "why does openhabian.conf not have the correct timezone in the first place? The instructions for installing openHABian have you edit this file before the first boot (it’s how you set the WiFi and such) so there should never have been a situation where openhabian.conf doesn’t have the correct timezone defined in it.

Maybe some users are installing openHABian without first setting these variables? It doesn’t look like openhabian-conf edits this file later when you use it to change the timezone, but I may have missed that part of the code.

Maybe when openHABian updates itself it also updates openhabian.conf, but if that were the case it would be messing with all sorts of other stuff too, not just the timezone.

So we are back to :person_shrugging: . Either you never set the timezone in openhabian.conf, in which case openHABian is doing exactly what you are telling it to do, setting your timezone to what’s in that config file, or we still don’t know why this is happening.

I think maybe a pluarility of users but definitely not a majority of users.

Thank you, checked my settings:

/etc/openhabian.conf was on “Europe/London”
/etc/timezone was on “Europe/Berlin”

…?

Strange, because I did a fresh install for OH 5.0 where I definitely set the timezone to “Europe/Berlin”.

Set it where and how?

Ultimately, based on the code, what ever is /etc/openhabian.conf is going to be what’s used. And that initially gets populated with /boot/openhabian.conf.

As I said above, I don’t know if changing the timezone using openhabian-conf will modify that file (technically speaking it shouldn’t, only users should modify files under /etc).

So if you didn’t set the timezone in openhabian.conf when you first installed, or didn’t modify it later, the default will still apply.

But there also could be an issue where openHABian overwites that file when it upgrades itself.

A quick scan of the source code seems to indicate that only happens if the file doesn’t already exist in /etc: openhabian/openhabian-setup.sh at 3bfc367c431da699ca72629e2e91978a3d15185a · openhab/openhabian · GitHub

And I did find a function that implies that config changes mademight be stored in /etc/openhabian.conf after all: openhabian/functions/openhabian.bash at 3bfc367c431da699ca72629e2e91978a3d15185a · openhab/openhabian · GitHub

Looking at all usages of this function shows it’s only for the mail configuration: openhabian/functions/packages.bash at 3bfc367c431da699ca72629e2e91978a3d15185a · openhab/openhabian · GitHub

So we are still left with the mystery. Either you never set the timezone in that file before, or something yet to be found has overwritten that file.

@openhabgs and on which platform? which openHABian version?

Correct it doesn’t edit openhabian.conf.

Platform is Raspberry Pi 4, OH Version was 5.0, I used the image provided by the Raspberry PI Imager.
Then I used the settings 32,33,… in openhabian-config to set locale and timezone.

Note that the version of openHABian doesn’t match the version of openHAB itself. When you run ipenhabian-config it should tell you what version of openHABian you are running.

That’s probably it. You didn’t set these using openhabian.conf before the first boot. That means openhabian.conf retains the defaults which is Europe/London for the timezone.

openhabian-config doesn’t change this file.

So every time openHABian updates, it resets the timezone.

The solution is:

users:

  • always set the timezone and locale in /boot/openhabian.config along with user info and Wi-Fi and all that before that first boot
  • if you didn’t do that, edit /etc/openhabian.conf add make sure all the settings are what you want including the timezone

developers:

  • it’s been awhile since I read the docs, maybe they need to emphasize editing the config before the first boot more forcefully
  • it is unexpected to be able to set the timezone through openhabian-config but that setting not stick. Something should be done about that (warning to manually edit the config, edit the config itself, etc).