openHAB3 docker; unable to install addons

  • Platform information:

    • Hardware: RPi2 with sd-card
    • OS: RaspbianOS latest version
    • Java Runtime Environment:
      openjdk version “11.0.9.1” 2020-11-04
      OpenJDK Runtime Environment (build 11.0.9.1+1-post-Raspbian-1deb10u2)
      OpenJDK Server VM (build 11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode)
    • openHAB version: 3.0.0 (Docker)
  • Issue of the topic: Unable to install add-ons.

  • Please post configurations (if applicable):

    indent preformatted text by 4 spaces

openhab:
image: “openhab/openhab:3.0.0”
container_name: openhab
restart: unless-stopped
network_mode: host

volumes:
  - "/etc/localtime:/etc/localtime:ro"
  - "/etc/timezone:/etc/timezone:ro"
  - "./volumes/openhab/addons:/openhab/addons"
  - "./volumes/openhab/conf:/openhab/conf"
  - "./volumes/openhab/userdata:/openhab/userdata"
environment:
  OPENHAB_HTTP_PORT: "8080"
  OPENHAB_HTTPS_PORT: "8443"
  EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
restart: unless-stopped
user: “1883”
ports:
- “1883:1883”
volumes:
- ./volumes/mosquitto/data:/mosquitto/data
- ./volumes/mosquitto/log:/mosquitto/log
- ./volumes/mosquitto/pwfile:/mosquitto/pwfile
- ./services/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
- ./services/mosquitto/filter.acl:/mosquitto/config/filter.acl

  • Items configuration related to the issue
  • Sitemap configuration related to the issue
  • Rules code related to the issue
  • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

This is a fresh install (i am using Sensors/IOTstack) . The part of docker-compose.yml with openhab is written above.
After the install, and configuring the user, when i try to add add-ons i get this error message:
image

This is my first attempt to use openhab with Docker. My former openHAB 2.5 install (RPi4/SSD) is using openHABian. That is running OK.

Hopefully someone has an idea where to look for this issue?

This relates to openHAB how?
Please use code fences.
How to use code fences - Tutorials & Examples - openHAB Community

I am sorry, but i was using fence code: image
But for some reason this did not worked as intenden.
But the code should be YAML formatted, and it is on my system; the docker-compose install install went without errors.

mosquitto volumes are not used by openHAB though.

Does user 9000 (I think, look at the Dockerhub writeup) have permission to read and write to all the voulmes you’ve mounted?

1 Like

@rikoshak Yes i think you are right, it must have something to do with user/group rights.
I did not payed attention to this when installing my iotstack… I’l have to look into this.
@Bruce_Osborne, I know mosquitto is not part of openhab. I should not have included it in my description. But my IOTstack consist of 12 applications, among which mosquitto.
Thank you both for your help so far.
Regards Bert
Ps, I do not know what is happening with the formatting. I have posted things in the past without this problem… Will check with an other browser.

Actually I somehow missed the openHAB part. Sorry about that.

Ok, started from scratch; removed all containers and images, so a clean docker environment.
Removed old user and group openhab and (re)created new ones, following the openhab docs.
user openhab with UID 9001, group openhab with GID 9001. (also acc. the User and Group Identifiers as shown in the Docker Hub page.)
Btw, i am logged in as user pi. (user openhab is not able to login according to the openhab docs).

sudo useradd -r -s /sbin/nologin openhab

I use this docker run command (not using docker-compose for symplicity, but with host directories for my specific situation):

docker run \
    --name openhab \
    --net=host \
    -v /etc/localtime:/etc/localtime:ro \
    -v /etc/timezone:/etc/timezone:ro \
    -v /home/pi/IOTstack/volumes/openhab/conf:/openhab/conf \
    -v /home/pi/IOTstack/volumes/userdata:/openhab/userdata \
    -v /home/pi/IOTstack/volumes/addons:/openhab/addons \
    -d \
    -e USER_ID=9001 \
    -e GROUP_ID=9001 \
    --restart=always \
    openhab/openhab:3.0.0

But when openhab starts i have the same problem; not able to add add-ons…

I checked the user:group settings for the openhab directories, they are openhab:openhab.
Also set the permissions tor the dirs addons, conf and userdata to 777 (recursively)
But it did not solve the issue.

This is my first attempt with Docker for openHAB (my old 2.5 version is made with openHABian). But i have an other RPi4 running with Home Assistant also with the Sensors/IOTstack and with about 15 containers running flawlessly.
I started home automation with openhab 1.8, but i always had difficulties (not being a programmer) with the Automations. That’s why i switched this year to Home Assistant, which is for non-programmers much easier. But i always liked openhab and with the introduction of version 3, i thought lets give it another try. According to the presentation this december it should be easier to program using the GUI…

But unfortunately with my first attempt i run into this… Hopefully you can help me…
Regards, Bert

What are the user & group IDs of this user?
ud -g openhab and id -u openhab

If they are not both 9001 you need to change your docker run command.

Hi Bruce,
They are correct in my opinion:

    pi@oh-241:~ $ id openhab
    uid=9001(openhab) gid=9001(openhab) groups=9001(openhab)

As i wrote, i purposely deleted the user and group, and recreated them again with the correct UID/GID.

I followed the staps in Docker | openHAB and opted for Running the container as a Service Managed by Docker.
Btw Java 11 is installed on the host file system:

pi@oh-241:~ $ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Raspbian-1deb10u2)
OpenJDK Server VM (build 11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode)

(I know, the easiest way to get openhab running is using openHABian. Thats how i run my 2.5 version. But i would like to move to an Intel NUC in the near future, and since i gained a little experience with Home Assistant in docker, i would like to use docker for openhab as well. Also i can use the NUC for far more stuff…)

Ok, i changed tactic. I left the Sensors/IOTstack approach and started with an new sd-card.
Installed Docker and then i followed the steps from the openHAB docs including the /opt/openhab directory for the install volumes.
This is working OK. So there must be something in the Sensors/IOTstack scripts which is necking me. I won’t figure out what is going wrong, instead now i know the docker install of openhab is working, i am making my own IOTstack with all the apps i need.

@rlkoshak Rich, thanks for pointing me to the user/group IDs posibility, but that was not the cause.
I wish you both @rlkoshak and @Bruce_Osborne a fine New Years Eve and hopefully a much better 2021!
Kind regards, Bert

1 Like

I have the exactly problem with the addon folden on IOTstack, but i want to find the cause of this problem.

my compose

  openhab:
    image: openhab/openhab:latest
    environment:
      OPENHAB_HTTP_PORT: '30007'
      OPENHAB_HTTPS_PORT: '30008'
      EXTRA_JAVA_OPTS: -Duser.timezone=Europe/Berlin
    volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
    - ./volumes/openhab/addons:/openhab/addons
    - ./volumes/openhab/conf:/openhab/conf
    - ./volumes/openhab/userdata:/openhab/userdata
    ports:
    - 5007:5007
    - 8101:8101
    - 9124:9124
    container_name: openhab
    restart: unless-stopped
    network_mode: host

the user in container is openhab with uid&gid 9001 the folder on raspberry
IOTstack/volumes/openhab/addons is owned by that.

if i bash into the container the addons folder is there and the file i want to install have that rights too.

but nothing is happen in the logs no entries of this file.
the file i want to install is org.openhab.binding.speedtest-3.1.0-SNAPSHOT.jar
from here

any tipps or hints are welcome

Just curious - what do you have in your Network settings? In my case, many things did not work correctly until I set the default IP address to be that of the host in Network settings. Otherwise, be default, the OH3 Docker container used an internal IP address of 169.254.xxx.xxx.

I use network_mode host so my ip is my local pi ip.

So, i made a new clena installation from scratch and if i put something in the addon folder nothing is happen, same as befor.

How could i debug this, how to setup a debug for this “watcher” of this folder so i could setup something.

I’m on IOTstack and the only file belongs to openhab is the yml template that generates the docker-compose. So there are no script that block or do someting else in there.

I followed the Docker documentation. Created user, added my to the group, etc. I created the directories and authorized them accordingly as well.

here is my current compose

  openhab:
    image: openhab/openhab:latest
    environment:
      OPENHAB_HTTP_PORT: '30007'
      OPENHAB_HTTPS_PORT: '30008'
      EXTRA_JAVA_OPTS: -Duser.timezone=Europe/Berlin
      USER_ID: '999'
      GROUP_ID: '994'
      CRYPTO_POLICY: 'unlimited'
    volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
    - ./volumes/openhab/addons:/openhab/addons
    - ./volumes/openhab/conf:/openhab/conf
    - ./volumes/openhab/userdata:/openhab/userdata
    ports:
    - 5007:5007
    - 8101:8101
    - 9124:9124
    container_name: openhab
    restart: unless-stopped
    network_mode: host

I don’t want to gave up on this so, any hints or tipps still welcome.

thank you all for your time and effort, have a good night

In the karaf console i could list the addon with bundle:list and it gets listed if i remove it from the folder it disappears from the list.
But still no messages in any log if i put it in there or delete it. But it works and appears in the gui.