Ubuntu 16.04 openhab start as daemon

  • Platform information: Ubuntu 16.04
    • openHAB version: 2.5.5

Dear community,

I have an openhab2.5.5 running on an Ubuntu Server 16.04 (on my old laptop). I can start the openhab with the following command:

sudo service openhab start

The problem is, when I do this, the console starts and if I leave the console, or close the terminal, or type “logout” (or Ctrl+D), the openhab service stops every time. I would like to start the openhab as a daemon.

Could somebody help me please?

Thanks,
Robert

Not if the documentation provided is not sufficient.

Have you tried to use “sudo systemctl enable openhab2” before using “sudo systemctl start openhab2” ?

Yes, I did this way. When I run “systemctl list-unit-files”, I can see the following:

openhab2.service enabled

But when I try to run “systemctl start openhab2.service”, I got the following error message:

Failed to start openhab2.service: Unknown unit: openhab2.service
See system logs and ‘systemctl status openhab2.service’ for details.

Perhaps the file got deleted but the enabling symlink is still present.

And what is the content of the system logs resp. the output of the command that is part of the error message?

1 Like

The SystemD on that version of Ubuntu is pretty old. I wonder if the way it handles the service files has changed. It is supposed to start up the service in the background as a service and that is how it works on more recent Linux systems. I think your best bet is going to look at the .service file compared to the docs for the version of SystemD that you are running and see if it relies on stuff that was not supported in that older version.

Alternatively updating to a more recent LTS version of Ubuntu will bump you up to a later version of SystemD.

1 Like

I am running OH 2.5.8 on a cubietruck which runs Ubuntu 16.04.7 LTS.
The openhab.service file that is provided by the dep package works with this version of Ubuntu.