service wrapper broken #63

Closed
dakky opened this Issue Jan 12, 2016 · 13 comments

Comments

Projects
None yet
3 participants
@dakky

dakky commented Jan 12, 2016

I installed openhab2 as a service. When starting via systemd, this fails:

Jan 12 20:14:37 autohome systemd[1]: Configuration file /home/openhab/openhab2/distri/runtime/karaf/bin/openHAB.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 12 20:14:37 autohome systemd[1]: Reloading.
Jan 12 20:14:37 autohome systemd[1]: Configuration file /home/openhab/openhab2/distri/runtime/karaf/bin/openHAB.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 12 20:15:01 autohome systemd[1]: Starting openHAB runtime...
-- Subject: Unit openHAB.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit openHAB.service has begun starting up.
Jan 12 20:15:01 autohome openHAB-service[10381]: Starting openHAB runtime...
Jan 12 20:15:01 autohome openHAB-service[10381]: /home/openhab/openhab2/distri/runtime/karaf/bin/openHAB-wrapper: 1: /home/openhab/openhab2/distri/runtime/karaf/bin/openHAB-wrapper: Syntax error: "(" unexpected
Jan 12 20:15:01 autohome systemd[1]: openHAB.service: control process exited, code=exited status=2
Jan 12 20:15:01 autohome systemd[1]: Failed to start openHAB runtime.
-- Subject: Unit openHAB.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit openHAB.service has failed.
-- 
-- The result is failed.
Jan 12 20:15:01 autohome systemd[1]: Unit openHAB.service entered failed state.

/home/openhab/openhab2/distri/runtime/karaf/bin/openHAB-wrapper is binary, so I can't provide more details/debugging info.

Version: 2.0.0.b1

@dvanherbergen

This comment has been minimized.

Show comment
Hide comment
@dvanherbergen

dvanherbergen Jan 12, 2016

Contributor

Which OS are you using? Are you running on an ARMv6/v7 machine?

Contributor

dvanherbergen commented Jan 12, 2016

Which OS are you using? Are you running on an ARMv6/v7 machine?

@dakky

This comment has been minimized.

Show comment
Hide comment
@dakky

dakky Jan 12, 2016

Running on raspberry pi2 with raspbian jessie

dakky commented Jan 12, 2016

Running on raspberry pi2 with raspbian jessie

@dvanherbergen

This comment has been minimized.

Show comment
Hide comment
@dvanherbergen

dvanherbergen Jan 12, 2016

Contributor

Can you execute the command arch and post the result?

Contributor

dvanherbergen commented Jan 12, 2016

Can you execute the command arch and post the result?

@dakky

This comment has been minimized.

Show comment
Hide comment

dakky commented Jan 12, 2016

armv7l

@dvanherbergen

This comment has been minimized.

Show comment
Hide comment
@dvanherbergen

dvanherbergen Jan 12, 2016

Contributor

Strange. We know there is an issue with the service on armv6, but on v7 it should work.
I don't have a pi2 myself, so I can't really test. The openHAB service is using the karaf service installation underneath. Could you try downloading karaf and installing that as a service by executing the command 'wrapper:install' in the shell?

@kaikreuzer did you test starting the service on your pi2?

Contributor

dvanherbergen commented Jan 12, 2016

Strange. We know there is an issue with the service on armv6, but on v7 it should work.
I don't have a pi2 myself, so I can't really test. The openHAB service is using the karaf service installation underneath. Could you try downloading karaf and installing that as a service by executing the command 'wrapper:install' in the shell?

@kaikreuzer did you test starting the service on your pi2?

@kaikreuzer

This comment has been minimized.

Show comment
Hide comment
@kaikreuzer

kaikreuzer Jan 12, 2016

Member

@kaikreuzer did you test starting the service on your pi2?

No, not yet.

Member

kaikreuzer commented Jan 12, 2016

@kaikreuzer did you test starting the service on your pi2?

No, not yet.

@dakky

This comment has been minimized.

Show comment
Hide comment
@dakky

dakky Jan 12, 2016

same problem when creating a service:

pi@autohome /tmp/apache-karaf-4.0.3/bin $ ./shell 
shell: JAVA_HOME not set; results may vary
        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,<  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

  Apache Karaf (4.0.3)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> wrapper:install
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-service
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-service
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf.service
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf.service
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
Creating file: /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating missing directory: /tmp/apache-karaf-4.0.3/lib/wrapper
Creating missing directory: /tmp/apache-karaf-4.0.3/lib/wrapper
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/libwrapper.so
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/libwrapper.so
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper.jar
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper.jar
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper-main.jar
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper-main.jar

Setup complete.  You may wish to tweak the JVM properties in the wrapper configuration file:
    /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
before installing and starting the service.


Ubuntu/Debian Linux system detected (SystemV):
  To install the service:
    $ ln -s /tmp/apache-karaf-4.0.3/bin/karaf-service /etc/init.d/

  To start the service when the machine is rebooted:
    $ update-rc.d karaf-service defaults

  To disable starting the service when the machine is rebooted:
    $ update-rc.d -f karaf-service remove

  To start the service:
    $ /etc/init.d/karaf-service start

  To stop the service:
    $ /etc/init.d/karaf-service stop

  To uninstall the service :
    $ rm /etc/init.d/karaf-service

For systemd compliant Linux: 
  To install the service (and enable at system boot):
   $ systemctl enable /tmp/apache-karaf-4.0.3/bin/karaf.service

  To start the service:
   $ systemctl start karaf

  To stop the service:
   $ systemctl stop karaf

  To check the current service status:
   $ systemctl status karaf

  To see service activity journal:
   $ journalctl -u karaf

  To uninstall the service (and disable at system boot):
   $ systemctl disable karaf
karaf@root()> ^Dkaraf@root()> 
pi@autohome /tmp/apache-karaf-4.0.3/bin $ less /tmp/apache-karaf-4.0.3/bin/karaf.service
pi@autohome /tmp/apache-karaf-4.0.3/bin $ /tmp/apache-karaf-4.0.3/bin/karaf-service start
Starting karaf...
/tmp/apache-karaf-4.0.3/bin/karaf-wrapper: 1: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper: Syntax error: "(" unexpected
pi@autohome /tmp/apache-karaf-4.0.3/bin $ 

dakky commented Jan 12, 2016

same problem when creating a service:

pi@autohome /tmp/apache-karaf-4.0.3/bin $ ./shell 
shell: JAVA_HOME not set; results may vary
        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,<  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

  Apache Karaf (4.0.3)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> wrapper:install
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-service
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf-service
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/bin/karaf.service
Creating file: /tmp/apache-karaf-4.0.3/bin/karaf.service
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
Creating file: /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating missing directory: /tmp/apache-karaf-4.0.3/lib/wrapper
Creating missing directory: /tmp/apache-karaf-4.0.3/lib/wrapper
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/libwrapper.so
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/libwrapper.so
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper.jar
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper.jar
[org.apache.karaf.wrapper.internal.WrapperServiceImpl] : Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper-main.jar
Creating file: /tmp/apache-karaf-4.0.3/lib/wrapper/karaf-wrapper-main.jar

Setup complete.  You may wish to tweak the JVM properties in the wrapper configuration file:
    /tmp/apache-karaf-4.0.3/etc/karaf-wrapper.conf
before installing and starting the service.


Ubuntu/Debian Linux system detected (SystemV):
  To install the service:
    $ ln -s /tmp/apache-karaf-4.0.3/bin/karaf-service /etc/init.d/

  To start the service when the machine is rebooted:
    $ update-rc.d karaf-service defaults

  To disable starting the service when the machine is rebooted:
    $ update-rc.d -f karaf-service remove

  To start the service:
    $ /etc/init.d/karaf-service start

  To stop the service:
    $ /etc/init.d/karaf-service stop

  To uninstall the service :
    $ rm /etc/init.d/karaf-service

For systemd compliant Linux: 
  To install the service (and enable at system boot):
   $ systemctl enable /tmp/apache-karaf-4.0.3/bin/karaf.service

  To start the service:
   $ systemctl start karaf

  To stop the service:
   $ systemctl stop karaf

  To check the current service status:
   $ systemctl status karaf

  To see service activity journal:
   $ journalctl -u karaf

  To uninstall the service (and disable at system boot):
   $ systemctl disable karaf
karaf@root()> ^Dkaraf@root()> 
pi@autohome /tmp/apache-karaf-4.0.3/bin $ less /tmp/apache-karaf-4.0.3/bin/karaf.service
pi@autohome /tmp/apache-karaf-4.0.3/bin $ /tmp/apache-karaf-4.0.3/bin/karaf-service start
Starting karaf...
/tmp/apache-karaf-4.0.3/bin/karaf-wrapper: 1: /tmp/apache-karaf-4.0.3/bin/karaf-wrapper: Syntax error: "(" unexpected
pi@autohome /tmp/apache-karaf-4.0.3/bin $ 
@dvanherbergen

This comment has been minimized.

Show comment
Hide comment
@dvanherbergen

dvanherbergen Jan 12, 2016

Contributor

That's bad news. That means that the Java Service Wrapper which is included in Karaf doesn't work. And because of a license change, it won't be upgraded anymore.
So we'll have to rework the whole service installation part 😞
This will take some time...

Contributor

dvanherbergen commented Jan 12, 2016

That's bad news. That means that the Java Service Wrapper which is included in Karaf doesn't work. And because of a license change, it won't be upgraded anymore.
So we'll have to rework the whole service installation part 😞
This will take some time...

@dakky

This comment has been minimized.

Show comment
Hide comment
@dakky

dakky Jan 12, 2016

an alternative might be, to work around problem and do not use the karaf native service. in openhab 1.x (pre "there are some deb packages,too"-phase) I had a hacky solution.
starting openhab:

sudo -u ${OHUSER} tmux new-session -s openHAB -d  "sh ./start.sh"

stopping openhab:

sudo -u ${OHUSER} tmux send-keys -t openHAB "exit" Enter "y" Enter "exit" Enter

not very beautyful, but it worked. Creds for this solution to "I don't know where i digged this up"

dakky commented Jan 12, 2016

an alternative might be, to work around problem and do not use the karaf native service. in openhab 1.x (pre "there are some deb packages,too"-phase) I had a hacky solution.
starting openhab:

sudo -u ${OHUSER} tmux new-session -s openHAB -d  "sh ./start.sh"

stopping openhab:

sudo -u ${OHUSER} tmux send-keys -t openHAB "exit" Enter "y" Enter "exit" Enter

not very beautyful, but it worked. Creds for this solution to "I don't know where i digged this up"

@kaikreuzer

This comment has been minimized.

Show comment
Hide comment
@kaikreuzer

kaikreuzer Jan 12, 2016

Member

Hm, this is really unfortunate, I was so happy that Karaf offered this service and no it is irrepairably broken :-(

So maybe we need to implement our own logic to generated the required files (at least on the platform, where the Karaf solution does not work). Maybe this would be a start for it: https://community.openhab.org/t/start-script-for-oh2/5883/7?u=kai

Member

kaikreuzer commented Jan 12, 2016

Hm, this is really unfortunate, I was so happy that Karaf offered this service and no it is irrepairably broken :-(

So maybe we need to implement our own logic to generated the required files (at least on the platform, where the Karaf solution does not work). Maybe this would be a start for it: https://community.openhab.org/t/start-script-for-oh2/5883/7?u=kai

@dakky

This comment has been minimized.

Show comment
Hide comment
@dakky

This comment has been minimized.

Show comment
Hide comment
@dakky

dakky Jan 14, 2016

have a look here: https://community.openhab.org/t/start-script-for-oh2/5883/15

starting the start.sh via systemd works fine. so there is no need for the karaf service wrapper on any systemd enabled distributions.

dakky commented Jan 14, 2016

have a look here: https://community.openhab.org/t/start-script-for-oh2/5883/15

starting the start.sh via systemd works fine. so there is no need for the karaf service wrapper on any systemd enabled distributions.

@kaikreuzer

This comment has been minimized.

Show comment
Hide comment
@kaikreuzer

kaikreuzer Jan 26, 2016

Member

Since the service wrapper does not work for RaspPi, this has been solved through documentation now: https://github.com/openhab/openhab-distro/pull/74/files

Member

kaikreuzer commented Jan 26, 2016

Since the service wrapper does not work for RaspPi, this has been solved through documentation now: https://github.com/openhab/openhab-distro/pull/74/files

@kaikreuzer kaikreuzer closed this Jan 26, 2016

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