Binding install permission denied

Recently I decided to upgrade from a Raspberry Pi 3 to a PC running Ubuntu 16.04 LTS. I decided to start from scratch though and build the install from the ground up. I’ve been pretty successful so far but I hit a snag. I’m using the configuration files to install bindings and when I do I get the following error:

19:01:46.819 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-persistence-mapdb': Permission denied

When I set up the Pi I thought I remembered setting permissions for an openhab user but when I look at what users have been created on the system there is no openhab user or group. I followed the install documentation for Linux and it doesn’t mention anything about an openhab user or group. Did I miss something? Do I need to add the user and permissions?

Thanks for your help!

Matt

:slight_smile: for manual installations:

http://docs.openhab.org/installation/linux.html#manual-installation

If you are installing using the package repository (highly recommended), this step (user creation) is performed by the package. Check with tail /etc/passwd to see the last users created (don’t edit this file :))

So: You have the openHAB process up & running (as user root?) and you edit /opt/openhab2/conf/services/addons.cfg (with manual installation), add persistence = mapdb and you get this error?

That’s the strange thing. I used the repository installation method and it didn’t create the proper user. OpenHAB starts up and runs just fine. I may not have it running as root though. Last time I installed on the Pi so I think the permissions may have been slightly different.

But you are correct, I open the addons.cfg file but from the repository installation location. Then in the persistence section I add the line above just as you entered it. I don’t know if the repository didn’t install correctly, if I missed a step, or if I have to adjust OpenHAB to run as root.

no, don’t run (any service) as root :slight_smile:

so: you don’t have an entry in your /etc/passwd file like:

openhab:x:116:122:openhab2 runtime user,,,:/var/lib/openhab2:/bin/false

???
that’s very strange. The user should have been created by the apt installation package.

what does your /etc/systemd/system/multi-user.target.wants/openhab2.service say about:

[Service]
...
User=openhab
Group=openhab

the service starts correctly with systemctl start openhab2 ?

I do have an openhab entry in my passwd file, so that was created ok, and the openhab2.service file lists the user and group, so apparently they were created correctly. But I run the following commands:

users

and get

matthew matthew

and

groups

and get

matthew adm cdrom sudo dip plugdev lpadmin sambashare

Maybe I’m looking for the wrong thing but it seems like OpenHAB just never received permission to access the /etc/openhab file.

these 2 commands (users & groups) will display info about the currently logged in user (and its group)

to see the available users in your linux system, check /etc/passwd and /etc/group files.

can you post the output of the following commands:

sudo su
ls -al /etc/openhab2/

(sudo su will switch you from user matthew to root … if the user is allowed to sudo :slight_smile:)

I just did a purge this morning and re-ran the repository installer. I just ran the ls command and got:

drwxr-xr-x  13 openhab openhab  4096 Jul 15 12:05 .

drwxr-xr-x 135 root root 12288 Jul 15 12:10 …
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 html
drwxr-xr-x 3 openhab openhab 4096 Jul 15 12:05 icons
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 items
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 persistence
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 rules
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 scripts
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 services
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 sitemaps
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 sounds
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 things
drwxr-xr-x 2 openhab openhab 4096 Jul 15 12:05 transform

So it looks like re-running the install corrected the permissions. That was strange that it didn’t do that in the first place.

1 Like

check also /var/lib/openhab2/ & /usr/share/openhab2/ for permissions (they should have the same as /etc/openhab2/

did the error go away now? (Permission denied while trying to install mapdb persistence)

Yeah, the error went away. That’s so strange that it didn’t configure right the first time around. I wonder if anyone else ran into any issues with that.

Thanks for the help, I was unaware of the passwd and group files. So I will make note of that for the future.

Out of curiosity is there a way I can add user matthew to the openhab group? Since the openhab group owns the config files I was hoping to make myself a user in the group so I don’t have to change my samba login. If not I’ll just change the login.

sure:

useradd -G {group-name} username

so:

useradd -G openhab matthew

Ok, didn’t know if that would would on a system wide group or not. Still learning a lot about Linux.

Thanks for your help!

1 Like