[Solved] Installed Add-ons / Persistence Bundles Not Automatically Starting

For some reason, I have had trouble with newly installed add-on / persistence bundles not starting automatically. Bindings have all been available immediately after install, but neither add-ons nor persistence bundles have been available after install. Restarting openHAB didn’t fix it, and it wasn’t until I decided to go poking around in the console that I was able to see the bundles for those listed as “Installed” but not “Started”. Manually starting both bundles resolved the issue. I see no documentation on this, and I’m wondering if this is a known issue.

Which Add-ons are not starting automatically? (by the way: Add-ons are all = Actions, Bindings, Misc, Persistence, Transformations, UIs and Voice).

Have you set any parameters in your /etc/openhab2/services/addons.cfg file? Can you post it here to check it?

Also: check if a config file is needed for the respective addon. It may not start without a config.

Ps: Which release of OH2 are you running and on what system with what installation method? (e.g. OH2 Stable 2.0.0 on rPi3 with apt-get)

I had this problem with the mapdb persistence add-on and the mail action add-on. Yeah, I mean “Action” rather than add-on. :slight_smile:

No, all lines are currently commented out.

Both add-ons can be configured, but at the time I set them up, both the mapdb and the mail add-ons pointed to 1.x documentation that still expected everything was done in a single config. I eventually tried starting up the bundles manually without configs and that worked, although mail still needed configuration parameters so I ended up sticking those in services/openhab.cfg.

I performed a manual install of openHAB 2.0 release build on an x86_64 Arch Linux system. I have it running out of /opt/openhab2.

True… documentation is being reworked now by the various authors.
Have you checked out the latest on http://docs.openhab.org/addons/index.html ?

For configuring 1.x add-ons, use individual config files named: <addon>.cfg in your /OPENHAB_CONF/services/ folder (/opt/openhab2/conf/services/ in your case with manual Linux installation).
Don’t use openhab.cfg in OH2 (it may work… but you don’t need it)

In case of /opt/openhab2/conf/services/mapdb.cfg: I use the default settings:

# the commit interval in seconds (optional, default to '5')

# issue a commit even if the state did not change (optional, defaults to 'false')

You will also need a persistence strategy in /opt/openhab2/conf/persistence/mapdb.persist. Here is my example (not optimized):

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange

Items {
    * : strategy = everyChange, everyHour, everyDay, restoreOnStartup

I am not sure if the mapdb binding will become active without a strategy defined (maybe not).
If you have everything setup correctly and it still does not start: you need to troubleshoot some more (check logs)

By the way: the status of the bundle should be “Active” in the Karaf console:

openhab> bundle:list |grep MapDB
201 | Active   |  80 |   | openHAB MapDB Persistence Bundle

The status of the feature should be “Started”:

openhab> feature:list |grep openhab-persistence-mapdb
openhab-persistence-mapdb                 | 1.10.0.SNAPSHOT  | x        | Started     | addons-2.1.0-SNAPSHOT   | MapDB Persistence

Thanks. Yeah, it wasn’t clear to me from the available documentation whether or not each 1.x add-on needed its own config or to go into an openhab.cfg (still isn’t immediately obvious from the main pages, but some individual 1.x pages now reference this). Maybe I can add a blurb about this to the Add-ons page in the documentation. In any case, I did already have a strategy file in place for mapdb and it worked as soon as I manually made the mapdb bundle active through the console.

One other strange behavior is that when these add-ons failed to automatically become “active” , the Paper UI just showed the spinning progress indicator forever until I hit refresh. Once I refreshed the page, it would show “Installed” This does not happen with bindings. I’m wondering if what you say is true and these add-ons just will not install smoothly if there isn’t already a .cfg file in place before you attempt the install. I’ve just installed another one without having a .cfg file in place, and I’ll see if I have reproduced the issue. If so, I’ll remove it and try installing it with the .cfg in place. If it works immediately, then I think we should definitely point this out in the docs or address it as an issue.

1 Like

If I am not completely wrong: when you install via PaperUI a 1.x addon that needs a *.cfg file in OPENHAB_CONF/services/ it will be automatically created for you (with the default parameters).
If it’s not being created: check the folder permissions maybe? (not sure what could be wrong) chown -R openhab:openhab /opt/openhab2/conf/

Most (if not all) 2.x Add-Ons (mainly bindings) do not require a *.cfg file since they are managed via Paper UI.

This is making me suspect my issue might be a side effect of a manual installation ( see http://docs.openhab.org/installation/linux.html#manual-installation). The “File Locations” table says that the Services config location is /etc/default/openhab2 on a packaged based installation and “Not Preconfigured” for a manual installation. /opt/openhab2/conf/ is where the site config goes in a manual config. Maybe this won’t work on a manual install without creating one of the folders in /etc or using some other folder in /opt?

The /etc/default/openhab2 file is only for use by the systemd (to configure the service). It won’t exist in case of a manual install.
My example file is (where I changed the default ports)

root@homer:~# more /etc/default/openhab2 

This is not related to the openHAB 2 configurations (items, sitemaps, services, etc)

Try to uninstall mapdb addon, remove the /opt/openhab2/conf/services/mapdb.cfg file, re-install mapdb from PaperUI and check if the mapdb.cfg file is re-created automatically. I think that it should (if permissions are correctly setup)
That’s why I use apt-get installation: it sets up everything for me :slight_smile:

Now as a test, I removed the Mail config file and removed the Mail action, restarted openHAB, and then tried to re-install it. I got the same behavior with the endless spinning progress indicator, but after a while I refreshed the page and it said installed. As usual, the bundle was “Installed” not “Active” in the console. I checked the log and saw this:

22:19:51.461 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-action-mail’: Permission denied

So I went back and checked the permissions on /opt/openhab2/conf and sure enough, the openhab user account no longer had access. I figured out the quick and dirty script I wrote to replace the conf directory on my server with the local copy I have on my Mac was wiping out the permissions. I fixed the permissions, uninstalled the add-on and re-installed. The add-on installed immediately and did create a .cfg under /opt/openhab2/conf automatically. Problem solved. Thanks for your help!

1 Like