[SOLVED] Fresh install of openHAB2 via repository does not work (Linux)

I haven’t done a fresh install since 2.2 days, if I do I end up copying my /etc/openhab2 folder back in place and fix errors as they arise; but this is usually with hardware changes.

There is an offline deb file that you can install and pull all the official bindings down; larger package but you would at least have everything for offline usage.

That is also mentioned in their link.
sudo apt-get install openhab2-addons

thats the package causing issues for me.

im not sure if its initializing like you said, maybe its getting stuck on some binding? but i cant possibly see it taking 50min+ to initialize/cache everything on a pi4

I have never installed that package personally.

I can confirm this bug!

running:

sudo apt purge openhab2 openhab2-addons
sudo apt install openhab2

did the trick!

I installed the debian buster-full multiple times on a Raspberry Pi 4 to narrow down the problem.
The install script I wrote looks like this:

$ vi install_openHAB_2.sh
--------------------------------------------------------------------------------
# install basic applications
sudo apt-get install --yes screen mc vim git htop
sudo apt-get install --yes software-properties-common apt-transport-https

# install Zulu Java 8 Platform
# Note: Make sure to install Zulu or Java 8, as openHAB is not yet compatible with Java 9
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
#sudo apt-add-repository 'deb http://repos.azulsystems.com/debian stable main'
echo 'deb http://repos.azulsystems.com/debian stable main' | sudo tee /etc/apt/sources.list.d/zulu.list
sudo apt-get update
sudo apt-get install --yes zulu-embedded-8

# install openHAB 2 stable|testing|unstable
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
#echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
echo 'deb https://openhab.jfrog.io/openhab/openhab-linuxpkg testing main' | sudo tee /etc/apt/sources.list.d/openhab2.list
#echo 'deb https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
sudo apt-get update
sudo apt-get install --yes openhab2 openhab2-addons
#sudo apt-get install --yes openhab2-addons-legacy

# add privileges for common peripherals
sudo adduser openhab dialout
sudo adduser openhab tty
sudo adduser openhab bluetooth
sudo adduser openhab audio
sudo sed -i 's/EXTRA_JAVA_OPTS=""/EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=\/dev\/ttyUSB0:\/dev\/ttyS0:\/dev\/ttyS2:\/dev\/ttyACM0:\/dev\/ttyAMA0"/g' "/etc/default/openhab2"

# Java Network Permissions
# Some openHAB add-ons, like the Network or AmazonDash bindings, need elevated permissions to work.
sudo setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' $(realpath /usr/bin/java)

# setup openHAB 2 service
sudo systemctl start openhab2.service
sudo systemctl status openhab2.service
sudo systemctl daemon-reload
sudo systemctl enable openhab2.service

# Note: The first start may take up to 15 minutes, this is a good time to reward yourself with hot coffee or a freshly brewed tea!
--------------------------------------------------------------------------------
$ ./install_openHAB_2.sh

My Raspberry Pi 4 Buster /boot/config.txt looks like this:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=82

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
hdmi_enable_4kp60=1
gpu_mem=16
  • I first tried the stable repository of openHAB 2 same error.
  • Using openjdk-8-jdk also resulted in the same error.
  • Also waiting over 50 minutes did not bring up the dashboard.
  • Changing the the port number for the dashboard changed the used port accordingly but also resulted in the Page Not Found error when redirected to http://openhabpi:8080/start/index
HTTP ERROR 404
Problem accessing /start/index. Reason:

    Not Found
Powered by Jetty:// 9.4.20.v20190813

The error I get is:

pi@openhabpi:/boot $ journalctl -u openhab2
-- Logs begin at Tue 2019-12-24 04:49:55 CET, end at Tue 2019-12-24 05:25:05 CET. --
Dec 24 04:49:59 openhabpi systemd[1]: Started openHAB 2 - empowering the smart home.
Dec 24 05:04:45 openhabpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Dec 24 05:04:51 openhabpi karaf[443]: org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type="
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.container.Module.lockStateChange(Module.java:337)
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.asyncStop(EquinoxBu
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.stop(EquinoxBundle.java:262)
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.stop(EquinoxBundle.java:267)
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.launch.Equinox.stop(Equinox.java:123)
Dec 24 05:04:51 openhabpi karaf[443]:         at org.apache.karaf.main.Main$2.run(Main.java:354)
Dec 24 05:04:51 openhabpi karaf[443]: Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
Dec 24 05:04:51 openhabpi karaf[443]:         at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
Dec 24 05:04:51 openhabpi karaf[443]:         ... 5 more
Dec 24 05:04:56 openhabpi systemd[1]: openhab2.service: Succeeded.
Dec 24 05:04:56 openhabpi systemd[1]: Stopped openHAB 2 - empowering the smart home.
Dec 24 05:08:45 openhabpi systemd[1]: Started openHAB 2 - empowering the smart home.

So the problem of something in the addons package is that there is a timeout after 5 seconds because a lock could not be aquired. But I have no idea what exactly is causing the problem.

2 Likes

Why don’t you use openHABian ?
It provides the same but without the hassle for you and us to support individual setups like yours
(obviously Linux install instructions are generic and thus not tested/recommended on every platform).

If it is not tested nor recommended it should either be removed from the instructions or have a BIG disclaimer attached.

that worked with the addons package installed, thanks.

but these instructions are currently not working if you actually want to do a manual setup (which is what i attempted); https://www.openhab.org/docs/installation/rasppi.html#manual-setup

I did a manual install with snapshot 3.0.0 following those instructions you mentioned on Debian Buster: no problems at all :sunglasses:

not with these packages and not without running openHABian you didn’t

pi@habnode-master ~ %  dpkg -l | grep openhab2 
ii  openhab2                       2.5.0-1                             all          openhab2
ii  openhab2-addons                2.5.0-1                             all          openhab2-addons

i can replicate this issue 100% of the time

and @FL140 confirmed it here with detailed instructions to replicate it; Fresh install of openHAB2 via repository does not work (Linux)

I just meant to say that as it’s generic we cannot know/own/test all the variants a user might come up with. That does not require a disclaimer as it is self-explanatory, isn’t it.
Of course there’s commonly used combos it is tested on.

Hi,
I can confirm as well that the install through apt repository (on Ubuntu 18.04.3) is not working with 2.5.0.

I’m new to OpenHAB (as in since today new) and just came from a bad experience with “prepacked” systems such as HASS.IO (Home Assistant) so I wanted to go the more controlled way by doing the installation myself.
The documentation was very well done which gave me the confidence that openHAB2 is (at least I got that perception) more stable than that bleeding edge Home Assistant mess.

I’m reluctant to go the openHABian route because I don’t want another “blackbox” software on my hands (especially if at some future point should be running my house).

Any chance this issue on repository linux is going to get solved soon?
Thanks in advance

Hello Markus,
Let me assure you it is not. Especially because the documentation handles both debian/ubuntu as well as yum repository distos, and the documentation is exceptionally well written and complete, one could be under the impression that surely the most vanilla Ubuntu LTS release (18.04.3) would be in the standard smoke test set. This is not ‘any combination a user can come up with’.

If the self-install path is really such uncharted territory, it wouldn’t hurt to add the disclamer and save new (but experienced Linux) users such as myself the hassle of putting our faith in this documentation.

Thanks

1 Like

@k3mist and @FL140,

More "helluva first post!"s :smiley: Welcome to our little corner of the Internet!

This is now the Second third time in the last day or two that a new user joins and immediately is contributing with their very first post. I just said the same thing to @collectivetrader a little while ago in fact.

Welcome indeed! To all three of you! :smiley:

I think we might be on to something here… At least 3 people that I have read having same symptoms. I will cross post this workaround to the other thread. Collectivetrader is already here, so no more need to alert him.

Is it too soon to file a bug report? Seems reproduceable. @collectivetrader, you want to to see if purging the addons package makes things work for you, as a temp workaround, and so I can start formulating a bug report (with possible insight into where to look)?

EDIT: Sorry, I was confused. There are only 2 threads about this. I thought collectivetrader made his own post but he actually had posted in this thread:

Anyway, so yeah, only 2 threads about this issue (that I am aware of).

Also, @k3mist, I am not sure why you marked mstormi answer about openHABian as the solution (maybe mis-click)? I think you should probably correct that to your own post that actually contains the solution, in case anyone else comes along here looking for answers.

1 Like

Welcome from another former HA user.
OpenHABian is not like HASS.IO but is where HA got the idea fir their now discontinued HASSbian. It can either be installed on a Pi as a Raspian image or installed on any Linux system using git.
OpenHABian is basically a set of script to ease the complex installation requirements for OpenHAB and make it easier to add common companion programs. OpenHABian actually uses the apt packages for a Debian-based installation.

Thanks for the welcome! I marked that as the solution because it resolves the issue with the addons package installed.

Specifically the options I ran from the openHABian config menu were

01
02
03
10 -> 11
10 -> 13
10 -> 14


options 01 through 03 did not do anything since i was already fully up-to-date

still had my terminal open that i did this on; https://pastebin.com/Qx2CQJAV
commands from terminal

pi@habnode-master ~ % sudo apt purge openhab2 openhab2-addons  
pi@habnode-master ~ % sudo apt install openhab2                  
pi@habnode-master ~ % sudo /bin/systemctl daemon-reload          
pi@habnode-master ~ % sudo /bin/systemctl enable openhab2.service
pi@habnode-master ~ % sudo /bin/systemctl start openhab2.service
// checking to make sure its running
pi@habnode-master ~ % sudo git clone https://github.com/openhab/openhabian.git /opt/openhabian
pi@habnode-master ~ % sudo ln -s /opt/openhabian/openhabian-setup.sh /usr/local/bin/openhabian-config
pi@habnode-master ~ % sudo /bin/systemctl stop openhab2.service                                
pi@habnode-master ~ % sudo openhabian-config             
// ran the above options                                            
pi@habnode-master ~ % sudo /bin/systemctl stop openhab2.service                                      
pi@habnode-master ~ % sudo apt install openhab2-addons       
pi@habnode-master ~ % sudo /bin/systemctl start openhab2.service
2 Likes

@TRS-80: hi and thanks for welcoming us to the community.
I agree this is something which should be fixed rather than mark this issue solved on account that there is an alternative (openHABian) to install.

Rather than purging the add-ons, I’ve simply rolled-back my VM to a clean Linux install and started over. These are the exact steps I did:
Zulu install

    > apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
    > apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
    > apt-get update
    > apt-get install zulu-8

openHAB install

    > cd /tmp
    > wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
    > echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
    > apt-get update
    > apt-get install openhab2
    > systemctl start openhab2.service

With this done, it works like a charm. So confirmed that the issue happens due to the installation

 > apt-get install openhab2-addons

Now I don’t know yet what is in the addons package? I assume openHAB won’t be the same without it so presumably the installation is definately worth fixing.

Thanks for the support

afaik its all the addons from here https://www.openhab.org/addons/

Hello @Bruce_Osborne,
Thanks for pointing out the difference with HA.
In general I’m a bit reluctant to rely on scripts of which you don’t know what they do behind the scenes. It’s great to get up-and-running fast but when it comes to upgrade-time, I prefer to upgrade in a controlled manner (one component at a time) so it doesn’t break things and if it does, at least I know which step broke it :slight_smile:
I’ve had too many installs work fine out of the box but broke after upgrade.

If open HABian is not like that at all, I’m willing to give it a try.
I was also thinking, because openHAB seems to have an excellent backup/restore functionality, to 1) simply backup my setup, 2) throw away the old VM, 3) install a fresh system from scratch (so no update) and 4) restore my config.
Does this method pose less risk of breaking things?
I’m working on virtual machines so in practice it seems easy enough to do this if it were to increase stability.

Thanks for the support