Openhab2 doesn't run after powerout - help

I have openHAB 2.3.0-1 on OpenHabian.

Today I had a power outage and since the power was restored I can’t acccess the WEBUI.
In addition the SAMBA shares do not exist on the network.

I SSHed into the raspberrypi successfully and all folders seem intact:

  • /etc/openhab2 exists and seems OK
  • /var/lib/openhab2 exists and seems OK

I tried runnig openhab from command line: “sudo systemctl restart openhab2.service” (also tried stop, start).
I looked at the log file using nano and don’t see any update since the power outage.

What can I do to investigate/fix this?

If on SD card you may have some corruption. :face_with_raised_eyebrow: Not sure about the exact wording, check the docs, try starting samba with sudo systemctl samba start.

How do I start SAMBA? “sudo systemctl samba start” doesn’t work.

installation is on SD card - how can I check for corruption?
How can I fix it and have my current setup/settings intact?

What about:

sudo systemctl start smbd nmbd

Or, to check the status:

sudo systemctl status smbd nmbd

What do you see after the systemctl restart of OH? If there are errors starting up OH there should be some errors shown there. Also the status will show whether OH actually started up or not.

You can see these same logs by running

tail -f /var/log/syslog | grep openhab

when I run “sudo systemctl start smbd nmbd”:

[17:55:31] openhabian@openHABianPi:/boot$ sudo systemctl start smbd nmbd
Job for smbd.service failed because the control process exited with error code.
See "systemctl status smbd.service" and "journalctl -xe" for details.
Job for nmbd.service failed because the control process exited with error code.
See "systemctl status nmbd.service" and "journalctl -xe" for details.

When I run “sudo systemctl status smbd nmbd”:

 sudo systemctl status smbd nmbd
● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-11-02 17:56:52 IST; 16s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 5205 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=127)
 Main PID: 5205 (code=exited, status=127)

Nov 02 17:56:52 openHABianPi systemd[1]: Starting Samba SMB Daemon...
Nov 02 17:56:52 openHABianPi smbd[5205]: /usr/sbin/smbd: error while loading shared libraries: /usr/lib/arm-linux-gnueab
Nov 02 17:56:52 openHABianPi systemd[1]: smbd.service: Main process exited, code=exited, status=127/n/a
Nov 02 17:56:52 openHABianPi systemd[1]: Failed to start Samba SMB Daemon.
Nov 02 17:56:52 openHABianPi systemd[1]: smbd.service: Unit entered failed state.
Nov 02 17:56:52 openHABianPi systemd[1]: smbd.service: Failed with result 'exit-code'.

● nmbd.service - Samba NMB Daemon
   Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-11-02 17:56:52 IST; 16s ago
     Docs: man:nmbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 5206 ExecStart=/usr/sbin/nmbd $NMBDOPTIONS (code=exited, status=127)
 Main PID: 5206 (code=exited, status=127)

Nov 02 17:56:52 openHABianPi systemd[1]: Starting Samba NMB Daemon...
Nov 02 17:56:52 openHABianPi nmbd[5206]: /usr/sbin/nmbd: error while loading shared libraries: /usr/lib/arm-linux-gnueab
Nov 02 17:56:52 openHABianPi systemd[1]: nmbd.service: Main process exited, code=exited, status=127/n/a
Nov 02 17:56:52 openHABianPi systemd[1]: Failed to start Samba NMB Daemon.
Nov 02 17:56:52 openHABianPi systemd[1]: nmbd.service: Unit entered failed state.
Nov 02 17:56:52 openHABianPi systemd[1]: nmbd.service: Failed with result 'exit-code'.
lines 1-31/31 (END)

Regarding “tail -f /var/log/syslog | grep openhab”
As I wrote in OP I get no new lines in the log after running “sudo systemctl restart openhab2.service”

Correction regarding “tail -f /var/log/syslog | grep openhab”

[17:59:05] openhabian@openHABianPi:/boot$ tail -f /var/log/syslog | grep openhab
Nov  2 17:59:27 openHABianPi systemd[1]: Started Session c3 of user openhabian.
Nov  2 17:59:53 openHABianPi systemd[1]: openhab2.service: Main process exited, code=killed, status=11/SEGV
Nov  2 17:59:53 openHABianPi systemd[1]: openhab2.service: Control process exited, code=exited status=139
Nov  2 17:59:53 openHABianPi systemd[1]: openhab2.service: Unit entered failed state.
Nov  2 17:59:53 openHABianPi systemd[1]: openhab2.service: Failed with result 'signal'.
Nov  2 17:59:58 openHABianPi systemd[1]: openhab2.service: Service hold-off time over, scheduling restart.
Nov  2 17:59:59 openHABianPi systemd[1]: openhab2.service: Main process exited, code=killed, status=11/SEGV
Nov  2 17:59:59 openHABianPi systemd[1]: openhab2.service: Control process exited, code=exited status=139
Nov  2 17:59:59 openHABianPi systemd[1]: openhab2.service: Unit entered failed state.
Nov  2 17:59:59 openHABianPi systemd[1]: openhab2.service: Failed with result 'signal'.
Nov  2 18:00:04 openHABianPi systemd[1]: openhab2.service: Service hold-off time over, scheduling restart.
Nov  2 18:00:04 openHABianPi systemd[1]: openhab2.service: Main process exited, code=killed, status=11/SEGV
Nov  2 18:00:05 openHABianPi systemd[1]: openhab2.service: Control process exited, code=exited status=139
Nov  2 18:00:05 openHABianPi systemd[1]: openhab2.service: Unit entered failed state.
Nov  2 18:00:05 openHABianPi systemd[1]: openhab2.service: Failed with result 'signal'.
Nov  2 18:00:10 openHABianPi systemd[1]: openhab2.service: Service hold-off time over, scheduling restart.
Nov  2 18:00:10 openHABianPi systemd[1]: openhab2.service: Main process exited, code=killed, status=11/SEGV
Nov  2 18:00:10 openHABianPi systemd[1]: openhab2.service: Control process exited, code=exited status=139
Nov  2 18:00:10 openHABianPi systemd[1]: openhab2.service: Unit entered failed state.
Nov  2 18:00:10 openHABianPi systemd[1]: openhab2.service: Failed with result 'signal'.

Keeps repeating

I tried running fsck “fsck -A -C -r -N -V”
I ran “-N” option because the fielsystem is mounted.

[18:13:01] openhabian@openHABianPi:~$ fsck -A -C -r -N -V
fsck from util-linux 2.29.2
Checking all file systems.
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -C0 /dev/mmcblk0p2
[/sbin/fsck.vfat (1) -- /boot] fsck.vfat /dev/mmcblk0p1

Getting nothing…

sudo touch /forcefsck
sudo reboot
sudo rm /forcefsck

Ran 1st 2 lines and no can’t access SSH.
How do I know the progress? I am running headless.

you don’t when headless
wait for it to finish… it could take a few mins (especially if it detects errors and tries to correct them)

Does it require a keyboard input at any stage - if so I could be waiting forever :wink:

no, it doesn’t

and if I remember well, the /forcefsck file will be removed automatically, but just check if it is still there when the system comes back up (and remove it if yes)

FSCK completed but still same log and SAMBA errors as before when trying to start OPENHAB and SAMBA.

does this file exist?
you need to dig into the logs and try to see what fails.
most likely you have file system corruption and fsck was not able to repair it :frowning:

backup whatever you can and see if you can start clean

invest in a small/cheap UPS to protect a few electronics in your home :slight_smile:

some people say that they use a battery bank to protect their rPi (Mains → Battery bank → rPi)
I have one but my model does not charge and provide USB power at the same time. maybe there are some models that do this out there. A UPS is better because you can link it to the rPi and have it shut down gracefully.