Upgrade 2 to 3 strategy/planning

Thanks, I’d read both of those and set the permissions by hand.

After reading them after your reply, I tried it with fix permissions on openhabian-config.

Still same, not mapped for I/O.

So, all of the .rrd files were empty (i.e. 0 files size).

I tried brute force, I created a folder and moved them all out of /var/lib/openhab/persistence/rrd4j.

The errors have gone away and the files are populated now.

No clue if that has ramifications down the road…

System time is still 6 hours in the future…

I need to stop for today…my neck is killing me.

But, baby steps right. :slightly_smiling_face:

And, thanks!!!

1 Like

Still applies

hmm…I’m sure you are correct, I dug around the forum a bit and even read some posts you made, but there doesn’t seem to be a definitive “do this to set the java time”. Lots of “I did this”, “that didn’t work for me, I did this”…

I’ll look in more detail in the morning.


Login to your OH system via ssh and then execute


what does it show ?

Here it shows:

      Local time: Sun 2021-06-27 09:49:09 CEST
  Universal time: Sun 2021-06-27 07:49:09 UTC
        RTC time: Sun 2021-06-27 07:49:12
       Time zone: Europe/Berlin (CEST, +0200)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no


openhab-cli console -p habopen env | grep timezone

to see the timezone that is set /used for Java. Returns e.g.:

String          user.timezone   Europe/Berlin

Other stuff to check:

ls -l /etc/timezone  /etc/localtime 
lrwxrwxrwx 1 root root 33 Feb 12 19:46 /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin
-rw-r--r-- 1 root root 14 Feb 12 19:46 /etc/timezone

cat /etc/timezone


               Local time: Sun 2021-06-27 13:40:22 CEST
           Universal time: Sun 2021-06-27 11:40:22 UTC
                 RTC time: n/a
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Noted “NTP service: active” is different from yours “NTP synchronized: yes”.

No clue if that makes a difference.

openhab-cli console -p habopen env | grep timezone

Returns: “No more authentication methods available”, but, “user.timezone Europe/Berlin” is returned without the grep.

“/etc/timezone” contains: “Europe/Berlin”

Isn’t /etc/timezone an OS setting? Can that be changed in the normal Linux admin ways?

What is the definitive way to set the what JAVA thinks?

No. I also saw that depending on the Linux flavour. Have both types here.

What is the timezone that you are looking for ?

Sigh, so in the mean time I looked to see if ntp was installed. Apt said no, so I installed.

Now timedatectl shows:

           Universal time: Sun 2021-06-27 12:21:47 UTC
                 RTC time: n/a
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no

so now it looks like the system is set to the right timezone, but not using NTP?

Edit: It now says:

           Universal time: Sun 2021-06-27 12:31:04 UTC
                 RTC time: n/a
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

But, the OH log still show the wrong time.

The host operating system has a clock - and a timezone.

The Java sub-system has a clock- and a timezone. When you install Java, it guesses timezone based on OS timezone, unless you tell it different. If you later amend the OS timezone, I do not think it changes Java. This is the clock the logger uses.

openHAB application has a clock and a timezone. When you install OH, it guesses timezone based on Java timezone, unless you tell it different. If you later amend the OH timezone, it does not change Java. If you did have to amend OH, it’s a good clue the Java timezone was not what you wanted.

Don’t forget we still do not know what timezone you think is wanted.


After you see timezone being set to EDT.
What is the output again for the other check I posted earlier ? Do they all show EDT related entries now ?

openhabian seems to use timesyncd instead of ntp. You can use the openhabian-config menu 33 entry to switch it on ( again ).

               Local time: Sun 2021-06-27 10:55:01 EDT
           Universal time: Sun 2021-06-27 14:55:01 UTC
                 RTC time: n/a
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

openhab-cli console -p habopen env gets:
user.timezone Europe/Berlin

The for any state change:

2021-06-27 16:53:00.968 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vTimeOfDay' changed from 2021-06-27T10:52:00.961-0400 to 2021-06-27T10:53:00.963-0400```

I just noticed this in the log:
2021-06-27 16:55:01.197 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ntp:ntp:local' changed from OFFLINE (COMMUNICATION_ERROR): The network connection to the timeserver 0.pool.ntp.org cannot be established -> returning current sytem time instead. to ONLINE

1 Like


To get the Java engine going right timezone, you need to pass extra java options parameter as environment variable for container like this:

I’m sure that this is obvious and how to accomplish it is also obvious…but, not to me.

  • there is a JAVA engine, and I knew OH is written in JAVA
  • there is a way (unknown to me) to pass environment variable to the JAVA engine
  • I have no idea where one defines the environment variable
    (is it in some JAVA environment?) (Is it a system environment variable?)
  • I don’t know if this happens dynamically or a reboot is needed, logout/in, restart OH?

10 minutes of web searching I found some posts here that imply it can be added to start.sh by adding this line to top of the file.

export EXTRA_JAVA_OPTS="-Duser.timezone=America/New_York

But, they all show openhab2 directories.

My system has:

$ cd /
$ find . -iname 'start.sh' 2>/dev/null

Sorry to be so thick headed.

It should be possible to add ( no export in front )


that file is sourced from within start.sh which is at /usr/share/openhab/start.sh.

That file already contains:

EXTRA_JAVA_OPTS="-Xms192m -Xmx320m"

So, I should make it?:

EXTRA_JAVA_OPTS="-Xms192m -Xmx320m -Duser.timezone=America/New_York"

Edit: that appears to be good.


1 Like

There is a lot going on here. It looks like you’ve had help with the timezone issue and the rrd4j issue. But I see two questions unanswered.

Probably but I can’t say for sure. That’s really an InfluxDB question about how to transition storage from one machine to another. Typically one would execute a dump of the database on the old instance and a restore on the other machine. But I haven’t used InfluxDB in quite some time so I can’t comment on more than that.

MapDB is very much still supported but it’s a separate add-on. I don’t think you can reuse the old mapdb files in OH 3. But you are now out much. MapDB only saves the most recent values for each Item.

Thanks for the reply.

the rrd4j appears to be working for my number items I want to persist, though it is apparently using whatever default is configured when it is activated.

At this point I still don’t know what I was persisting in mapdb… But, it is not on the addons website, at least I couldn’t find it yesterday.

So this is much like rrd4j, but can handle more than numbers?

I have the old influxdb .cfg file. and I’m wasn’t putting much into it, so ground zero wouldn’t be much of a problem (done that a lot with this…). But, the Graphana pages would be nice to migrate.

Is it best to install Influx from the openhab tool?

on a different note I saw a reference by you about Joda time in OH3.

I think I get the change to

With the Joda way this is 23:00 (I think)

val night_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(1)

and the equivalent would be:

val night_start = now.withHour(23).withMinute(0).withSecond(0)

Did I get that right?

Default strategies are a new thing in OH 3. For rrd4j it’s persist all supported Items on every change and every minute with restoreOnStartup. To change that you need to create an rrd4j.persist file with a different set of strategies.

Probably. I don’t know everything that it does but suspect it will create the DB user and database for you and if you install be hand you’ll have to do those things manually.

Looks like it should work. However, be careful with daylight savings days. You might convert now to a LocalDateTime which takes those things into account better.

val nighty_start = now.toLocalDateTime().withHour(23)...