Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Add openHAB to software catalogue #6334

Merged
merged 1 commit into from
Apr 27, 2023
Merged

DietPi-Software | Add openHAB to software catalogue #6334

merged 1 commit into from
Apr 27, 2023

Conversation

MichaIng
Copy link
Owner

  • openHAB | This long requested vendor and technology agnostic FLOSS home automation software has been finally added to DietPi. Many thanks to @just-jason and many others for requesting it and @MDAR for providing install instructions and valuable information: DietPi-Software | openHAB #3857

@MichaIng
Copy link
Owner Author

Install tests: https://github.com/MichaIng/DietPi/actions/runs/4779187555

  • Smooth, fast, no package dependencies, installs on all archs and distros besides RISC-V. However, it is a Java application so might actually run on RISC-V as well.
  • But requires JRE. I see there are Java 17 CI jobs as well, at least worth to test it it Java 17 and as well with Java 8 (otherwise there was no ARMv6 support).
    [openHAB] WARNING: We were unable to detect Java 11 on your system. This is needed before openHAB can be started.
    [openHAB] Please install the current version of Java 11 or check the openHAB documentation for details.
    

@MichaIng
Copy link
Owner Author

MichaIng commented Apr 23, 2023

Works with Java 17 but not with Java 8 => no support for ARMv6 RPi models:

Unable to resolve org.openhab.core/3.4.3: missing requirement [org.openhab.core/3.4.3] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

Logging can be easily moved to STDOUT to have everything available at journalctl -u openhab. The logging directory itself is however shipped with the package and it makes sense to leave it, so we can document how revert to using plain text log files and it will work without needing to manually create and chown the logging dir first.

What I'm unsure whether to keep or to remove is /etc/profile.d/openhab.sh, which exports all openHAB environment variables to all users' login shells. So every user can manually call /usr/share/openhab/runtime/bin/karaf and it will start like the systemd unit does. However, since this implies the run user, in fact only root can all it anyway, and it also contradicts common practice with systemd services where either a user has permissions to manage system services or not. Finally every user can anyway start own openHAB instances, but then with own config files etc, and not the system config and environment. So to me this script does not make any sense and just bloats the users' shell environment, and the environment of every subshell/process they call (as everything is exported).
EDIT: Okay it is needed for some openhab-cli commands. Strange, as it reads most info internally but for whatever reason not just all info (should be no problem), respectively some info with some commands not not with others.

@MichaIng
Copy link
Owner Author

Ah nice, actually there is a binary-all path which contains exactly the same packages. Not sure why this is not just the only one provided and why on RISC-V systems it is not even pulled as fallback when no binary-riscv64 is available.

... testing ...

... it just works 🈯 https://github.com/MichaIng/DietPi/actions/runs/4779187555/jobs/8496793542

- openHAB | This long requested vendor and technology agnostic FLOSS home automation software has been finally added to DietPi. Many thanks to @just-jason and many others for requesting it and @MDAR for providing install instructions and valuable information: #3857
@MDAR
Copy link

MDAR commented Apr 23, 2023

When I get back to my office in Wednesday, I'll build a fresh Odroid C4 and test this.

What is an approving review and how do I do it?

(Or is this it?)

@Joulinar
Copy link
Collaborator

its fine if you post your findings. Nothing to approve within GitHub.

@MichaIng
Copy link
Owner Author

MichaIng commented Apr 23, 2023

"Formal" reviews can only be done by repository "collaborators". But while we can test the installation and whether we can access the web UI, CLI etc, it is quite valuable when someone tests it who uses openHAB already, to see whether everything is working the same way (or better) as when following other install instructions + whether the used integrations/addons work fine 🙂.

Also regarding some questions/decisions that came up: E.g. is there a downside when disabling logging to files in /var/log/openhab? IMO it is great to have everything in journalctl -u openhab instead, but probably there are features/addons which expect/require plain text log files? openhab-cli viewlogs e.g. shows nothing now, which is however fine as the other command shows everything + systemd service logs.

@StephanStS
Copy link
Collaborator

Tested on port 8089 and with branch "openhab" in dietpi.txt:
[x] Installation via dietpi-software: OK
[x] Login via openhab-test:8089: OK
[x] First setup process: OK
[x] Installation of bindings: OK (Astro, deCONZ, Homematic)
[x] Binding inbox finding things: OK
[x] Connect to deCONZ device: OK (binding goes online, new things were scanned and found)
[x] Added things, added items: OK

@MichaIng
Copy link
Owner Author

MichaIng commented Apr 23, 2023

Did a test install on VisionFive 2 (RISC-V SBC):

  • It indeed installs and the service starts up + web UI is reachable
  • But it takes very long and it throws a bunch of errors as some of the modules contain binary libraries for every arch/OScombination, except RISC-V. E.g.:
Apr 23 23:39:42 DietPi karaf[14059]:   Unresolved requirement: Require-Capability: osgi.native; native.paths.8:List<String>="com/sun/jna/sunos-sparc/libjnidispatch.so"; native.paths.17:List<String>="com/sun/jna/linux-arm/libjnidispatch.so"; native.paths.7:List<String>="com/sun/jna/sunos-x86-64/libjnidispatch.so"; native.paths.16:List<String>="com/sun/jna/linux-x86-64/libjnidispatch.so"; native.paths.19:List<String>="com/sun/jna/linux-armel/libjnidispatch.so"; native.paths.9:List<String>="com/sun/jna/sunos-sparcv9/libjnidispatch.so"; native.paths.18:List<String>="com/sun/jna/linux-arm/libjnidispatch.so"; native.paths.13:List<String>="com/sun/jna/linux-ppc64/libjnidispatch.so"; native.paths.12:List<String>="com/sun/jna/linux-ppc/libjnidispatch.so"; native.paths.15:List<String>="com/sun/jna/linux-x86/libjnidispatch.so"; native.paths.14:List<String>="com/sun/jna/linux-ppc64le/libjnidispatch.so"; native.paths.31:List<String>="com/sun/jna/darwin-x86/libjnidispatch.jnilib"; native.paths.30:List<String>="com/sun/jna/darwin-ppc64/libjnidispatch.jnilib"; native.paths.11:List<String>="com/sun/jna/aix-ppc64/libjnidispatch.a"; native.paths.33:List<String>="com/sun/jna/darwin-aarch64/libjnidispatch.jnilib"; native.paths.10:List<String>="com/sun/jna/aix-ppc/libjnidispatch.a"; native.paths.32:List<String>="com/sun/jna/darwin-x86-64/libjnidispatch.jnilib"; native.paths.28:List<String>="com/sun/jna/openbsd-x86-64/libjnidispatch.so"; native.paths.27:List<String>="com/sun/jna/openbsd-x86/libjnidispatch.so"; native.paths.29:List<String>="com/sun/jna/darwin-ppc/libjnidispatch.jnilib"; native.paths.24:List<String>="com/sun/jna/linux-s390x/libjnidispatch.so"; native.paths.23:List<String>="com/sun/jna/linux-mips64el/libjnidispatch.so"; native.paths.26:List<String>="com/sun/jna/freebsd-x86-64/libjnidispatch.so"; native.paths.25:List<String>="com/sun/jna/freebsd-x86/libjnidispatch.so"; native.paths.20:List<String>="com/sun/jna/linux-aarch64/libjnidispatch.so"; native.paths.22:List<String>="com/sun/jna/linux-sparcv9/libjnidispatch.so"; native.paths.21:List<String>="com/sun/jna/linux-ia64/libjnidispatch.so"; native.paths.0:List<String>="com/sun/jna/win32-x86/jnidispatch.dll"; native.paths.2:List<String>="com/sun/jna/win32-x86/jnidispatch.dll"; native.paths.1:List<String>="com/sun/jna/win32-x86-64/jnidispatch.dll"; native.paths.4:List<String>="com/sun/jna/win32-aarch64/jnidispatch.dll"; native.paths.3:List<String>="com/sun/jna/win32-x86-64/jnidispatch.dll"; native.paths.6:List<String>="com/sun/jna/sunos-x86/libjnidispatch.so"; native.paths.5:List<String>="com/sun/jna/w32ce-arm/jnidispatch.dll"; filter:="(|(&(osgi.native.osname~=win32)(osgi.native.processor~=x86))(&(osgi.native.osname~=win32)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=win)(osgi.native.processor~=x86))(&(osgi.native.osname~=win)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=win)(osgi.native.processor~=aarch64))(&(osgi.native.osname~=wince)(osgi.native.processor~=arm))(&(osgi.native.osname~=sunos)(osgi.native.processor~=x86))(&(osgi.native.osname~=sunos)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=sunos)(osgi.native.processor~=sparc))(&(osgi.native.osname~=sunos)(osgi.native.processor~=sparcv9))(&(osgi.native.osname~=aix)(osgi.native.processor~=ppc))(&(osgi.native.osname~=aix)(osgi.native.processor~=ppc64))(&(osgi.native.osname~=linux)(osgi.native.processor~=ppc))(&(osgi.native.osname~=linux)(osgi.native.processor~=ppc64))(&(osgi.native.osname~=linux)(osgi.native.processor~=ppc64le))(&(osgi.native.osname~=linux)(osgi.native.processor~=x86))(&(osgi.native.osname~=linux)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=linux)(osgi.native.processor~=arm))(&(osgi.native.osname~=linux)(osgi.native.processor~=arm_le))(&(osgi.native.osname~=linux)(osgi.native.processor~=armel))(&(osgi.native.osname~=linux)(osgi.native.processor~=aarch64))(&(osgi.native.osname~=linux)(osgi.native.processor~=ia64))(&(osgi.native.osname~=linux)(osgi.native.processor~=sparcv9))(&(osgi.native.osname~=linux)(osgi.native.processor~=mips64el))(&(osgi.native.osname~=linux)(osgi.native.processor~=S390x))(&(osgi.native.osname~=freebsd)(osgi.native.processor~=x86))(&(osgi.native.osname~=freebsd)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=openbsd)(osgi.native.processor~=x86))(&(osgi.native.osname~=openbsd)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=macosx)(osgi.native.processor~=ppc))(&(osgi.native.osname~=macosx)(osgi.native.processor~=ppc64))(&(osgi.native.osname~=macosx)(osgi.native.processor~=x86))(&(osgi.native.osname~=macosx)(osgi.native.processor~=x86-64))(&(osgi.native.osname~=macosx)(osgi.native.processor~=aarch64)))"
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.17.200.jar:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.17.200.jar:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:464) ~[org.eclipse.osgi-3.17.200.jar:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.startBundle(BundleInstallSupportImpl.java:165) ~[?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1160) ~[?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1041) ~[?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069) ~[?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004) ~[?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
Apr 23 23:39:42 DietPi karaf[14059]:                 at java.lang.Thread.run(Thread.java:833) [?:?]

See the first line, which contains many com/sun/jna/<os>-<arch>/libjnidispatch.so paths, but com/sun/jna/linux-riscv64/libjnidispatch.so is missing. The same is true for a bunch of other such libraries.

However, despite that, the UI is up and I could create and setup an account. So I'll leave it inside now and will ask on the openHAB forum for RISC-V support. The whole architecture is for testing, so not a problem when some software titles are somewhat in a non-stable state, as long as they do generally install and start.

@MichaIng MichaIng merged commit d13755b into dev Apr 27, 2023
@MichaIng MichaIng deleted the openhab branch April 27, 2023 20:40
@MDAR
Copy link

MDAR commented Apr 29, 2023

I'm probably being very thick..
.

Do I need to use a bleeding edge branch to see openHAB in the software menu?


Should I change to the Beta branch?

https://github.com/MichaIng/DietPi/blob/master/BRANCH_SYSTEM.md

@hmerk
Copy link

hmerk commented Apr 29, 2023

Works with Java 17 but not with Java 8 => no support for ARMv6 RPi models:

Worth to note, openHAB 3.x.x requires Java 11 and openHAB 4.0 requires Java 17.
Versions 3 might work with Java 17, but there is no guarantee, so not recomended to use other than stated above!

@MichaIng
Copy link
Owner Author

Do I need to use a bleeding edge branch to see openHAB in the software menu?

Yes, quick switch:

G_DEV_BRANCH dev

You can also wait for the beta in a few hours, then

G_DEV_BRANCH beta

With a dietpi-backup you are on the safe side.

Worth to note, openHAB 3.x.x requires Java 11 and openHAB 4.0 requires Java 17.

Oh very good to know, as v4 is in the pipeline. Hmm, then we need to find out how to limit the package version, since it has no package-wise dependency on Java. Probably easier to simply disable it on Buster all together. Users should anyway upgrade to Bullseye.

Versions 3 might work with Java 17, but there is no guarantee, so not recomended to use other than stated above!

It does, at least as far as I tested. Probably not every addon, we'll see. But we cannot implement an extra Java installation just for a single software title. If there are really some edge case issues, they will be solved with openHAB 4 soon.

@hmerk
Copy link

hmerk commented Apr 29, 2023

It does, at least as far as I tested. Probably not every addon, we'll see. But we cannot implement an extra Java installation just for a single software title. If there are really some edge case issues, they will be solved with openHAB 4 soon.

One of the main issues will be removal of Nashorn in Java 17, which will cause trouble with automation rules.
In openHAB 4, we have packages for Nashon and GraalVM.

If I am not mistaken, openHAB 4 package now has a check for Java version.

@MichaIng
Copy link
Owner Author

There is a standalone OpenJDK Nashorn project which does support recent Java versions: https://github.com/openjdk/nashorn

But I guess openHAB would need to explicitly support it. Ah, I guess this is what you mean with "In openHAB 4, we have packages for Nashon" 😄.

We could use the openHAB testing branch on Bullseye and up for now, offering users to migrate back to stable once openHAB 4 has been released. Alternatively, on Bullseye, the Java 11 packages are still available, so we could install it there. But I'm generally more for going forward in these regards, especially for newly implemented software titles.

@hmerk
Copy link

hmerk commented Apr 29, 2023

Ah, I guess this is what you mean with "In openHAB 4, we have packages for Nashon"

Yes, you can install the Nashorn package if needed, but there are more changes for full java 17 support, also a karaf update was required.

Indeed, going for the testing branch, which will include the already very stable milestone builds would be a way to go. We plan to release openHAB 4 end of June, so a switch to stable branch could be done then.

@MichaIng
Copy link
Owner Author

Indeed, going for the testing branch, which will include the already very stable milestone builds would be a way to go. We plan to release openHAB 4 end of June, so a switch to stable branch could be done then.

Okay, sounds good. I'll implement the change later.
Note to self: Also add a step to the Buster => Bullseye upgrade guide to switch from stable to testing for now.

@hmerk

If I am not mistaken, openHAB 4 package now has a check for Java version.

But I guess not as hard package dependency, i.e. it does not prevent the package upgrade on e.g. Debian Buster with OpenJDK 11 installed, does it? Would be also troublesome for users which use Adoptium JRE builds or compile it themselves. I'll have a look, should be possible to solve this via APT pinning.

@hmerk
Copy link

hmerk commented Apr 29, 2023

But I guess not as hard package dependency, i.e. it does not prevent the package upgrade on e.g. Debian Buster with OpenJDK 11 installed, does it?

@BClark09 can you comment on this. I remember you did change the Java check last month.

@BClark09
Copy link

BClark09 commented Apr 29, 2023

Thanks @hmerk!

But I guess not as hard package dependency, i.e. it does not prevent the package upgrade on e.g. Debian Buster with OpenJDK 11 installed, does it? Would be also troublesome for users which use Adoptium JRE builds or compile it themselves. I'll have a look, should be possible to solve this via APT pinning.

The apt package only 'suggests', rather than 'recommends' or 'requires' for the reasons you mentioned.

openHAB 4.x: https://github.com/openhab/openhab-linuxpkg/blob/master/build.gradle#L207
openHAB 3.x: https://github.com/openhab/openhab-linuxpkg/blob/3.x/build.gradle#L207

There is a check post-install which warns the user if no compatible version of Java is found.

MichaIng added a commit that referenced this pull request Apr 29, 2023
- DietPi-Software | openHAB: Use testing suite == openHAB 4 from Bullseye on since openHAB 3 does not fully support Java 17: #6334 (comment)
@MichaIng
Copy link
Owner Author

Testing suite implemented: 70c46ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DietPi-Software | openHAB
6 participants