Org.apache.felix.fileinstall - complaining about file location

  • Platform information:
    • Hardware: x86
    • OS: Debian Stretch
    • Java Runtime Environment: Zulu 8 8.42.0.23
    • openHAB version: 2.4.0

I tempted to switch between a normal installation and Docker, both on 2.4.0. But first tries exposed some issues and handicaps a docker installation has in terms of network and exec binding.

Between switching the two modes, I detected an issue with org.apache.felix.fileinstall.
The interesting is, I had the issue moving to a Docker installation and then reverting it. Moving to the Docker setup I mapped existing directories to the container, ensuring all my config, widgets a.s.o are kept.
So, now I move back and get the following error message:

2019-11-12 20:56:55.054 [WARN ] [org.apache.felix.fileinstall        ] - /openhab/addons does not exist, please create it.
2019-11-12 20:56:55.064 [ERROR] [org.apache.felix.fileinstall        ] - Cannot create folder /openhab/userdata/tmp/bundles. Is the folder write-protected?
2019-11-12 20:56:55.065 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedServiceFactory, id=37, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.c1e1a3cc-6144-4592-abe3-345300402702
  java.lang.RuntimeException: Cannot create folder: /openhab/userdata/tmp/bundles

This refers actually to the Docker file locations, and it looks to be cached somewhere.
I cleared already the /var/lib/openhab2/userdata/tmp and /var/lib/openhab2/userdata/cache folders. But this does not change anything.

Permissions to folders a.s.o are checked and correct.

So, where can I find the setting for this and clear it?

That is because the program is looking in /openhab/userdata not /var/lib/openhab2. Some environment variables or other parameters must be incorrect.

The Docker container uses a manual type install. $OH_CONF is located in /openhab/conf instead of /etc/openhab2 and $OH_USERDATA is located in /openhab/userdata instead of /var/lib/openhab2.

Please show what arguments you are passing to docker run, in particular your volume mappings. The errors seem to indicate that the openhab user (by default uid 9001 IIRC) does not have permission to write to the volume you mapped in to /openhab/userdata.

Of course. openHAB only sees the the file system inside of the container. It doesn’t have a /var/lib/openhab2 folder.

The container’s settings are correct. I think OP is confused about where things are located and how volumes get mounted into containers.

I got confused and thought they moved from Docker to the native OS.:crazy_face:

Well, actually that is what I did, reverting Docker back to native OS finally.
I returned to native OS for some other reasons.

Anyway, I’m back now on native OS. Where is the $OH_USERDATA variable set in native OS?
The org.apache.felix.fileinstall still assumes that I try to run a Docker system.

It varies depending on how you installed. Try /var/lib/openhab2

So, I re-installed openHAB using, but problem persists. Checking with openhab-cli -info I receive the following values:
openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 20912)
User Groups: openhab

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | root:root
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

This matches is type of installtion I have: native OS.
But on start-up, I still receive this message:

2019-11-22 08:46:29.029 [WARN ] [org.apache.felix.fileinstall        ] - /openhab/addons does not exist, please create it.
2019-11-22 08:46:29.048 [ERROR] [org.apache.felix.fileinstall        ] - Cannot create folder /openhab/userdata/tmp/bundles. Is the folder write-protected?
2019-11-22 08:35:08.420 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedServiceFactory, id=37, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.c1e1a3cc-6144-4592-abe3-345300402702
    java.lang.RuntimeException: Cannot create folder: /openhab/userdata/tmp/bundles

Any idea to get rid of it?

Does the openhab user own and have full permissions to those directory trees?

The permissions were all correct. The org.apache.felix.fileinstall was just always looking at the wrong place. Since I did not find any hint to tweak this behavior back to normal, I decided to do the following:

  1. save all user config data, e.g. icons, rules, etc.

  2. De-install openHAB including purging all related data using apt-get purge openhab2*

  3. Re-install openHAB incl. the corrections may reqiered for items, thinks, etc.

That actually fixed this issue.

Other articles are already mentioning that moving directories under openHAB is not easy, especially the org.apache.felix.fileinstall.

1 Like