Openhab 2.2 problem after upgrade

Hi all
I have problem with start script after upgrade to openhab 2.2 if I run systemctl start openhab2, openhab 2.2 try to starts but with no success. In /var/log syslog I get

Dec 18 19:48:22 localhost start.sh[23567]: Launching the openHAB runtime…
Dec 18 19:48:25 localhost start.sh[23567]: null
Dec 18 19:48:25 localhost start.sh[23567]: Error occurred shutting down framework: java.lang.NumberFormatException: null
Dec 18 19:48:25 localhost start.sh[23567]: java.lang.NumberFormatException: null
Dec 18 19:48:25 localhost start.sh[23567]: at java.lang.Integer.parseInt(Integer.java:542)
Dec 18 19:48:25 localhost start.sh[23567]: at java.lang.Integer.parseInt(Integer.java:615)
Dec 18 19:48:25 localhost start.sh[23567]: at org.apache.karaf.main.ConfigProperties.(ConfigProperties.java:214)
Dec 18 19:48:25 localhost start.sh[23567]: at org.apache.karaf.main.Main.updateInstancePidAfterShutdown(Main.java:228)
Dec 18 19:48:25 localhost start.sh[23567]: at org.apache.karaf.main.Main.main(Main.java:193)
Dec 18 19:48:25 localhost systemd[1]: openhab2.service: main process exited, code=exited, status=254/n/a
Dec 18 19:48:25 localhost systemd[1]: Unit openhab2.service entered failed state.
Dec 18 19:48:25 localhost wpa_supplicant[887]: wlan0: Failed to initiate sched scan
Dec 18 19:48:25 localhost systemd[1]: openhab2.service holdoff time over, scheduling restart.
Dec 18 19:48:25 localhost systemd[1]: Stopping Starts and stops the openHAB Home Automation Bus…
Dec 18 19:48:25 localhost systemd[1]: Starting Starts and stops the openHAB Home Automation Bus…
Dec 18 19:48:25 localhost systemd[1]: Started Starts and stops the openHAB Home Automation Bus.

If I run /usr/share/openhab2/start.sh openhab starts…
btw
After upgrade i have to manually create directory userdata in /usr/share/openhab

java -version
java version "1.8.0_151"
Java™ SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot™ Client VM (build 25.151-b12, mixed mode)

uname -a
Linux cubietruck 4.13.16-sunxi #20 SMP Fri Nov 24 19:50:07 CET 2017 armv7l GNU/Linux

If you’re using the apt packages you can use the command:

sudo openhab-cli start --debug

To see if openhab starts properly as a non service. The userdata folder should be /var/lib/openhab2 and you can check this with:

openhab-cli info

Hi
If I run sudo openhab-cli start --debug
I get
root@cubietruck:/lib/systemd/system# openhab-cli start --debug
A systemd service configuration exists…
Use ‘sudo /bin/systemctl start openhab2.service’ to start an openHAB service
Launching an instance in this terminal…
Launching the openHAB runtime…
Listening for transport dt_socket at address: 5005

                      __  _____    ____      

____ ____ ___ ____ / / / / | / __ )
/ __ / __ / _ / __ / // / /| | / __ |
/ /
/ / // / __/ / / / __ / ___ |/ // /
_/ ./_// /// /// |/_____/
/_/ 2.2.0
Release Build

Hit ‘’ for a list of available commands
and ‘[cmd] --help’ for help on a specific command.
Hit ‘’ or type ‘system:shutdown’ or ‘logout’ to shutdown openHAB.

openhab> 22:58:16.750 [CM Configuration Updater (ManagedService Update: pid=[org.openhab.mail])] ERROR org.apache.felix.configadmin - [org.openhab.core.scriptengine.action.ActionService, org.osgi.service.cm.ManagedService, id=134, bundle=235/mvn:org.openhab.action/org.openhab.action.mail/1.11.0]: Updating property mail of configuration org.openhab.mail caused a problem: Parameters mail:hostname and mail:from are mandatory and must be configured. Please check your openhab.cfg!
org.osgi.service.cm.ConfigurationException: mail : Parameters mail:hostname and mail:from are mandatory and must be configured. Please check your openhab.cfg!
at org.openhab.action.mail.internal.MailActionService.updated(MailActionService.java:86) [235:org.openhab.action.mail:1.11.0]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]

openhab starts

but if i run systemctl start openhab2.service openhab is trying to start but it can’t.
my openhab2.service looks like that
Unit]
Description=Starts and stops the openHAB Home Automation Bus
Documentation=http://www.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
GuessMainPID=yes
User=root
ExecStart=/usr/share/openhab2/start.sh
ExecStop=kill -SIGINT $MAINPID
Restart=on-failure
WorkingDirectory=/usr/share/openhab2

[Install]
WantedBy=multi-user.target

and /usr/share/openhab2/start.sh
cho Launching the openHAB runtime…

DIRNAME=dirname "$0"
exec “${DIRNAME}/runtime/bin/karaf” “${@}”

before upgrade to 2.2 all works OK

Can’t get openHAB up and running either getting this error in the logs when trying to start’

Dec 18 23:06:58 raspberrypi systemd[1]: Starting The openHAB 2 Home Automation Bus Solution...
Dec 18 23:06:58 raspberrypi systemd[1]: Started The openHAB 2 Home Automation Bus Solution.
Dec 18 23:06:58 raspberrypi start.sh[2312]: Launching the openHAB runtime...
Dec 18 23:07:00 raspberrypi start.sh[2312]: null
Dec 18 23:07:00 raspberrypi start.sh[2312]: Error occurred shutting down framework: java.lang.NumberFormatException: null
Dec 18 23:07:00 raspberrypi start.sh[2312]: java.lang.NumberFormatException: null
Dec 18 23:07:00 raspberrypi start.sh[2312]: at java.lang.Integer.parseInt(Integer.java:542)
Dec 18 23:07:00 raspberrypi start.sh[2312]: at java.lang.Integer.parseInt(Integer.java:615)
Dec 18 23:07:00 raspberrypi start.sh[2312]: at org.apache.karaf.main.ConfigProperties.<init>(ConfigProperties.java:214)
Dec 18 23:07:00 raspberrypi start.sh[2312]: at org.apache.karaf.main.Main.updateInstancePidAfterShutdown(Main.java:228)
Dec 18 23:07:00 raspberrypi start.sh[2312]: at org.apache.karaf.main.Main.main(Main.java:193)
Dec 18 23:07:00 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=254/n/a
Dec 18 23:07:00 raspberrypi kill[2448]: kill: invalid argument S

java version "1.8.0_151"
Java™ SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot™ Client VM (build 25.151-b12, mixed mode)

I can get openhab to start as a non service using @Benjy comments.

Version:     2.2.0 (Build)

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

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             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.10.200:8080
             https://192.168.10.200:8443

Hi @Murpher,

The actual file should be in /usr/lib/systemd/system/openhab2.service

Can you delete the one that exists in /lib/ and see if this resolves your issue? You need to follow it with sudo systemctl daemon-reload

i.e.

sudo rm /lib/systemd/system/openhab2.service
sudo systemctl daemon-reload
sudo systemctl enable openhab2.service
sudo systemctl start openhab2.service
1 Like

Thanks @Benjy for replying that did the trick.

I decided to remove 2.1 and install 2.2 I now have the Welcome to openHAB 2 - Initial Setup screen in my browser but when I select standard the browser try’s going to start/inbox page but just stays on the Welcome to openHAB 2 - Initial Setup screen.

Nothing happens either when I select Standard or Demo

Have you come across this before?

I havent but I have seen other who have managed to get past it by clearing the tmp and cache directories:

sudo systemctl stop openhab2.service
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo systemctl start openhab2.service

Let me know how it goes!

1 Like

Unfortunately that didn’t work

can’t even get round it by going to paperui/index.html#/inbox/search just get a 404 error

Are there errors or warnings in /var/log/openhab2/openhab.log there are a couple of reasons why this may happen but it depends on the error.

Nothing since your suggestion to get openHAB up and running only this from before hand.

2017-12-18 21:58:20.927 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.10.200:8080
2017-12-18 21:58:20.945 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.10.200:8443
2017-12-18 21:58:33.710 [INFO ] [.dashboard.internal.DashboardService] - Stopped dashboard
2017-12-18 22:44:52.488 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2017-12-18 22:44:56.338 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.10.200:8080
2017-12-18 22:44:56.342 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.10.200:8443
2017-12-18 22:46:04.305 [INFO ] [.dashboard.internal.DashboardService] - Stopped dashboard

So does that log change at all with restarts? Is that timestamp current? I suspect that if it’s not then you should reinstall with the default logging configuration:

sudo apt-get -o Dpkg::Options::="--force-confask" --reinstall install openhab2

And responding with Y for each of the files that it prompts in /var/lib/openhab2 (N for files in /etc/).

Just got it solved.

I saw you comments in another post https://community.openhab.org/t/openhab-2-2-stable-upgrade-errors/37437/25.

Permission of folders! for some reason my /var/lib/openhab2/etc folder was owned by root and not openhab when I chown this to openhab it worked.

Thanks for help @Benjy wouldn’t of got it sorted without it.

1 Like

Glad you got it sorted! Sorry I hadn’t suggested that to you specifically though! Nice debugging on your part!

Happy automating! :slight_smile:

Couldn’t let you do all the work! :slight_smile:

1 Like

Moving openhab2.service fixed it for me with manual installation. Docs probably should be updated as I ended up reloading from scratch. Although I’m having other problems and might revert to the upgraded version if they don’t go away.

Thank you @Benjy, I had also the issue that OpenHAB did not start after upgrading fom 2.1 -> 2.2. Removing the contents of /var/lib/openhab2/cache/ and /var/lib/openhab2/tmp/ solved the issue for me.
I was using apt to upgrade. Maybe the package should clear cache and tmp automatically.

The installation package does this automatically after the install completes, but for reasons I can’t explain just yet the first run of a new update sometimes (only rarely) runs better after a cache/tmp removal.

I will add a cli shortcut so that the command:

sudo openhab-cli clean-cache

is all that would be needed, instead of having to remember and type out the directories each time.

1 Like

Adding in, same issues, no response via 8080 or 8443.
Karaf console on 8101 also no response.
openhab-cli info - no visible issues

Did the clear of the tmp and cache per your advice, and seems to have done the trick. Restart the service, and it’s now loading normally.

Thx.
Jp.