I’m trying to get Openhab running inside of a LXC Container on my Intel NUC 64
What I got so far:
installed OS Debian 9.9 stretch on the NUC
installed and setup LXC on that machine
created a Debian 9 container with working apt and network
installed latest stable Openhab for linux (2.4) inside the container
registered the service in sysctl
when I start the service and watch the status with
sudo /bin/systemctl status openhab2.service
I get this:
● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor pre
Active: activating (auto-restart) (Result: exit-code) since Sun 2019-05-19 14
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Process: 165 ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMOD
Main PID: 165 (code=exited, status=1/FAILURE)
I think openhab has exited because the debian9 container from lxc is a real minimal system… I think this happens because there are some dependencies unmet to get openhab running???
Any suggestions which applications are needed to run openhab inside this container?
another guy managed to get this running with openhabian but this is only for ARM processors I guess.
Ok I managed to get this running java wasn’t installed inside the container…
install with
sudo apt install default-jre
and finally see if it’s installed correctly
java -version
now openhab is running - got to check if its stable now…
btw if I check status I get the following warning:
● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-05-19 15:49:14 UTC; 20s ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Main PID: 92 (java)
Tasks: 80 (limit: 4915)
Memory: 280.1M
CGroup: /system.slice/openhab2.service
└─92 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdat
Mai 19 15:49:14 openhab2 systemd[1]: Started openHAB 2 - empowering the smart home.
Mai 19 15:49:28 openhab2 karaf[92]: WARNING: An illegal reflective access operation has occurred
Mai 19 15:49:28 openhab2 karaf[92]: WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/var/lib/openhab2/cache/org.eclipse
Mai 19 15:49:28 openhab2 karaf[92]: WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
Mai 19 15:49:28 openhab2 karaf[92]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Mai 19 15:49:28 openhab2 karaf[92]: WARNING: All illegal access operations will be denied in a future release
does anyone know what “com.thoughtworks.xstream.core.util.Fields” is??
openhab is configured to connect to mosquitto & influxdb over veth (virtual ethernet)
all my sonoffs (mqtt) connect to the mosquitto container. the squeezebox binding connects to the squeezeserver container.
Everything is up and running since 5 days without any errors or system halts. I think I like lxc
If anyone’s interested in configuration details to do something like this, please feel free to post your questions here…
maybe I’ll write a little tutorial if I find some time for it…
my container config at /var/lib/lxc/openhab2/config looks like this:
# Template used to create this container: /usr/share/lxc/templates/lxc-debian
# Parameters passed to the template: -r stretch -a amd64 --enable-non-free
# Template script checksum (SHA-1): b290eda01b21f9818fcf1402b2749c4c218500ed
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
lxc.network.name = eth0
lxc.network.hwaddr = xx:xx:xx:xx:xx:xx
lxc.network.ipv4 = 192.168.1.101/24
lxc.network.ipv4.gateway = 192.168.1.100
lxc.start.auto = 1
lxc.start.delay = 5
lxc.start.order = 3
lxc.rootfs = /var/lib/lxc/openhab2/rootfs
lxc.rootfs.backend = dir
# Common configuration
lxc.include = /usr/share/lxc/config/debian.common.conf
# Container specific configuration
lxc.tty = 4
lxc.utsname = openhab2
lxc.arch = amd64
and here’s the /etc/network/interfaces from the openhab container:
( path from outside the container: /var/ib/lxc/openhab2/rootfs//etc/network/interfaces )
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.101/24
gateway 192.168.1.1
Hope you can aquire the information you need from this, if not feel free to ask again
you have to create different containers with fixed IPs, I’ve used debian 11 containers.
then simply install the services via apt inside the containers.
For further information on howto connect them, there are several tutorials and infos on the forum and the websites of the mentioned services. Sorry but I don’t have the time to write you a detailed tutorial.
In Openhab you have to configure the services with the external IP and port that point to the service you want to connect to. Some appllications need a user and password config too.
Just a side note… if you’re not familar with using linux console maybe it’s not the best idea to start with LXC. But if you’re interested in learning new things try to use the tutorials above you certainly learn a lot about linux and it’s console by trying out by yourself. But there is absolutely no all-in-one solution to get this running.