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

install-service does not work on Mac OS X 10.11 (El Capitan) #238

Open
rrgeorge opened this issue Jun 26, 2016 · 11 comments
Open

install-service does not work on Mac OS X 10.11 (El Capitan) #238

rrgeorge opened this issue Jun 26, 2016 · 11 comments

Comments

@rrgeorge
Copy link

rrgeorge commented Jun 26, 2016

Running install-service on Mac OS X 10.11 does not function properly, because the variable JAVA_HOME is set to null in the generated runtime/karaf/etc/openHAB-wrapper.conf. JAVA_HOME should be derived from running the command /usr/libexec/java_home when generating the openHAB-wrapper.conf file from install-service

@kgoderis
Copy link
Contributor

kgoderis commented Jul 1, 2016

I get the following output when issuing the command below

openhab> openhab:install-service 

Starting openHAB system service installation...

Creating file: /Library/openHAB2/openhab2-karaf/runtime/karaf/bin/openHAB-wrapper
Creating file: /Library/openHAB2/openhab2-karaf/runtime/karaf/bin/openHAB-service

And nothing more. Is something else expected to happen?

@kaikreuzer
Copy link
Member

@kgoderis: Just tried it and I have

openhab> openhab:install-service 

Starting openHAB system service installation...

Creating file: /Applications/openhab/runtime/karaf/bin/openHAB-wrapper
Creating file: /Applications/openhab/runtime/karaf/bin/openHAB-service
Creating file: /Applications/openhab/runtime/karaf/etc/openHAB-wrapper.conf
Creating file: /Applications/openhab/runtime/karaf/bin/org.apache.karaf.openHAB.plist
Creating missing directory: /Applications/openhab/runtime/karaf/lib/wrapper
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/libwrapper.jnilib
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/karaf-wrapper.jar
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/karaf-wrapper-main.jar

Mac OS X system detected:

To configure openHAB as a user service execute the following file move:
> mv /Applications/openhab/runtime/karaf/bin/openHAB.plist ~/Library/LaunchAgents/

To configure openHAB as a system service execute the following file move and authorisation changes:
> sudo mv /Applications/openhab/runtime/karaf/bin/openHAB.plist /Library/LaunchDaemons/
> sudo chown root:wheel /Library/LaunchDaemons/openHAB.plist
> sudo chmod u=rw,g=r,o=r /Library/LaunchDaemons/openHAB.plist

To test your service: 
> launchctl load ~/Library/LaunchAgents/openHAB.plist
> launchctl start openHAB
> launchctl stop openHAB

After restart of your session or system you can use the launchctl command to start and stop your service

For removing the service call:
> launchctl remove openHAB

openhab> 

@dvanherbergen As you did the integration, any chance that you could have a look at fixing @rrgeorge's problem?

@kgoderis
Copy link
Contributor

kgoderis commented Jul 1, 2016

The problem is due to the non responsive karaf console.

Sent from my iPhone

On 01 Jul 2016, at 17:16, Kai Kreuzer [email protected] wrote:

@kgoderis: Just tried it and I have

openhab> openhab:install-service

Starting openHAB system service installation...

Creating file: /Applications/openhab/runtime/karaf/bin/openHAB-wrapper
Creating file: /Applications/openhab/runtime/karaf/bin/openHAB-service
Creating file: /Applications/openhab/runtime/karaf/etc/openHAB-wrapper.conf
Creating file: /Applications/openhab/runtime/karaf/bin/org.apache.karaf.openHAB.plist
Creating missing directory: /Applications/openhab/runtime/karaf/lib/wrapper
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/libwrapper.jnilib
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/karaf-wrapper.jar
Creating file: /Applications/openhab/runtime/karaf/lib/wrapper/karaf-wrapper-main.jar

Mac OS X system detected:

To configure openHAB as a user service execute the following file move:

mv /Applications/openhab/runtime/karaf/bin/openHAB.plist ~/Library/LaunchAgents/

To configure openHAB as a system service execute the following file move and authorisation changes:

sudo mv /Applications/openhab/runtime/karaf/bin/openHAB.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/openHAB.plist
sudo chmod u=rw,g=r,o=r /Library/LaunchDaemons/openHAB.plist

To test your service:

launchctl load ~/Library/LaunchAgents/openHAB.plist
launchctl start openHAB
launchctl stop openHAB

After restart of your session or system you can use the launchctl command to start and stop your service

For removing the service call:

launchctl remove openHAB

openhab>
@dvanherbergen As you did the integration, any chance that you could have a look at fixing @rrgeorge's problem?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@kgoderis
Copy link
Contributor

kgoderis commented Jul 1, 2016

FYI, when killing the fault karaf session (the one hanging), then suddenly the openhab:install-service continues.

@dvanherbergen
Copy link
Contributor

If I remember correctly, the JAVA_HOME was not manipulated during the installation, so it should have been set by the underlying Karaf service installation. I'll have look, maybe we can force it.

@dvanherbergen
Copy link
Contributor

I can't reproduce this issue on OSX 10.11.4.
When I clear JAVA_HOME prior to launching openhab and installing the service, the generated config is still generated with the correct entry:

set.default.JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

This is because the start.sh calls the setenv.sh, which uses /usr/libexec/java_home -v 1.8 to initialize the JAVA_HOME variable if it wasn't set yet. This value is then used during the generation of the wrapper.

@rrgeorge , did you start openHAB with the start.sh script? Can you still reproduce the issue?

@kgoderis
Copy link
Contributor

kgoderis commented Jul 2, 2016

@dvanherbergen I had the same issue as @rrgeorge on El Capitan, but I did not clear the JAVA_HOME beforehand.

@rrgeorge
Copy link
Author

rrgeorge commented Jul 4, 2016

The issue I'm experiencing is likely due to the fact that I'm not running OpenHAB as myself. I have it running as a system user, and install/upgrade it with a script I run, as root, that finishes with a: su _openhab -c ./start.sh then I manually run install-service. But since it doesn't get JAVA_HOME correctly, I then have to manually edit the openHAB-wrapper.conf.

@Trickx
Copy link

Trickx commented Aug 3, 2017

This issue is still open.
I can confirm the issue on a Mac OSx Sierra with openHAB 2.1.
Putting "export JAVA_HOME=$(/usr/libexec/java_home)" into openHAB-wrapper.conf manually solves this issue for me.
JAVA_HOME was not set before.

@pkishino
Copy link

Yeah,same problem here..clear JAVA_HOME, launch karaf, run install-service..mv to /Library/LaunchDaemons etc.. won't run.. tried editing wrapper.conf sitll not working.. manually running with ./start works fine..

@pkishino
Copy link

pkishino commented Mar 9, 2018

finally after much digging I got it working according to here: #401

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

No branches or pull requests

6 participants