openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
897 stars 415 forks source link

OpenHAB 4.1.2 - Karaf cannot start #4231

Open EnziinSystem opened 1 month ago

EnziinSystem commented 1 month ago

My environment:

$ uname -a
Linux smarthome 6.6.30-v8+ #1763 SMP PREEMPT Mon May 13 17:50:31 BST 2024 aarch64 GNU/Linux

$ java --version
openjdk 17.0.11 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)

Install OpenHAB 4.1.2

Create a Linux system user for openHAB.

sudo adduser --system --no-create-home --group --disabled-login openhab

wget -O openhab-download.zip https://github.com/openhab/openhab-distro/releases/download/4.1.2/openhab-4.1.2.zip

sudo unzip openhab-download.zip -d /opt/openhab

Grant permission

sudo chown -hR openhab:openhab /opt/openhab

Privileges for Common Peripherals

sudo adduser openhab dialout
sudo adduser openhab tty
sudo adduser openhab audio

sudo adduser $USER dialout
sudo adduser $USER tty

sudo usermod -a -G dialout openhab
sudo usermod -a -G dialout $USER

Execute as restricted user openhab:

$ sudo su -s /bin/bash -c "/opt/openhab/start.sh" openhab
Launching the openHAB runtime...
/opt/openhab/runtime/bin/karaf: 54: cd: can't cd to /home/developer
/opt/openhab/runtime/bin/karaf: 67: .: cannot open ./inc: Permission denied

I think I do very basic, things and nothing special. Everything is there, permissions have been granted, but a permissions error occurs.

rkoshak commented 1 month ago

Shouldn't the command to start OH be the following?

sudo -u openhab /opt/openhab/start.sh

Is there a reason you are not installing from the package manager?

EnziinSystem commented 1 month ago

Shouldn't the command to start OH be the following?

sudo -u openhab /opt/openhab/start.sh

Is there a reason you are not installing from the package manager?

I choose the manual installation method so that I always have the version I want and it is only located in the /opt/openhab directory.

What's wrong with installing it manually?

florian-h05 commented 1 week ago

There is no problem with installing it manually in general, but looking at your console output, you have problems with permissions, I don‘t think this is an Karaf issue.

wborn commented 6 days ago
/opt/openhab/runtime/bin/karaf: 54: cd: can't cd to /home/developer
/opt/openhab/runtime/bin/karaf: 67: .: cannot open ./inc: Permission denied

Probably your environment variables or openhab user homedir is not configured properly. E.g. the Karaf scripts use $HOME which in your case is set to /home/developer for which the openhab user has no write permission.