I accidentally killed my openhab by an update

A few days ago I updated my Openhab 3 installation on a Raspberry Pi 4 and Openhab 4 installed. After that the system restarted again and again and crashed after about 3 minutes runtime again. I then rebuilt the system with Openhab 4 and restored a backup. Then I tried to restore the rules, and my reboot exec binding. Then the system went into the reboot loop again. Then I just tried to install openhab 3 again, but it always installs the new openhab 4.
How do I install the old openhab via the image file?

Afaik change the openHABian branch to openHAB3 (in /etc/openhabian.conf).

You need Java 17 running OpenHab4:

$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Raspbian-1deb11u1rpt1)
OpenJDK Client VM (build 17.0.7+7-Raspbian-1deb11u1rpt1, mixed mode, emulated-client)

OpenHab3 was Java 11

Is it really rebooting the complete system or is it restarting the service / web UI ?
What is content of the openhab.log file ?

I allready did this and still openhab 4 got installed, the java version was Java 11, so it didnt even start.
I also installed an old release of openhabian ([openHABian v1.7.5] Release openHABian v1.7.5 · openhab/openhabian · GitHub)). But it still installed openhab 4.0.3.

yes, but i just want to install openhab 3 again.

The whole system was rebooting, because i got logged out via ssh to. But I tried to just install openhab 3 again, because the new rule system will cost me much time setting up and I saw that openhab 4 still very buggy at many points.

Also the service of openhab 4 just shuts down randomly.

Can you elaborate and/or post links? This is news to me, and we should have issues created in GitHub for any regressions introduced with 4.0, so they can be investigated and resolved.

Can you post the logs?

interesting to know would also be the output of

sudo journalctl -u openhab

OpenHABian: GitHub - openhab/openhabian: openHABian - empowering the smart home, for Raspberry Pi and Debian systems

The image will install openHAB 4 by default. To have it install openHAB 3, set clonebranch=openHAB3 in openhabian.conf . For legacy openHAB version 2, set clonebranch=legacy in openhabian.conf .

So edit the file before booting your pi first time right after flashing image.

I did this with the newest openhabian release and also with an older one, the right Java version got installed but the OpenHAB version was still wrong.

And again, i downloaded realease 1.7.5, put
in the config file before the first boot. an openhab 4.0.3 got still installed and doesnt start, because of the wrong java version.


Well, the short way to do it is listing all installable versions

apt-cache madison openhab

then install the specific version:

sudo apt install openhab=3.4.5-1 openhab-addons=3.4.5-1

To avoid openhabian-config to pull the wrong version, sset the version on hold afterwards:

sudo apt-mark hold openhab openhab-addons

if you later want to install openHAB 4, simply use

sudo apt-mark unhold openhab openhab-addons

to allow changing the version again.

which you shouldn’t have done.
Always use the latest openHABian release.