Cleaning up the startup process / renaming rules (windows possible)

Okay … and what makes you say that ?
(and do you really mean openHABian ? or did you mean to say openHAB?)


The version of Linux with the current HABian release is 4.14 - and the command below now works

systemctl edit  openhab2.service

Ok. I misunderstood and thought you were referring to the whole need to setup deferred rules processing. That I believe still applies.

Sorry for the confusion - no that is not fixed :frowning: Its why I am reading on ways to solve this problem.

It seems strange to me to not have addressed this. I spent a fair bit of time trying to understand why rules were not working that had been working before. Reading about the problems on here and github makes me think this should be a priority.

I just wanted to add my voice to this thread. This approach (@ptweety override) worked perfectly and resolved a number of long running issues that sometimes caused instability. Thanks!

I would also like to be able to control the order that rules get loaded. I have some rules that do calculations and update the values of other items. If these rules are not run first, I get errors from other rules that try to do calculations on null values.


Should this post be referenced in the startup behavior documentation?

For Linux, the override approach is SO simple! In fact, for Linux, why isn’t “delay” approach the “as built” standard. Heck, you could parametrize the delay via an installation configuration or as an openhabian-config function.

This startup synchronization issue gets a lot of dialog. Something to address it built in to the openHAB distribution out of the box?



1 Like

I had the problem with very long startup time on a rp3 with openhabian too. This rule startup delay is a big problem and this solution has to be added to openhabian as default. This will avoid so many work arounds to get rud of startup errors and trouble. A rasperrry is for most of us the hardware setup used for home automation so should get the right priority.

I’m thinking of implementing this on my raspberry pi. I am aiming to edit the service file. Do I still need the “ignore” statement in the script?

Have I got this right?

There is no “ignore” statement if you use the systemd stuff.

I got it now thanks

FYI: I have added @ptweety’s workaround to openHABian.


If I try this option on openHABian I get:

/bin/cp: cannot create regular file ‘/etc/systemd/system/openhab2.service.d/override.conf’: No such file or directory

For the record, I am not on the openhabian image. I just installed the script. I’m on strech.

If that directory does not exist, how did you install/start OH then ?
(well my real question is: does that dir exist in a normal OH installation ? Why does it not exist in yours ?)

I can start openhab with

sudo systemctl start openhab2.service

If I look in /etc/systemd/system there is indeed no openhab2.service subdirectory.

For what it is worth, there is a /etc/systemd/system/multi-user.targets.wants subdirectory. In that directory there is a link called openhab2.service. The link points to the file /urs/lib/systemd/system/openhab2.service

That’s great - OH now starts much faster, thanks!

Is there a way to test if Things (particular or a list of)are online

I think it is safe to enable rules only after all Things are online which interact in rules.

I have implemented in one of my rule files a “System started” rule, which does an initialization and other needed stuff and after all also precompiles the rules file.
What I have seen at startup is, that a “storm” of “System started” events are fired. The rules files are recompiled zillion times, e.g. when particular things/items get online. This for sure does not speed up the startup process.

My suggestion is to wait activating rules (copying, or whatever, e.g. disable rules engine in karaf) only after the Things and Items are online.

Any ideas?

THANK YOU!! I was having a ton of problems before. Just created a new OpenHABian off your latest release, brought in all my old item and rule files, and noticed you fixed this issue. It worked great. All the persistence null > value changes took place well before the rules loaded.

For the first time ever, I rebooted without one single error!

Works like a dream and everything starts up with no complaints

Thank you so much - super appreciated

Just for your information: According to Delay Rule loading after Startup in OH2? it should be possible to configure openhab itself to load the rules later by doing the following in karaf console:

bundle:start-level org.eclipse.smarthome.model.rule 90
bundle:start-level org.eclipse.smarthome.model.rule.ide 90
bundle:start-level org.eclipse.smarthome.model.rule.runtime 90

This means no hacks like renaming the rules on startup should be necessary which is clearly the cleanest solution. From my limited testing it really seems to do the job.