Looking to replace Smartthings with openHAB, need advice

Is there any way to install openHABian in a docker container?

openHABian is basically a collection of scripts with a graphic menu which will help you install and setup packages on linux. You’re not missing out on features if you don’t use it, you just will have to install/configure some things by hand.

If you don’t mind the slightly higher power consumption of the T620 (~7W vs ~3W), together with a new Transcend MTS420S it’ll be a 70$ package that’s hard to beat. Just watch out, there is a version of the T620 with a dual core and there is a version with a quad core.

Also you’re massively overthinking things! You already have a nas with a docker set up, so I’d try to offload openhab there. If you are not happy or there are unresolvable problems it’s always easy to buy a another device.

Just get started and try to play around (that’s why I suggested to try it on your main machine, just extract the openhab files in a folder and you can run it).

1 Like

What I did when starting was run OpenHAB (& others I tried) in a VM on my main machine.

This would be a significant abuse of what Docker containers are for. A container is supposed to run one service. openHABian runs a bunch of services. A proper containerized approach would be to run each service as it’s own container (this is what I do actually). But for that you are pretty much on your own to set up each container and/or the Docker Compose file to launch all the different services.

Some feaures like zram would be missing of course. They don’t make sense in a containeried context.

ZRAM is a hack that cheap consumer grade hardware like RPi (that can only have shit storage) is able to run OpenHab with decency. That was my suggestion / urge to OpenHab creators and they needed around 2 years to enable it by default, even this function was successfully in operation on all Armbian for many years. Also on some Androids and other embedded applications …

I have to disagree.

People, me included, are running far more complex applications within Docker. Our CI on a day job is entirely containerized - it is running simultaneously a bunch of Yocto, Buildroot and hundreds of tests cases on Kubernetes cluster. Everything runs inside a Docker image (which development is partially my work). I would not call that abuse, but just a legit use of Docker. OpenHab runs a bunch of services, true, but compared to my experiences or to this setup its just a small utility. Also Armbian build system - which is again a very complex suite - runs just fine inside container.

Docker is IHMO actually a perfect way of deploying OpenHab(ian). It has been months since I recommend you to focus into Docker setup (only). Its for your own and users good - give less trouble to users and minimize support costs you have daily with people. I can only spot benefits.

… or its your policy to align with Canonical Snap instead of Docker? Which is perfectly legit decision, but in technical sense, is more or less the same.

Can be implemented and it make sense.

You do not use Debian or Alpine as base container images? Both OSs run multiple services themselves. I know of no modern OS that does not run multiple services.

I look forward to your alternative implementation. Since openHABian is, as you implied slow to adopt your suggestions and targeting shitty hardware.

And I’m not being glib. You seem to have a whole lot to complain about openHABian. You have what you believe is a better approach. So build that better approach. If it’s better, people will use it.

But what I’m referring to as an abuse is running:

  • openHAB
  • InfluxDB/MariaSQL/MySQL/etc.
  • Grafana
  • Mosquitto
  • Node Red
  • FrontTail
  • and more

And not every user of openHAB is going to need or even want all of those running. So then we need to build a whole configuration system for the monolithic Docker image (or build the 10! or so different Images that includes all combinations of all the services) so the users can pick and choose which services are running. If only there were some way to do that (cough cough Docker Compose cough cough).

And everything I’ve read, and everything I’ve been told by Docker reps, Kubernetes experts, and Red Hat OpenShift experts have stated emphatically that in a situation like we have with openHABian, multiple images orchestrated with something like Docker Compose is the “correct” approach. If you want a monolithic solution that includes everything, use a VM, perhaps built up using Vagrant.

I can’t and won’t speak to your specific use case but I still maintain that trying to run everything that openHABian does in a single container is an abuse of containers for which there are lots of superior containerized approaches.

I suggest reading up a little more about how containers actually work. A docker container is not a full OS. There is no initd or systemd running in these images (unless you put it there, though there are lighterweight approaches that tend to be preferred). If you run docker exec -it <openhab container name or ID> ps -elf how many processes do you see? Not many. A call to start.sh, the java process that is openHAB, and stuff that openHAB itself started (e.g. arpings from the Network binding, perhaps other scripts called by the Exec binding and executeCommandLine). Now run ps -elf | less on the host machine. How many pages of processes do you see? How many of those have a PPID of 1, 2, or 3? Those are all the processes that were started by the initialization system and are generally considered part of the OS. NOTE: I’m speaking in vast generalities here, there are exceptions of course.

A container is not a virtual machine. It’s not a full operating system. When you use a debian base image, you are getting many of the base libraries and functions that are configured with the debian distribution. But that doesn’t mean you get everything. I had to file an issue for the openHAB docker image to include ping and arping. Even basic utilities like that are typically missing unless you go out of your way to add them.

True, but openHAB containers are available both ways on Docker Hub.
image

from https://hub.docker.com/r/openhab/openhab/

Which is completely irrelevant. Did you actually read my reply? Containers do not work the way you think they do. They are not full operating systems. They come with a minimized (not necessarily minimal) set of binaries and libraries. The versions of those binaries and libraries come from debian or alpine. But you can’t take a copy of the Docker image and burn it to an SD card and boot off of it.

I realize they are not full operating systems. I was just stating there are 2 versions and one is preferred.
The link I posted even mentions this.

The Alpine images are substantially smaller than the Debian images but may be less compatible because OpenJDK is used

Which is also irrelevant.

I was replying specifically to:

Both sentences are generally false for the container base images, or at least not the same as when you run the full OS in a VM or on a computer. That’s not how container work. Sure, you can make them do that but it kind of defeats the purpose of running the container in something like Docker. By design, a container runs the bare minimum to provide the service(s) that it provides.

And just to be clear, I’m not arguing that no containers should ever run more than one service. What I’m arguing is that there are better containerized approaches to run everything that is provided by openHABian than putting everything into one monolithic container.

They are multi threaded, hence run multiple services. OpenHAB itself requires more that one thread to function!

You are mixing and matching terms. Multi-threaded is not the same as multi-process or multiple services. Multi-process means multiple separate programs running independently from one other. Multi-threaded is one software program running more than one thing at a time within itself.

And no one is saying that a container can’t run multiple programs at the same time. I’m not even arguing that containers shouldn’t run multiple programs at the same time in all cases, though I would argue a little against running multiple services (i.e. a program that gets called by other programs or users through an API). But unless you add in the ability to spawn and manage multiple programs at the same time by installing something into the container to manage it, a container is going to run exactly one program. In openHAB’s case, it runs start.sh which in turn spawns openHAB itself which in turn can spawn it’s own child processes.

That one service can spawn it’s own processes, as you can see with the arpings which are spawned by openHAB for example.

On a full operating system, process ID 1 is usually some sort of initialization service which in turn spawns all the services that must be running for the operating system to operate. Inside the container, in openHAB’s instance, process ID 1 is start.sh. There isn’t anything there to manage starting multiple programs running at the same time.

If, for some reason, you wanted to sshd in the openHAB container. You would have to install some sort of service manager into the container. That service manager would be PID 1. The service manager would then start sshd and start.sh.

I must be missing something. I brought up a Ubuntu Desktop on Virtualbox and walked through the openHABian install instructions. How do you start it?

Or was I supposed to follow the openHAB 2 install instructions under Linux then add openHABian?

Thanks,

Dave

I followed that article, no where can I find any reference to starting it. I browse to the ip:8080 and nothing…

Edit /etc/openhabian.conf to match your needs, then use

openhabian-config unattended

to get the automated openHABian installation going.

If the unattended installation does not work out, you can still try the openHABian configuration tool in interactive mode:

openhabian-config

You’ll get to see the openHABian configuration menu. Start at least with the menu options 11 and 12, then the “Manual/Fresh Setup” submenu entry is the right place for you. Mark all components / actions you think to be of value and execute them in one go to get the full openHABian experience:

Once everything is installed and configured, openHAB runs as a service and starts on it’s own.

I successfully completed everything you listed however it doesn’t appear to be running.

What service am I looking for and how do I confirm it’s running or not?

sudo systemctl status openhab2

I reinstalled my OS again and walked through the install, selecting the unattended option.
I installed all the improvements under the improvements menu.
I installed the Log Viewer and Mosquitto under the Optional Components.
I updated my passwords under system settings.
I exited the configuration tool and tried to access the web interface, nothing.
I then ssh’d to the instance with Putty, not the errors during login below, and ran the command to get the status of the service, also listed below.

Login errors:

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-40-generic x86_64)

0 updates can be installed immediately.
0 of these updates are security updates.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Tue Jul 14 19:23:53 2020 from 10.10.10.100

/usr/local/bin/FireMotD: line 149: ((: 10#3 > 10#UNKNOWN: value too great for ba se (error token is “10#UNKNOWN”)
/usr/local/bin/FireMotD: line 153: ((: 10#3 < 10#UNKNOWN: value too great for ba se (error token is “10#UNKNOWN”)
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
###############################################################################
############### openHABian ##################################################
###############################################################################

Ip = 10.10.10.220

Release = Ubuntu 20.04 LTS

Kernel = Linux 5.4.0-40-generic

Platform = VirtualBox

Uptime = 0 day(s). 0:19:18

CPU Usage = 7.61% avg over 2 cpu(s) (2 core(s) x 1 socket(s))

CPU Load = 1m: 1.18, 5m: 0.42, 15m: 0.30

Memory = Free: 0.00GB (0%), Used: 0.00GB (100%), Total: 3.84GB

Swap = Free: 1.46GB (100%), Used: 0.00GB (0%), Total: 1.46GB

Root = Free: 20.86GB (71%), Used: 8.42GB (29%), Total: 30.87GB

Updates = 0 apt updates available.

Sessions = 2 session(s)

Processes = 194 running processes of 4194304 maximum processes

###############################################################################

          Welcome to            __  _____    ____  _
        ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
       / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
      / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
      \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
          /_/
              openHAB 2.5.6-2 (Release Build)

Looking for a place to get started? Check out ‘sudo openhabian-config’ and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openHABian:8080
To interact with openHAB on the command line, execute: ‘openhab-cli --help’

Service:

● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/openhab2.service.d
└─override.conf
Active: activating (start-post) (Result: exit-code) since Tue 2020-07-14 20:13:18 EDT; 37s ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Process: 4247 ExecStartPre=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name “*.rules” -exec /usr/bin/rename.ul .rules .x {} ; (code=exited, status=0/SUCCESS)
Process: 4248 ExecStart=/usr/share/openhab2/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=127)
Main PID: 4248 (code=exited, status=127); Control PID: 4249 (sleep)
Tasks: 1 (limit: 4657)
Memory: 1.0M
CGroup: /system.slice/openhab2.service
└─4249 /bin/sleep 120

Jul 14 20:13:18 openHABian systemd[1]: Starting openHAB 2 - empowering the smart home…
Jul 14 20:13:19 openHABian karaf[4248]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Jul 14 20:13:19 openHABian karaf[4248]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Jul 14 20:13:19 openHABian karaf[4248]: /usr/share/openhab2/runtime/bin/karaf: 95: [: Illegal number:
Jul 14 20:13:19 openHABian karaf[4248]: /usr/share/openhab2/runtime/bin/karaf: 296: [: Illegal number:
Jul 14 20:13:19 openHABian karaf[4248]: /usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
Jul 14 20:13:19 openHABian systemd[1]: openhab2.service: Main process exited, code=exited, status=127/n/a
[20:13:56] dave@openHABian:~$

Thanks,

Dave