Migrating from 3.4.0 to 4.0.0

APT caught me off guard. I did not intend to do an upgrade on my openhab installation, but I hit ‘Y’ without thinking.

Preparing to unpack .../25-openhab_4.0.0~S3513-1_all.deb ...
Unpacking openhab (4.0.0~S3513-1) over (3.4.0~S3170-1) ...
Preparing to unpack .../26-openhab-addons_4.0.0~S3513-1_all.deb ...
Unpacking openhab-addons (4.0.0~S3513-1) over (3.4.0~S3170-1) ...

I did not have Java17 installed, and so the upgrade failed.

[openHAB] WARNING: We were unable to detect Java 17 on your system. This is needed before openHAB can be started.
[openHAB] Please install the current version of Java 17 or check the openHAB documentation for details.
[openHAB] Running JSON Database upgrade tool (${OPENHAB_RUNTIME}/bin/upgradetool.jar).
Error: LinkageError occurred while loading main class org.openhab.core.tools.UpgradeTool
	java.lang.UnsupportedClassVersionError: org/openhab/core/tools/UpgradeTool has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes 
class file versions up to 55.0
[openHAB] WARNING: internal database upgrade tool failed.
[openHAB] please check the openHAB website (www.openhab.org) for upgrade requirements.

I have Java17 now. Debian machine.

==> openhab.log <==
2023-06-27 15:12:06.446 [WARN ] [service.spi.util.WebContainerManager] - Can't get a WebContainer service from {org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer}={org.ops4j.pax.web.log.ncsa.extended=true, org.ops4j.pax.web.ssl.keystore.password=********, service.scope=bundle, org.ops4j.pax.web.ssl.key.password=********, org.ops4j.pax.web.session.cookie.name=JSESSIONID, org.osgi.service.http.connector.name=default, org.ops4j.pax.web.enc.iterationcount=1000, org.ops4j.pax.web.log.ncsa.file=yyyy_mm_dd.request.log, org.ops4j.pax.web.server.eventDispatcherThreadCount=1, org.osgi.service.http.checkForwardedHeaders=false, org.ops4j.pax.web.enc.suffix=), org.ops4j.pax.web.digestAuth.maxNonceAge=60000, org.ops4j.pax.web.ssl.ciphersuites.included=, org.ops4j.pax.web.session.url=jsessionid, org.ops4j.pax.web.formAuth.errorRedirect=false, org.ops4j.pax.web.ssl.ciphersuites.excluded=^.*_(MD5|SHA|SHA1)$,^TLS_RSA_.*$,^SSL_.*$,^.*_NULL_.*$,^.*_anon_.*, org.ops4j.pax.web.enc.prefix=ENC(, org.ops4j.pax.web.server.maxThreads=50, org.ops4j.pax.web.validatePeerCerts=false, service.id=130, org.ops4j.pax.web.session.cookie.maxAge=-1, org.ops4j.pax.web.ssl.truststore.password=********, org.ops4j.pax.web.ssl.session.cacheSize=-1, org.ops4j.pax.web.ssl.truststore.type=JKS, org.ops4j.pax.web.ssl.keystore.type=JKS, org.ops4j.pax.web.ssl.session.enabled=true, org.ops4j.pax.web.ssl.protocol=TLSv1.3, org.osgi.service.http.port=8080, org.ops4j.pax.web.log.ncsa.file.date.format=yyyy-MM-dd, org.ops4j.pax.web.ssl.renegotiationLimit=-1, org.osgi.service.http.secure.enabled=true, org.osgi.service.http.enabled=true, org.ops4j.pax.web.server.idleTimeout=300000, org.ops4j.pax.web.log.ncsa.retaindays=90, org.ops4j.pax.web.log.ncsa.logtimezone=GMT, org.ops4j.pax.web.enc.algorithm=PBEWithHmacSHA256AndAES_128, org.ops4j.pax.web.validateCerts=false, org.ops4j.pax.web.config.files=/usr/share/openhab/runtime/etc/jetty.xml, org.ops4j.pax.web.ssl.renegotiationAllowed=true, org.ops4j.pax.web.digestAuth.maxNonceCount=1024, org.ops4j.pax.web.enableOCSP=false, org.ops4j.pax.web.ssl.clientauth.needed=false, org.ops4j.pax.web.enc.enabled=false, org.osgi.service.http.port.secure=8443, javax.servlet.context.tempdir=/var/lib/openhab/tmp, org.ops4j.pax.web.enableCRLDP=false, org.ops4j.pax.web.server.connector.idleTimeout=30000, org.ops4j.pax.web.session.timeout=10, org.ops4j.pax.web.ssl.clientauth.wanted=false, org.ops4j.pax.web.ssl.protocols.excluded=SSL,SSLv2,SSLv2Hello,SSLv3, service.bundleid=222, org.ops4j.pax.web.server.minThreads=2, org.ops4j.pax.web.session.cookie.secure=false, org.ops4j.pax.web.enc.masterpassword=********, org.ops4j.pax.web.log.ncsa.append=true, org.osgi.service.http.secure.connector.name=secureDefault, org.ops4j.pax.web.ssl.session.timeout=-1, org.ops4j.pax.web.listening.addresses=0.0.0.0, org.ops4j.pax.web.log.ncsa.buffered=true, org.ops4j.pax.web.session.cookie.sameSite=unset, org.ops4j.pax.web.log.ncsa.enabled=false, org.ops4j.pax.web.ssl.protocols.included=, org.ops4j.pax.web.session.cookie.httpOnly=true, org.ops4j.pax.web.server.showStacks=false}

What do I need to do to finish the migration process?

Install Java 17 and then run the upgrade tool (java -jar $OPENHAB_RUNTIME/bin/upgradetool.jar) manually.

As usual, there will likely be some manual changes required to your config. Look through the announcement threads for the OH 4 milestone releases to see if any breaking changes apply to you.

And if you only plan on upgrading every couple of years or so, I strongly recommend converting to the release repo, upgrading to OH 4 release when it comes out in a few weeks and sticking to the release repo. There is really no reason be running snapshots long term.

2 Likes

Rick, you are amazing.
Yeah, I didn’t intend to upgrade to a milestone. I probably changed my apt configuration to get a bug fix for the weatherstation.
It looks like I’m back up. Now I need to go read the breaking changes.

Hi there,

I don’t know how to migrate to openhab 4.0.0 simply because when I type the command “sudo apt-get update”, I have this error for openhab:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease: The following signatures were invalid: EXPKEYSIG 075721F6A224060A openHAB Bintray Repositories <owner@openhab.org>
W: Failed to fetch https://openhab.jfrog.io/artifactory/openhab-linuxpkg/dists/stable/InRelease  The following signatures were invalid: EXPKEYSIG 075721F6A224060A openHAB Bintray Repositories <owner@openhab.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.

I have two servers, one on Ubuntu and another on Raspberry Pi 3 and the exact same error on both.

What should be done?

Thanks!

1 Like

Thank you very much :blush:, I’m just 3 days late actually :sob::joy:. So I will do this…

This post is/was a banner, so you must have seen it….

Hello,

i am in the same situation as the topic creator and trying to execute that command properly.

admin@openhabian:/var/lib/openhab $ sudo java -jar $OPENHAB_RUNTIME/bin/upgradetool.jar
Please either set the environment variable ${OPENHAB_USERDATA} or provide a directory through the --dir option.

My issue is that i could not really make it work as i could not define the OPENHAB_USERDATA.
Can you please maybe help me a little more to understand on how to manually start the upgrade again to make openhab work ?

Thanks a lot

Any time you see $something that means it’s depending on an environment variable. On forum postings those are used because the path to that folder on openHABian is different from Linus is different from Mac is different from Windows. See the installation docs for the locations of those folders for your specific installation. For example, here’s the table for Linux.

I think for an apt install and definitely for an openHABian install, these environment variables are set for you.

Note that I did not use sudo in my example above. These environment variables are almost certainly not available for user root.

Thanks a lot - that really helps and worked now for me.
Cheers!

once trying to migrate to OH4.0.1 I faced the same issue but was not able to install manually as proposed. Was can I do?

Error: LinkageError occurred while loading main class org.openhab.core.tools.UpgradeTool
	java.lang.UnsupportedClassVersionError: org/openhab/core/tools/UpgradeTool has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

trying to execute via the openhabian config menue 45 (openJDK17) is reporting

2023-08-09_18:03:52_CEST [openHABian] Fetching OpenJDK 17… FAILED
2023-08-09_18:03:56_CEST [openHABian] Installing OpenJDK 17… FAILED

Still on buster ? Upgrade to bullseye.

thought a warning should be shown then.

In case this

would be not related to buster ( @rene1879 ) make use of openhabian debug mode which will show more details about the root cause why OpenJDK17 canot be fetched.

decided to make a clean install… topic closed (for me)

Hello OH4 friends…

After now:

  • add on installing, from JS script,

  • manual updating Unit’s (UoM) from the most used items I active use devices, so not the 1200 which I have in total

  • installing from DEV version from bindings (shelly)

  • partly regenerating and checking and running my 60 rules in JavaScript and Blockly

  • delete and generate several new item e.g. number:power instead of number:engery

  • refreshment from my dashboards from temperature, humidity, and power because the values have not more have the right units anymore

  • and installing two new shelly HT

which have been taken several days and nights, and now a couple of day’s running without significant problems, I have now today made a copy of the installation from my test system and used the copy now as the new main productive system from my smart home.

THANKS for all contributors, special @hmerk

If I’m ask for a whish because we only have 137 days to Christmas day, I would like to see BEFOREHAND official version is released an detailed F&Q and a known problems information also for “dummy users”, and at least some guidance how to eliminate the frustration from 3.4.4 to 4.0.1 migration.

Thanks, in advanced.

1 Like

This is an Open Source project run by volunteers.

So go, contribute your share:
Install 4.1-SNAPSHOT now, keep testing alongside ongoing development, and start writing that FAQ.

1 Like

We do our best. It the announcements and list of breaking changes. But there are so few users who run the snapshots for testing leading up to a release so not everything gets caught. And only a fraction of those who have the time to volunteer to both report bugs and help diagnose problems and help others on the forum.

2 Likes

Hey, I am trying to upgrade to 4.0. I had 2.0 running stable, tried out 3.0 but never got it to run. Now I am trying again to upgrade to 4.0 but I am getting the same issues as above:

Java 17 (zulu) is installed but is not recognized by the new openhab installation:

[openHAB] WARNING: We were unable to detect Java 17 on your system. This is needed before openHAB can be started.

… and the migration tool fails due to the package incompatibility:

java.lang.UnsupportedClassVersionError: org/openhab/core/tools/UpgradeTool has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I followed all the steps from some guides but the guides are simply incomplete.
Any real guidance out there?

Tell us more details abour your system.
Are you on Bullseye?
Did you make java 17 the default after installing it?

The thing is that in the installation guide there are some steps that not apply to all installations, like the dependencies to apt-transport-https, that is already installed on my system.

On the other side, the dependency to Java is not even mentioned.
After following the guide under How to Install Java-17 on Raspberry Pi
it all worked as intended.
But I needed to apt-get reinstall openhab several times until I understood how it is meant.