openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
821 stars 252 forks source link

Systems Tweaks (Menu Item 13) fails on clean Debian installation #1380

Closed juanhaywood closed 3 years ago

juanhaywood commented 3 years ago

Issue information:

Systems Tweaks (Menu Item 13) fails on clean Debian installation when using the interactive mode of openhabian-config.

Debug information:

Debug log:

+ echo -n '2021-01-05_10:40:48_SAST [openHABian] Applying miscellaneous system settings... '
2021-01-05_10:40:48_SAST [openHABian] Applying miscellaneous system settings... + cond_echo 'Setting Java and arping file capabilites'
+ [[ -z '' ]]
+ echo -e '\033[33;01mSetting Java and arping file capabilites\033[39;49;00m'
Setting Java and arping file capabilites
++ realpath /usr/bin/java
+ cond_redirect setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' /usr/bin/java
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ setcap cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep /usr/bin/java \033[39;49;00m'

$ setcap cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep /usr/bin/java 
+ setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' /usr/bin/java
Failed to set capabilities on file `/usr/bin/java' (No such file or directory)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file
+ return 1
+ echo 'FAILED (setcap java)'
FAILED (setcap java)
+ return 1
+ '[' 1 -ne 0 ']'
+ whiptail --msgbox 'There was an error or interruption during the execution of:\n  "10 | Apply Improvements"\n\nPlease try again. If the error persists, please read /opt/openhabian/docs/openhabian-DEBUG.md or https://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md how to proceed.' 14 80

System information:

OS: Debian HW: Hyper-v VM

cat /etc/os-release output: PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

uname -m output: i686

mstormi commented 3 years ago

I think you have a problem with your java install

either way this should be fixed by https://github.com/openhab/openhabian/commit/d2ec9e14d6ad5d3e81c1d616f0241e7ebc4456d2

juanhaywood commented 3 years ago

I didn't install java. I assumed it's installed by Menu item 11 - Packages?

mstormi commented 3 years ago

nope. Guessing (aka users taking assumptions but not validate before using) are the safest way to waste work and time on everybody's part. manu 46

juanhaywood commented 3 years ago

Well, I'm sorry that you feel I've wasted everyone's work and time...

The fact remains though that prior to running openhabian-config for the first time,java -version indicated that no java was installed.

I then ran Menu 2, then Menu 3, then menu 11, and then menu 2 again. After which, java -version indicated java was installed:

root@openhab3deb:/home/juan# java -version openjdk version "11.0.9.1" 2020-11-04 LTS OpenJDK Runtime Environment Zulu11.43+55-CA (build 11.0.9.1+1-LTS) OpenJDK Server VM Zulu11.43+55-CA (build 11.0.9.1+1-LTS, mixed mode)

As such, it's still not my java that has a problem as you had mentioned, but rather the java installed by openHABian at some point during the above, which was the point I was trying to make. Surely if it is the java installed during the above procedure that has a problem, it is something others will run into as well?

Could I also suggest then that, since the interactive tool is suggested for beginners like myself ("As a beginner, use the interactive openhabian-config tool!"), the installation instructions are updated to reflect the sequence that menu items are to be executed? As it stands, Menu Item 11 - Packages has the following in the description: "Install needed and recommended system packages". Thus my offending assumption that it was the command having installed java.

mstormi commented 3 years ago

Well, I'm sorry that you feel I've wasted everyone's work and time...

I didn't mean to say that. But yes, in general users making assumptions and not validating them is indeed the largest source for wasted work - for them as well as for me.

As such, it's still not my java that has a problem OpenJDK Runtime Environment Zulu11.43+55-CA (build 11.0.9.1+1-LTS)

The java on your system is installed but apprently it has a problem that it is not located in /usr/bin. That is no matter who installed it (you manually or you using openhabian menu). It's a property of the java package so not my problem either. You selecting menu 11 installed it. As would have an "unattended" run or image based install.

Seems on your x86 system the java package install procedure does not properly create links in /usr/bin where it should do.

Run which java, realpath $(which java) and realpath /usr/bin/java please in shell.

Surely if it is the java installed during the above procedure that has a problem, it is something others will run into as well?

Probably but I cannot reproduce it as it requires a x86 Debian. Could you please validate if my fix helps? You would need to manually uninstall your java and oh, then reinstall through menu 03. apt purge

Could I also suggest then that [...] the installation instructions are updated

There's a couple of problems with that statement

As I said it's all about assumptions readers make. But no docs whatsoever can stop them from doing.

juanhaywood commented 3 years ago

I fully understand that RPi is the recommended platform, and that other Linux version are a best-effort only scenario. I'm simply trying to contribute my small part by testing the instructions and providing feedback in the wake of the OH3 update. You'll notice from the issues I've logged that I am testing different scenarios (i.e. interactive/unattended, Ubuntu/Debian, etc). I'm simply trying to help others that will try do the same thing after me.

In the scenario I'm testing this issue in, the image is thus not an option.

The instructions I am following are the ones here: https://www.openhab.org/docs/installation/openhabian.html

"As the image is for RPi only, x86 the "unattended" install does the same. You chose manual install which is not recommended for beginners. " - Well, then this is an issue with the instructions, as the part that says "As a beginner, use the interactive openhabian-config tool !" is listed under the "Other Linux Systems (add openHABian just like any other software)" section of the instructions. See image below.

As I said, I'm simply testing various scenarios based on those instructions, following them as a beginner would (with Debian being recommended over Ubuntu). I already have my OH3 Prod environment up and running on Ubuntu (yes, despite the recommendation not to, but it works for me). This effort is simply to try and contribute a small part to the project. But it feels like maybe I'm being more of a bother to the project than a help.

image

juanhaywood commented 3 years ago

Back on track:

Run which java, realpath $(which java) and realpath /usr/bin/java please in shell.

which java = /usr/bin/java realpath $(which java) = /opt/jdk/zulu11.43.55-ca-jre11.0.9.1-linux_i686/bin/java realpath /usr/bin/java = /opt/jdk/zulu11.43.55-ca-jre11.0.9.1-linux_i686/bin/java

juanhaywood commented 3 years ago

Could you please validate if my fix helps? You would need to manually uninstall your java and oh, then reinstall through menu 03. apt purge

I missed this part. Do I need to change the branch, or are your fixes in the openHAB3 branch already?

mstormi commented 3 years ago

I missed this part. Do I need to change the branch, or are your fixes in the openHAB3 branch already? it is in both branches so update.

Then again I don't think it'll make a difference. On your system the command setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' /usr/bin/java failed because of

Failed to set capabilities on file `/usr/bin/java' (No such file or directory)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

so I suspected the path to java must be different but as your latest output shows this is right where java lives. I have no idea why this failed. Did you run the option 13 before or after you installed java (or actually chose menu 11 which installs java, too) ? Could it be that it was not installed by that time the command was excuted ?

Either way please try with purging and the fix.

mstormi commented 3 years ago

| As I said, I'm simply testing various scenarios based on those instructions, following them as a beginner would (with Debian being recommended over Ubuntu). I already have my OH3 Prod environment up and running on Ubuntu (yes, despite the |recommendation not to, but it works for me). This effort is simply to try and contribute a small part to the project. But it feels like maybe I'm being more of a bother to the project than a help.

Thanks, and I'm grateful for any help. However, you (or we in fact) must pay extra attention on the testing procedure and specifically the starting point. It makes for a major difference what's the OS and what's already installed on the system. And you must be systematic in what you test, i.e. don't use menus unless told to just because you think they do whatever you think they will do. The main problem is this: This is only relevant if you don't use the image as in that case the image defines the system configuration we're starting from. And this is were the unsupported (or untested in the first place) big unknown starts. We don't have the HW or OS available for testing.

juanhaywood commented 3 years ago

However, you (or we in fact) must pay extra attention on the testing procedure and specifically the starting point. It makes for a major difference what's the OS and what's already installed on the system. This is only relevant if you don't use the image as in that case the image defines the system configuration we're starting from.

I 100% get that. It is also why I prefer to revert to my checkpoint where I only have a clean install of Debian and nothing else, everytime I retest. It allows me to test with consistent results, making sure nothing else interferes with the behavior.

I'm reverting now to my clean Debian checkpoint image, and will try your fix.

So after running sudo openhabian-config for the first time, I will run as follows:

  1. Menu 11
  2. Menu 03
  3. Menu 13

Is this correct? Or should I do 46 explicitly as well at some point?

Or do you prefer I rather do the uninstall of java and OH, and then purge, instead of reverting to fresh Debian?

juanhaywood commented 3 years ago

Ok, I went ahead and tested as mentioned above:

  1. New, clean installation of only Debian
  2. sudo bash
  3. apt-get update
  4. apt-get install git
  5. git clone -b openHAB3 https://github.com/openhab/openhabian.git /opt/openhabian
  6. ln -s /opt/openhabian/openhabian-setup.sh /usr/local/bin/openhabian-config
  7. cp /opt/openhabian/openhabian.conf.dist /etc/openhabian.conf
  8. sudo openhabian-config
  9. Menu 11
  10. Menu 03
  11. Menu 13

All seems to have completed without an issue, so it looks like your fix did work. Is there anything you would like me to check or verify?

The only issue I still have with openHABian on an i386 Debian setup is with FronTail, as per #1381.

mstormi commented 3 years ago

All seems to have completed without an issue, so it looks like your fix did work. Is there anything you would like me to check or verify?

I have reworked the docs on non-image installs. You misunderstood but that was because it was pretty unfortunate wording. It's not on the live docs site yet but here: https://github.com/openhab/openhabian/blob/master/docs/openhabian.md Please cross-check and use in further testing. Let me know if this is misunderstandable and if needed open new issues please for issues with the docs. Thanks