Solved: Upgrade from OH3 to OH4 fails on Bullseye (openHAB not starting)

Upgrade from Openhabian point release 3.4.5 failed.

  • I had been on Raspi with Buster, long standing system (Openhabian), did a manual apt upgrade as usual and bricked my installation as automatic upgrade to 4.0 was performed yet underlying Java upgrade failed.
  • Installed openhabian from openhabian-pi-raspios32-202212201337 to migrate from Buster to Bullseye
  • Restored 3.4 backup from previous installation - everything works.
  • openhabian-config: 00 shows openHABian Configuration Tool — [openHAB]{2023-08-02T17:18:05+02:00}(f75ae77) openHAB 3.4.5 - Release Build
  • openhabian-config: 01, choose “Release” branch
  • openhabian-config: 03, install openhab
  • Java 17 upgrade succeeded
  • “Openhab Software Change → Continue”
  • There was an error or interruption during the execution of: “03 | Install openHAB”
  • Setting debug to maximum renders an output where I believe this is the relevant section:
+ apt-get install --allow-downgrades --yes -o DPkg::Lock::Timeout= --option Dpkg::Options::=--force-confnew openhab= openhab-addons=
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Version '' for 'openhab' was not found
E: Version '' for 'openhab-addons' was not found
+ return 100
+ echo FAILED
FAILED

I did not do a manual apt update & upgrade, which would be my natural next impulse, rather I welcome any guidance on locating and addressing the root cause. Thank you so much

Peter
P.S.: Platform is a Raspi 3B

Upgrade to OpenHAB 4 also fails using option 41 of openhabian-config:

I continued with the following steps:

  • I used menu option 41 to update to version 4, which worked without error
  • I then used menu option 20 to upgrade everything
  • Did a reboot

I can still ssh to the Raspi, however the server website is not reachable. The log file shows that something is wrong…

cat /var/log/openhab/openhab.log
2023-08-06 15:50:57.231 [ERROR] [Events.Framework                    ] - FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.xtext [135]
  Unresolved requirement: Require-Bundle: org.objectweb.asm; bundle-version="[9.4.0,9.5.0)"; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.emf.mwe.core; bundle-version="1.3.21"; visibility:="reexport"; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.emf.mwe.utils; bundle-version="1.3.21"; visibility:="reexport"; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.xtend; bundle-version="2.2.0"; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.xtend.typesystem.emf; bundle-version="2.2.0"; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.eclipse.xtext.util; visibility:="reexport"

        at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi-3.18.0.jar:?]

I am not clear how I should do the upgrade nor how I can continue with OpenHAB 3.4.5 in a stable manner, as apt will automatically install OpenHAB 4. I believe I can fix the version somehow to 3.4.5 but didn’t investigate. I’d rather fix version 4…

You’re not the first to hit this but the docs clearly state that buster is outdated and a prerequisite to running openHABian is to be on bullseye.

Why when there’s 1.8.

On a sidenote, you have an issue with the upgrade process but that isn’t what the thread you posted to is about so I moved it.

No it wasn’t 20. 02? 03?

Check out openHAB 4 migration FAQ

Hi Markus,

thank you for you quick reply!

You are right, only it had not been my intent to upgrade to OH4 at all. I was running my long time reliable Openhabian installation which was still on Debian 10 (basis for Openhabian when it was first installed). I merely did “apt update” and “apt upgrade” to maintain my installation, didn’t expect I would get an upgrade to OH4.

Thanks for pointing to the FAQ, I hadn’t seen that before. I found several statements that backups can only be restored to the same version they had been issued with. So I assumed that I would need to install a 3.4 release first in order to restore from the OH 3.4 backup. I see in the FAQ that there is another way and the current Openhabian release is able to restore an OH3 backup. Thank you for the clarification.

Still, I succeeded in restoring OH 3.4.5 based on the Openhabian point release with everything working, but now based on Debian 11. I had assumed I could upgrade from there via the menu options to OH4.

Of course, I am sorry, the options for upgrading from that situation that I tried were:

  • 01
  • 03 (Java 17 succeeded, upgrade failed due to version being empty)
  • 41 (worked without error)
  • 02 (not 20) to update everything

Then Openhab doesn’t start due to the quoted Java error.

I will try the path recommended in the FAQ starting with the 1.8 image right away with using 3.4. backup. Thank you!

Well. The menu text of 02 says
02 | Upgrade System Update all installed software packages (incl. openHAB) to their latest version
so what else did you expect.

This ( upgrade to OH4 ) through apt upgrade happened because OH4 recently was made stable release.

I am sorry, no offense meant. I appreciate the terrific work you are providing and am very thankful. I was just trying to explain my reasoning, hoping it might help others. I regurlarly use ‘apt upgrade’ to maintain security and did not expect a breaking change, but could have looked at the package list up for upgrade. This can be accomplished with:

apt list --upgradable

Thank you for the clarification. Since I cannot accomplish the upgrade to OH4 yet (as discussed below), meanwhile I use apt-mark to lock the openHAB version to 3:

sudo apt-mark hold openhab openhab-addons

Holds can be shown with

apt-mark hold showholds

Without holding any packages I have followed the FAQ instructions in order to try migrating from OH 3.4.5. to 4.0.1 (openHAB 4 migration FAQ):

  • Latest openHABian release with change in openhabian.conf, backup as initial.zip, additional change : remove comment in the line where initial.zip is specified.
  • Everything is great, I (again) have a running OH3 instance (3.4.5) based on Bullseye and openHABian 1.8. So I have successfully moved from Debian 10 to Debian 11 using the FAQ instructions maintaining my site’s functionality. However the subsequent upgrade to OH4 fails:

results in the same error I had before (‘maximum’ debug output ):

2023-08-06_19:22:05_CEST [openHABian] Adding required keys to apt... OK
2023-08-06_19:22:05_CEST [openHABian] Installing selected openHAB version...
$ apt-get update
Hit:1 http://davesteele.github.io/comitup/repo comitup InRelease
Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:3 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:4 https://deb.nodesource.com/node_18.x bullseye InRelease
Reading package lists... Done

$ apt-get install --allow-downgrades --yes -o DPkg::Lock::Timeout= --option Dpkg::Options::=--force-confnew openhab= openhab-addons=
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Version '' for 'openhab' was not found
E: Version '' for 'openhab-addons' was not found
FAILED

It instructs apt to install “openhab” and “openhab-addons” each with an empty version information "= ".

So instead, I tried option 40->41, the config script claims that I am now running the stable version. The same apt-get install line is called but now the versions are specified:

$ apt-get install --allow-downgrades --yes -o DPkg::Lock::Timeout= --option Dpkg::Options::=--force-confnew openhab=4.0.1-1 openhab-addons=4.0.1-1

However: frontail / openhab.log show errors, the webserver is down, OH does not function anymore. There are several similar errors, this is the first:

2023-08-06 19:59:52.281 [ERROR] [Events.Framework                    ] - FrameworkEvent ERROR

org.osgi.framework.BundleException: Could not resolve module: org.apache.cxf.cxf-core [66]

  Unresolved requirement: Import-Package: com.sun.msv.grammar; version="[2013.6.0,2014.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.msv.grammar.xmlschema; version="[2013.6.0,2014.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.msv.reader; version="[2013.6.0,2014.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.msv.reader.xmlschema; version="[2013.6.0,2014.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.tools.internal.xjc.api; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.xml.internal.messaging.saaj.soap; resolution:="optional"

  Unresolved requirement: Import-Package: com.sun.xml.messaging.saaj.soap; resolution:="optional"

  Unresolved requirement: Import-Package: net.sf.cglib.proxy; version="[2.2.2,3.4.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: org.apache.aries.blueprint; version="[1.0.0,2.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: org.apache.aries.blueprint.mutable; version="[1.0.0,2.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: org.apache.aries.blueprint.services; version="[1.0.0,2.0.0)"; resolution:="optional"

  Unresolved requirement: Import-Package: org.apache.ws.commons.schema; version="[2.2.0,3.0.0)"

  Unresolved requirement: Import-Package: com.ctc.wstx.msv; version="[6.2.0,7.0.0)"; resolution:="optional"

    -> Export-Package: com.ctc.wstx.msv; bundle-symbolic-name="com.fasterxml.woodstox.woodstox-core"; bundle-version="6.2.6"; version="6.2.6"; uses:="com.ctc.wstx.api,com.sun.msv.grammar,com.sun.msv.grammar.trex,com.sun.msv.grammar.xmlschema,com.sun.msv.reader,com.sun.msv.verifier,com.sun.msv.verifier.regexp,javax.xml.parsers,javax.xml.stream,javax.xml.transform,org.codehaus.stax2.validation,org.relaxng.datatype,org.xml.sax"

       com.fasterxml.woodstox.woodstox-core [35]

         Unresolved requirement: Import-Package: com.sun.msv.grammar; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.grammar.trex; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.grammar.xmlschema; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.reader; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.reader.trex.ng; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.reader.util; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.reader.xmlschema; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.util; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.verifier; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.verifier.regexp; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: com.sun.msv.verifier.regexp.xmlschema; version="[2013.6.0,2014.0.0)"; resolution:="optional"

         Unresolved requirement: Import-Package: org.codehaus.stax2; version="[4.2.0,5.0.0)"

  Unresolved requirement: Import-Package: com.ctc.wstx.stax; version="[6.2.0,7.0.0)"; resolution:="optional"

    -> Export-Package: com.ctc.wstx.stax; bundle-symbolic-name="com.fasterxml.woodstox.woodstox-core"; bundle-version="6.2.6"; version="6.2.6"; uses:="com.ctc.wstx.api,com.ctc.wstx.cfg,com.ctc.wstx.dtd,com.ctc.wstx.io,com.ctc.wstx.sr,com.ctc.wstx.sw,com.ctc.wstx.util,javax.xml.namespace,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform,org.codehaus.stax2,org.codehaus.stax2.ri"

  Unresolved requirement: Import-Package: javax.xml.ws; version="[0.0.0,3.0.0)"

    -> Export-Package: javax.xml.ws; bundle-symbolic-name="jakarta.xml.ws-api"; bundle-version="2.3.3"; version="2.3.3"; uses:="javax.xml.bind,javax.xml.bind.annotation,javax.xml.namespace,javax.xml.transform,javax.xml.ws.handler,javax.xml.ws.spi,javax.xml.ws.spi.http,org.w3c.dom"

       jakarta.xml.ws-api [53]

         Unresolved requirement: Import-Package: javax.xml.soap; version="[1.4.0,2.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi-3.18.0.jar:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi-3.18.0.jar:?]

SOLVED

I finally succeed in upgrading to OH4.

  • Upgrading as proposed in the FAQ using menu option 03 did not work for me. It does not supply a version number and fails to install “openhab=” and “openhab-addons=” as discussed before
  • I used option 01 to chose the branch to latest, not release! (This apparantly did the trick.)
  • I then used option 40, 41 to “Install or switch to the latest openHAB Release”.

Now I didn’t get any errors. Note that I also had previously used

apt-mark hold openhab openhab-addons

Then used option 02 Upgrade System which upgrades all packages but not openhab, then

apt-mark unhold openhab openhab-addons

Now openHAB restartet without the above Java errors.