Openhab 2.2 stable upgrade errors

Yes! http://openhab-device-ip:8080/paperui/index.html is accessable to me (this makes me a little happy ^^)
system/browser is operating with german (de-DE)

Hello,
tried to upgrade to 2.2.0.1 stable too (on Debian Stretch 64bit) and hat a lot of problems. Openhab2 didn’t start anymore, it looped all the time. Starting all services and automatically stopping all of them.

I did a backup of the config and delete alle Openhab-directories and packages. After that I tried a new/fresh installation on the same os and it get worse.

Openhab do not start anymore, it hangs all the time with the following log entries:Dez 18, 2017 9:13:12 PM org.apache.karaf.main.lock.SimpleFileLock lock
INFORMATION: Lock acquired
Dez 18, 2017 9:13:12 PM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFORMATION: Lock acquired. Setting startlevel to 100
Dez 18, 2017 9:15:03 PM org.apache.karaf.main.lock.SimpleFileLock lock
INFORMATION: Trying to lock /var/lib/openhab2/tmp/lock
Dez 18, 2017 9:15:03 PM org.apache.karaf.main.lock.SimpleFileLock lock
INFORMATION: Lock acquired
Dez 18, 2017 9:15:03 PM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFORMATION: Lock acquired. Setting startlevel to 100

A little help would be great.

Try to reinstall it (Openhab 2.2 stable upgrade errors - as mentioned here)

I`m using Debian-Stretch with x86 cpu, not a raspberry…

1 Like

Same here. Did an upgrade from 2.1 stable to 2.2 stable and nothing is starting. Completely removed the openhab2 and restinalled two times but nothing. Nothing on the openhab logs which tells me that the application does not even starting. The only thing I see is the following in syslog

I think the main issue is with Karaf

start.sh[5790]: KARAF_BASE is not valid: /usr/share/openhab2/userdata

Here is everything

Dec 18 22:21:08 raspberrypi systemd[1]: Starting The openHAB 2 Home Automation Bus Solution...
Dec 18 22:21:08 raspberrypi systemd[1]: Started The openHAB 2 Home Automation Bus Solution.
Dec 18 22:21:08 raspberrypi start.sh[5790]: Launching the openHAB runtime...
Dec 18 22:21:08 raspberrypi start.sh[5790]: mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
Dec 18 22:21:13 raspberrypi influxd[866]: [I] 2017-12-18T21:21:13Z failed to store statistics: timeout service=monitor
Dec 18 22:21:24 raspberrypi start.sh[5790]: KARAF_BASE is not valid: /usr/share/openhab2/userdata
Dec 18 22:21:24 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=1/FAILURE
Dec 18 22:21:25 raspberrypi kill[5940]: kill: invalid argument S
Dec 18 22:21:25 raspberrypi kill[5940]: Usage:
Dec 18 22:21:25 raspberrypi kill[5940]: kill [options] <pid> [...]
Dec 18 22:21:25 raspberrypi kill[5940]: Options:
Dec 18 22:21:25 raspberrypi kill[5940]: <pid> [...]            send signal to every <pid> listed
Dec 18 22:21:25 raspberrypi kill[5940]: -<signal>, -s, --signal <signal>
Dec 18 22:21:25 raspberrypi kill[5940]: specify the <signal> to be sent
Dec 18 22:21:25 raspberrypi kill[5940]: -l, --list=[<signal>]  list all signal names, or convert one to a name
Dec 18 22:21:25 raspberrypi kill[5940]: -L, --table            list all signal names in a nice table
Dec 18 22:21:25 raspberrypi kill[5940]: -h, --help     display this help and exit
Dec 18 22:21:25 raspberrypi systemd[1]: openhab2.service: control process exited, code=exited status=1
Dec 18 22:21:25 raspberrypi systemd[1]: Unit openhab2.service entered failed state.
Dec 18 22:21:25 raspberrypi kill[5940]: -V, --version  output version information and exit
Dec 18 22:21:25 raspberrypi kill[5940]: For more details see kill(1).
Dec 18 22:21:25 raspberrypi systemd[1]: openhab2.service holdoff time over, scheduling restart.

The discussion here did not solve it

Edit: Actually checking the path mentioned in the error message I see that /usr/share/openhab2/userdata does not exist !

pi@raspberrypi:/usr/share/openhab2 $ pwd
/usr/share/openhab2
pi@raspberrypi:/usr/share/openhab2 $ ls
addons  LICENSE.TXT  runtime  start_debug.sh  start.sh
pi@raspberrypi:/usr/share/openhab2 $

Not sure how this has happened

What is the output of

openhab-cli info

?

pi@raspberrypi:/usr/share/openhab2 $ openhab-cli info
Version:     2.2.0 (Build)

User:        openhab (Environment Variable Set)
User Groups: openhab tty dialout

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | root:root
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://192.168.1.18:8080
             https://192.168.1.18:8443

As I mentioned in the edit of my post above I see clearly that the path /usr/share/openhab2/userdata does not exist!

It shouldn’t exist. The userdata folder should be pointing towards /var/lib/openhab2 as your last command shows correctly.

Does the command:

sudo chown -R openhab:openhab /usr/share/openhab2

help at all?

Currently the folder is owned by root

drwxr-xr-x   4 root root  4096 Dec 18 22:20 openhab2
pi@raspberrypi:/usr/share $

I changed it to openhab as you suggested but still the same

drwxr-xr-x   4 openhab openhab  4096 Dec 18 22:20 openhab2
pi@raspberrypi:/usr/share $
Dec 18 22:42:51 raspberrypi start.sh[10344]: Launching the openHAB runtime...
Dec 18 22:42:51 raspberrypi start.sh[10344]: mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
Dec 18 22:42:53 raspberrypi start.sh[10344]: KARAF_BASE is not valid: /usr/share/openhab2/userdata
Dec 18 22:42:53 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=1/FAILURE

Ah I’ve found the problem. For some reason you’re not using the service file provided by the installation we need to point towards the correct service file:

sudo systemctl disable openhab2 
sudo systemctl daemon-reload
sudo systemctl enable openhab2.service
sudo systemctl start openhab2.service

Not sure how you found that :slight_smile: I do not remember changing the service file to be honest.

In any case I tried it but still the same issue …

pi@raspberrypi:/var/log $ sudo systemctl disable openhab2
Synchronizing state for openhab2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d openhab2 defaults
Executing /usr/sbin/update-rc.d openhab2 disable
insserv: warning: current start runlevel(s) (empty) of script `openhab2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `openhab2' overrides LSB defaults (0 1 6).
pi@raspberrypi:/var/log $ sudo systemctl daemon-reload
pi@raspberrypi:/var/log $ sudo systemctl enable openhab2.service
Synchronizing state for openhab2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d openhab2 defaults
insserv: warning: current start runlevel(s) (empty) of script `openhab2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `openhab2' overrides LSB defaults (0 1 6).
Executing /usr/sbin/update-rc.d openhab2 enable
pi@raspberrypi:/var/log $ sudo systemctl start openhab2.service
pi@raspberrypi:/var/log $
Dec 18 22:59:41 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:43 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:44 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:45 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:45 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:47 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:52 raspberrypi systemd[1]: Reloading.
Dec 18 22:59:54 raspberrypi systemd[1]: Starting The openHAB 2 Home Automation Bus Solution...
Dec 18 22:59:54 raspberrypi systemd[1]: Started The openHAB 2 Home Automation Bus Solution.
Dec 18 22:59:54 raspberrypi start.sh[14030]: Launching the openHAB runtime...
Dec 18 22:59:54 raspberrypi start.sh[14030]: mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
Dec 18 23:00:03 raspberrypi start.sh[14030]: KARAF_BASE is not valid: /usr/share/openhab2/userdata
Dec 18 23:00:03 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=1/FAILURE

I know this is a service issue because the service is trying to use start.sh, which the systemd files don’t use. It looks like it’s using a really old version of a sysvinit script. So let’s try to disable that too:

sudo systemctl disable openhab2 
sudo update-rc.d openhab2 disable
sudo systemctl daemon-reload
sudo systemctl enable openhab2.service
sudo systemctl start openhab2.service 

If we can stop it from updating from update-rc.d then I’m confident that it’ll start.

You know a lot better than me so I trust you :slight_smile:
It is very strange that I am using an old version of that script. Isn’t that being updated ?

I am using openhab on raspbian by the way not openhabian

I still get the same issue

pi@raspberrypi:/etc/openhab2 $ sudo systemctl disable openhab2
Synchronizing state for openhab2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d openhab2 defaults
Executing /usr/sbin/update-rc.d openhab2 disable
insserv: warning: current start runlevel(s) (empty) of script `openhab2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `openhab2' overrides LSB defaults (0 1 6).
pi@raspberrypi:/etc/openhab2 $ sudo update-rc.d openhab2 disable
insserv: warning: current start runlevel(s) (empty) of script `openhab2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `openhab2' overrides LSB defaults (0 1 6).
pi@raspberrypi:/etc/openhab2 $ sudo systemctl daemon-reload
pi@raspberrypi:/etc/openhab2 $ sudo systemctl enable openhab2.service
Synchronizing state for openhab2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d openhab2 defaults
insserv: warning: current start runlevel(s) (empty) of script `openhab2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `openhab2' overrides LSB defaults (0 1 6).
Executing /usr/sbin/update-rc.d openhab2 enable
pi@raspberrypi:/etc/openhab2 $ sudo systemctl start openhab2.service
Dec 18 23:34:49 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:51 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:51 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:52 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:52 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:53 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:53 raspberrypi systemd[1]: Reloading.
Dec 18 23:34:54 raspberrypi systemd[1]: Reloading.
Dec 18 23:35:01 raspberrypi systemd[1]: Starting The openHAB 2 Home Automation Bus Solution...
Dec 18 23:35:01 raspberrypi systemd[1]: Started The openHAB 2 Home Automation Bus Solution.
Dec 18 23:35:01 raspberrypi start.sh[19902]: Launching the openHAB runtime...
Dec 18 23:35:01 raspberrypi start.sh[19902]: mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
Dec 18 23:35:03 raspberrypi start.sh[19902]: KARAF_BASE is not valid: /usr/share/openhab2/userdata
Dec 18 23:35:03 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=1/FAILURE

Edit: Checking your other post I see that you suggested the command

sudo openhab-cli start --debug

This starts up karaf and openhab. If I exit and then try the above commands the service still does not start with the same errors

Eek, I’m sure this must be frustrating for you.

Is the what the service file should look like (notice that the exec start is karaf, not start.sh). Can you confirm that this exists in /usr/lib/systemd/system/openhab2.service

It is but I have no demands for an opensource software :slight_smile:

Yes it looks correct I had already checked it while googling the error

pi@raspberrypi:/etc/openhab2 $ cat /usr/lib/systemd/system/openhab2.service
[Unit]
Description=openHAB 2 - empowering the smart home
Documentation=http://docs.openhab.org
Documentation=https://community.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Environment=OPENHAB_HOME=/usr/share/openhab2
Environment=OPENHAB_CONF=/etc/openhab2
Environment=OPENHAB_RUNTIME=/usr/share/openhab2/runtime
Environment=OPENHAB_USERDATA=/var/lib/openhab2
Environment=OPENHAB_LOGDIR=/var/log/openhab2
Environment=OPENHAB_STARTMODE=daemon
EnvironmentFile=-/etc/default/openhab2

User=openhab
Group=openhab

WorkingDirectory=/usr/share/openhab2
ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMODE
ExecStop=/usr/share/openhab2/runtime/bin/karaf stop

SuccessExitStatus=0 143
RestartSec=5
Restart=on-failure
TimeoutStopSec=120

LimitNOFILE=102642

[Install]
WantedBy=multi-user.target

Yep that’s the one,

Let’s try more debugging…

sudo systemd-analyze verify /usr/lib/systemd/system/openhab2.service
sudo systemctl daemon-reload

Does not seem to recognise ‘verify’

pi@raspberrypi:/etc/openhab2 $ sudo systemd-analyze verify
Unknown operation 'verify'.
pi@raspberrypi:/etc/openhab2 $ sudo systemd-analyze
blame           critical-chain  dot             dump            plot            set-log-level   time

Hi,

I had the same issue - based on your post I looked at the openhab2.service file in the

/lib/systemd/system

I noticed that the openhab2.service file was the old version.

I removed it - together with a systemctl daemon-reload / enable - and now it works …

Thanks for your input !!

1 Like

Hi @Brambot, I think you’re on the answer there!

@cgeo can you delete the /lib/systemd/systemd/openhab2.service file (not the one in /usr/) and do another reload?

Guys,

With the suggestion of @Brambot I got past the error. But it was not over. Logs indicated several permission issues

Dec 19 00:16:59 raspberrypi karaf[27231]: Unable to update instance pid: /var/lib/openhab2/tmp/instances/instance.properties (Permission denied)
Dec 19 00:19:12 raspberrypi karaf[27642]: 2017-12-19 00:19:12,547 CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging]) ERROR Cannot access RandomAccessFile java.io.FileNotFoundException: /var/log/openhab2/audit.log (Permission denied) java.io.FileNotFoundException: /var/log/openhab2/audit.log (Permission denied)
Dec 19 00:15:23 raspberrypi karaf[26526]: java.io.FileNotFoundException: /var/lib/openhab2/cache/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)

I really do not know how this has happened honestly. I restored the permissions to openhab for

/var/log/openhab2/audit.log
/var/lib/openhab2/tmp
/var/lib/openhab2/cache

and now everything starts up fine!

Many thanks @Benjy and @Brambot

The support was better than what I get for paid enterprise software :slight_smile:

2 Likes