Openhab won't restart after apt-get upgrade

Running openHAB2 on openHABian and ever since the last updates or so, openHAB2 won’t automatically restart as intended, but would tell me, openHAB2 wasn’t running before, so it won’t start it up…?

[07:39:37] openhabian@openhab:~$ sudo apt-get upgrade
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Paketaktualisierung (Upgrade) wird berechnet... Fertig
Die folgenden Pakete werden aktualisiert (Upgrade):
  openhab2
1 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 83,0 MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 3.072 B Plattenplatz zusätzlich benutzt.
Möchten Sie fortfahren? [J/n]
Holen:1 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf openhab2 all 2.5.6-2 [83,0 MB]
Es wurden 83,0 MB in 12 s geholt (6.964 kB/s).
Changelogs werden gelesen... Fertig
(Lese Datenbank ... 54561 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../openhab2_2.5.6-2_all.deb ...
Entpacken von openhab2 (2.5.6-2) über (2.5.5-1) ...
openhab2 (2.5.6-2) wird eingerichtet ...

[openHAB] openHAB was not running so will not start after upgrade.
[openHAB] Please use the command:
            sudo /bin/systemctl start openhab2.service

Trigger für systemd (241-7~deb10u4+rpi1) werden verarbeitet ...
Updating FireMotD available updates count ...

This is today’s upgrade right now. Is it anything I can change?

1 Like

I remember to have seen this message also while doing the update via the openhabian-config menu. I waited and it started automatically.

it didn’t start last time for 2hours - until i noticed.
now I double check and do updates manually and not automatically anymore…

What do you mean by “update”. Or “upgrade” as you write further down? Be specific.

What you see is a message from the package (I think) pre- install script. If by the time you apt-get install the package OH is down then that’s what it says and you have to manually start OH to overcome this. Makes sense as the installer cannot know why it’s down so it doesn’t change anything about that.
It’s been acting like that for a long time.
Why don’t you use openHABian menu 02 ? It also upgrades java and starts OH as part of that routine.

I have got the exact same problem.
And even after sudo /bin/systemctl start openhab2.service I have to reboot my raspberry.
Without rebooting, OpenHAB has missing icons in BasicUI.

openHABian menu isn’t automated, is it?
That’s why I apt-get update && apt-get upgrade automatically (but stopped it due to that error)

sorry for being unspecific. It was an “update” for OH2, but and “upgrade” for apt! :wink:
and yes, openHAB was running before “sudo apt-get upgrade && apt-get upgrade” was done - and after that message, OH2 wasn’t fired up agan.

I found out that after an openHAB2 update you’ll need two restarts to have everything loading as it should. try restarting next time - but rebooting will do the job also… :wink:

depends on what you mean by “automated”. You need to manually select it, true.
But something like a cronjob to automatically exec apt-get upgrade is a road straight to ruin so I hope you don’t do or want to do that.

1 Like

If I understand your post correctly, then:

  • You had openHAB running
  • You upgraded with apt
  • openHAB upgraded, but did not restart itself.
  • The update process says openHAB was not running, even though it was.

If that’s the case, regardless of if you used openHABian or did it manually, then that’s a bug which should be reported here: Issues · openhab/openhab-linuxpkg · GitHub

:confused:

1 Like

I meant to say: if you installed the package with OH down, it won’t (re)start OH. Which I think is proper behavior.
But I might be confusing this with some openHABian function’s behavior, so don’t shoot me.

2 Likes

Now I’m getting curious, what would be the normal way when using the openhabian-config 02 option. When I did that one this week, I saw those messages, however openHAB restarted automatically.

The java update will start it regardless of if it was down.

system_upgrade() {
  echo -n "$(timestamp) [openHABian] Updating repositories and upgrading installed packages... "
  cond_redirect apt-get --yes upgrade
  # shellcheck disable=SC2154
  if cond_redirect java_install_or_update "$java_opt"; then echo "OK"; else echo "FAILED"; return 1; fi
}

yes, exactly. That was the case.

Now I’m confused… :wink:
do you mean, if when the user (or openHABian install script in that case) installed the openhab2 package, while openhab2 is down (which obviously must be, because it’s not yet on the system?) it won’t restart all the way up, if you do a apt-get upgrade?

There’s a bit of confusion between what openHAB’s Linux package does, and what openHABian does for you.

openHABian has a menu option that updates processes, in this option it also does an apt upgrade for you. I think that’s where we can stop talking about openHABian, everything below is about openHAB’s Linux packaging.

When you call sudo apt update && sudo apt upgrade, if openHAB has an update available it will do the following (in a basic sense).

  1. Check to see if openHAB is running
    • If it is, create a flag that is used later.
  2. Stop openHAB.
    • The upgrade process waits at this point until the service is fully stopped.
  3. Remove the non-config files as part of uninstalling the old version.
  4. Install the non-config files as part of installing the new version.
  5. Warn the user about any changes to config files, asking the user what to do.
  6. Check the flag we might have made earlier.
    • If it exists, start openHAB.
    • If not, prompt the user that openHAB needs manually starting.

Based on what you are saying, that flag is missing for whatever reason during the upgrade process when it should exist. This would be a bug for me to look into in openhab-linuxpkg if you could create an issue in the link above.

1 Like

When having run the update to 2.5.6-2 vi openhabian-config, i also got the message @binderth mentioned:

[openHAB] openHAB was not running so will not start after upgrade.
[openHAB] Please use the command:
            sudo /bin/systemctl start openhab2.service

When i looked the the console later, I wondered what was going on and had a look at the webinterface: openhab was up and running.

From apt/term.log i grabed the following lines:

Entpacken von openhab2 (2.5.6-1) über (2.5.5-1) ...
openhab2 (2.5.6-1) wird eingerichtet ...

[ESC[1;33mopenHABESC[0m] openHAB was not running so will not start after upgrade.
[ESC[1;33mopenHABESC[0m] Please use the command:
            sudo /bin/systemctl start openhab2.service

Trigger für systemd (232-25+deb9u12) werden verarbeitet ...
Log ended: 2020-06-21  21:50:27

and

Log started: 2020-06-22  15:18:58
(Lese Datenbank ... ^M(Lese Datenbank ... 5%^M(Lese Datenbank ... 10%^M(Lese Datenbank ... 15%^M(Lese Datenbank ... 20%^M(Lese Datenbank ... 25%^M(Lese Datenbank ... 30%^M(Lese Datenbank ... 35%^M(Lese Datenbank ... 40%^M(Lese Datenbank ... 45%^M(Lese Datenbank ... 50%^M(Lese Datenbank ... 55%^M(Lese Datenbank ... 60%^M(Lese Datenbank ... 65%^M(Lese Datenbank ... 70%^M(Lese Datenbank ... 75%^M(Lese Datenbank ... 80%^M(Lese Datenbank ... 85%^M(Lese Datenbank ... 90%^M(Lese Datenbank ... 95%^M(Lese Datenbank ... 100%^M(Lese Datenbank ... 48974 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../openhab2_2.5.6-2_all.deb ...
Entpacken von openhab2 (2.5.6-2) über (2.5.6-1) ...
openhab2 (2.5.6-2) wird eingerichtet ...

[ESC[1;33mopenHABESC[0m] openHAB was not running so will not start after upgrade.
[ESC[1;33mopenHABESC[0m] Please use the command:
            sudo /bin/systemctl start openhab2.service

Trigger für systemd (232-25+deb9u12) werden verarbeitet ...
Log ended: 2020-06-22  15:19:50

Because since a while i have to restart openhab after updating (or cache clearing) once or twice anyway until it finds all items, i did not care to much. I will not swear, that i did not have to start manually. But if i remember right, openhab was running despite the message as i wrote.
Bute i’m totally shure, that openhab was running when i started the update.

Hi all,

I found the bug causing this and have fixed it. It will happen only one more time during an upgrade because the bug is present in the current install.

5 Likes