/etc/init.d/openhab startup says "Failed to start LSB: OpenHAB Daemon."

Hi @all, I have been migrating my old openhab 1.8.3 installation from Raspbian to Ubuntu and now back to Raspbian by simply copying the /opt/openhab-1.8.3-runtime and …/addons and setting the execute flags on the .sh scripts.

After the second migration, when I had set up the service and tried to start it, I get the error message below.
The service script is taken from http://www.homeautomationforgeeks.com/openhab_start.shtml

best regards

Klaus

pi@haus:/etc/init.d $ sudo service openhab start
Job for openhab.service failed. See 'systemctl status openhab.service' and 'journalctl -xn' for details.
pi@haus:/etc/init.d $ sudo systemctl status openhab.service
● openhab.service - LSB: OpenHAB Daemon
   Loaded: loaded (/etc/init.d/openhab)
   Active: failed (Result: exit-code) since Wed 2017-05-31 15:53:38 UTC; 12s ago
  Process: 3787 ExecStart=/etc/init.d/openhab start (code=exited, status=203/EXEC)

May 31 15:53:38 haus systemd[1]: openhab.service: control process exited, code=exited status=203
May 31 15:53:38 haus systemd[1]: Failed to start LSB: OpenHAB Daemon.
May 31 15:53:38 haus systemd[1]: Unit openhab.service entered failed state.
pi@haus:/etc/init.d $ sudo journalctl -xn
-- Logs begin at Wed 2017-05-31 12:51:39 UTC, end at Wed 2017-05-31 15:54:08 UTC. --
May 31 15:53:38 haus systemd[3787]: Failed at step EXEC spawning /etc/init.d/openhab: No such file or directory
-- Subject: Process /etc/init.d/openhab could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /etc/init.d/openhab could not be executed and failed.
--
-- The error number returned while executing this process is 2.
May 31 15:53:38 haus systemd[1]: openhab.service: control process exited, code=exited status=203
May 31 15:53:38 haus systemd[1]: Failed to start LSB: OpenHAB Daemon.
-- Subject: Unit openhab.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openhab.service has failed.
--
-- The result is failed.
May 31 15:53:38 haus systemd[1]: Unit openhab.service entered failed state.
May 31 15:53:38 haus sudo[3766]: pam_unix(sudo:session): session closed for user root
May 31 15:53:50 haus sudo[3793]: pi : TTY=pts/1 ; PWD=/etc/init.d ; USER=root ; COMMAND=/bin/systemctl status openhab.s
May 31 15:53:50 haus sudo[3793]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
May 31 15:53:50 haus sudo[3793]: pam_unix(sudo:session): session closed for user root
May 31 15:54:07 haus sudo[3801]: pi : TTY=pts/1 ; PWD=/etc/init.d ; USER=root ; COMMAND=/bin/journalctl -xn
May 31 15:54:08 haus sudo[3801]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
pi@haus:/etc/init.d $ ls -la openhab
-rwxr-xr-x 1 root root 2655 Jan 15 18:49 openhab
pi@haus:/etc/init.d $

Resolved. Problem was wrong file format:Lines were terminated with ^M.
I should have used ASCII conversion in WinSCP or simple copy/paste from Windows/Eclipse into Raspbian/vi.

1 Like