OpenHAB - some Things stay "Uninitialized" on boot

Hi,

The behaviour of my OpenHAB installation has become pretty similar as my 20 year old lawnmower. It’s very hard to turn it on, but once it is running, it will run forever. :slight_smile:

When I have done a lot of configuration, I sometimes notice my rules start becoming unstable. This is typically solved by a restart of OH. Also when the OS OH is running on needs to be upgraded, OpenHAB is restarted.

After the reboot, I noticed that some things are staying “Uninitialized”. See screenshot:

If you look at the two Chromecast things, you might notice it is not binding specific. One Chromecast is online, the other one Uninitialized. The problem is always with the same things.

No strange elements in openhab.log. And I can restart as much as I want, those Things will remain “Uninitialized”.

When I stop OpenHAB, and clear the /cache and /tmp folder, and then restart. All the things that didn’t get initialized first, get initialized perfectly. This behaviour is very consistent. Clearing those folders always solves this problem.

However, when booting OH after clearing /cache and /tmp, I get another problem. The two addons in my /addon folder generate errors.

In openhab.log I get this:

2017-07-20 18:27:44.915 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.connectsdk-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.connectsdk [10]
  Unresolved requirement: Import-Package: com.google.common.base; version="10.0.1"

	at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)[4:org.apache.felix.fileinstall:3.5.6]
2017-07-20 18:27:44.926 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.voice.pollytts-2.1.0-SNAPSHOT-20170615.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.voice.pollytts [9]
  Unresolved requirement: Import-Package: org.eclipse.smarthome.config.core

	at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)[4:org.apache.felix.fileinstall:3.5.6]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)[4:org.apache.felix.fileinstall:3.5.6]
2017-07-20 18:27:45.934 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.connectsdk-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.connectsdk [10]
  Unresolved requirement: Import-Package: com.google.common.base; version="10.0.1"

This problem is solved by… restarting OpenHAB. However, in that case my other Things (mentioned earlier) do not get initialized anymore. :roll_eyes:

So as a summary:

  • I restart OpenHAB (for some reason);
  • ChromeCast and Netatmo Things do not get initialized;
  • I stop OH - clear /cache and /tmp and restart OH;
  • ChromeCast and Netatmo get initialized, but ConnectSDK and Polly TTS binding generate errors;
  • I stop and start OH (so I do not clear any cache/tmp);
  • ChromeCast and Netatmo do not get initialized, but ConnectSDK and Polly TTS run fine;

There is one thing I can do to get them all working: If I stop OH, do an apt-get update followed by and apt-get upgrade:

  • ChromeCast and Netatmo get initialized, but ConnectSDK and Polly TTS binding generate errors;
  • I stop and start OH (so I do not clear any cache/tmp);
  • Everything works fine;

Obviously, this solution only works when there is a new release. Luckily I have a snapshot installation, so I have the opportunity to do this every few days. :slight_smile: So I just upgraded to Build #988. As long as I don’t restart OH, everything is fine.

Does anyone have an idea what this could be?
What is apt-get upgrade doing to my installation so I don’t get the errors anymore? Maybe I can do that manually, so I don’t need to wait for a new release to solve my problem.

Unfortunately, not a lot more. Other than replacing system files, on each upgrade it runs:

  1. Pre-remove
  2. Pre-install
  3. Post-install

Does anything strike you as odd compared to what you are doing?

In future, you should be able to log into the Karaf console (ssh -p8101 openhab@localhost), and find the bundle id for your problematic bindings:

bundle:list
bundle:restart ###

That should get the appropriate bindings working.

Thanks. I didn’t find anything in the pre/post-remove/install procedure that could be related to the behaviour of my OH installation after an upgrade.

Thanks. I will try that at the next opportunity.

Very strange.

I had to reboot again (for some other reason). I deleted /tmp and /cache as well.
I wanted to manually start the two bindings in the addons folder (connectSDK and Polly TTS), since they generate errors again.

There were identified as bundle 9 and 10:

However, when I want to restart, I get:

I’m getting this error with any bundle ID. What do I do wrong?

Er, I did not expect that:

Have you changed anything in /var/lib/openhab2/etc, such as karaf permissions or passwords. Are these files in /var/lib/openhab2 owned by “openhab:openhab”?

1 Like

What I did in /var/lib/openhab2/etc/users.properties:
I modified some time ago the default password (habopen) for the karaf user openhab and I forgot to add at the end of the line the ,_g_:admingroup part… (silly me)

As a result, I was able to login (with the new passwd) but as a regular user without admin permissions… most of the karaf console commands didn’t work of course :slight_smile: (like system:shutdown etc).

@Dries Check if the openhab user line is correct in this file.

the last 2 lines in /var/lib/openhab2/etc/users.properties should look like:

openhab = {CRYPT}4F61A0FD056BC0FD8231899EC4D9F9CA06AF0DEC895B2A3B0773F6FBC1C99776{CRYPT},_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,systembundles

I do the same with my OH2 Snapshot after each upgrade.
I also have 2 manually installed bindings ([1] & [2]) and they fail to become active upon first restart when cache & temp have been cleared.

warn messages
2017-07-21 08:03:57.898 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.unifi-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.unifi [10]
  Unresolved requirement: Import-Package: com.fasterxml.jackson.annotation
[...]
2017-07-21 08:04:29.990 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.mpower-2.0.02-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mpower [9]
  Unresolved requirement: Import-Package: com.google.common.base; version="10.0.1"

The dependencies are not loaded at the moment when OH2 tries to start them (with cache & temp empty).

It seems that if OH2 has already populated cache & temp, the dependencies are loaded fine (maybe this happens first).

See also here:

This is strange… this shouldn’t happen :slight_smile:
Try to debug more this case…

Thank you both!

I indeed changed users.properties and omitted the “,g:admingroup” part. I even commented out the “,g:admingroup” definition on the next line, for some strange reason. That’s fixed now, and I was able to perform bundle:restart.

However, then I get:

Which is very strange, because I know that when I reboot, these bindings will work fine.

What does work, however is:

  • bundle:uninstall both bindings;
  • Remove the .JAR files from the /addons folder;
  • Put the same .JAR files back in the /addons folder;

Now I have:

It doesn’t make sense to me.

It seems that with OH2 running and cache and tmp populated, the dependencies are found and the bundles load fine.

I also have more and more problems with things getting stuck in “Uninitialized”.
I tried restarting an affected bundle (the network binding in this case), but the Karaf console simply stops responding at that point.
Has anybody solved this?

Hi,
I’m on the 2.2 snapshot. I must say the problem disappeared (was fixed) somewhere between July and now. So maybe you could consider upgrading to a recent build?