Quantcast

Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
Hi,

I tried to install apache karaf 4.0.7 on my VPS (Virtual Private
Server), running debian "jessie" on a virtual amd64 CPU, but karaf
failed to start.

I was wondering if anyone on the list has an idea what caused the
startup problem? And if anyone know about a possible workaround?
(e.g. is it possible to start karaf without the karaf-wrapper?)

The messages I got on startup, were:

rainey:~# systemctl status karaf.service
● karaf.service - LSB: Starts karaf server
   Loaded: loaded (/etc/init.d/karaf)
   Active: failed (Result: exit-code) since Mon 2016-11-14 21:51:42 GMT; 22h ago
  Process: 16796 ExecStart=/etc/init.d/karaf start (code=exited, status=2)

Nov 14 21:51:41 rainey.bang.priv.no su[16838]: Successful su for karaf by root
Nov 14 21:51:41 rainey.bang.priv.no su[16838]: + ??? root:karaf
Nov 14 21:51:41 rainey.bang.priv.no su[16838]: pam_unix(su:session): session opened for user karaf by (uid=0)
Nov 14 21:51:42 rainey.bang.priv.no karaf[16796]: Starting karaf...
Nov 14 21:51:42 rainey.bang.priv.no karaf[16796]: /usr/local/karaf/bin/karaf-wrapper: 1: /usr/local/karaf/bin/karaf-wrapper: Syntax error: "(" unexpected
Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: karaf.service: control process exited, code=exited status=2
Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: Failed to start LSB: Starts karaf server.
Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: Unit karaf.service entered failed state.
rainey:~#


Karaf was installed from a .deb package I created for karaf 4.0.7 using
this build setup
 https://github.com/steinarb/karaf-deb-packaging

I forked the build setup from:
 https://github.com/DemisR/karaf-deb-packaging

What I've done since the fork is:
 - Change the JDK to openjdk-8-jdk (installed from debian backports)
 - Change the data directory to /var/lib/karaf (to be more debian-ish)
 - Go back to the standard maven settings making karaf find maven
   dependencies under ~karaf/.m2/repository

The .deb package was created on an Intel i5 skylake computer, also
running debian "jessie" and worked fine on that machine.

However on the VM karaf installed from the .deb package failed tp start,
and I think it may be related to the CPU...?  When I googled the error
message all hits were failures to run karaf on the raspberry-pi and
problems with the arm version.

However both the i5 and the VM are presumably amd64 CPUs, so I don't
know how relevant this is?

If actually it is a CPU incompatibility with the VMs CPU and an actual
Intel CPU, it is the first one I've seen for the 6+ years I have been
running this VM, so I'm thinking it could be something else...?

Thanks!


- Steinar


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> I tried to install apache karaf 4.0.7 on my VPS (Virtual Private
> Server), running debian "jessie" on a virtual amd64 CPU, but karaf
> failed to start.

> I was wondering if anyone on the list has an idea what caused the
> startup problem? And if anyone know about a possible workaround?
> (e.g. is it possible to start karaf without the karaf-wrapper?)

Ok, now I've googled up on the karaf-wrapper
  http://stackoverflow.com/a/27667824
  https://wrapper.tanukisoftware.com/doc/english/download.jsp

So the question is now: is it possible to do without the karaf-wrapper?

There are some scripts in the apache-karaf-4.0.7/bin/contrib directory
of the tar.gz linux binary distribution:
  -rwxr-xr-x 1 sb sb  1234 Sep 26 07:07 karaf-service-template.conf
  -rwxr-xr-x 1 sb sb  4821 Sep 26 07:07 karaf-service-template.init
  -rwxr-xr-x 1 sb sb  6474 Sep 26 07:07 karaf-service-template.init-debian
  -rwxr-xr-x 1 sb sb  4534 Sep 26 07:07 karaf-service-template.init-redhat
  -rwxr-xr-x 1 sb sb  3398 Sep 26 07:07 karaf-service-template.solaris-smf
  -rwxr-xr-x 1 sb sb  1268 Sep 26 07:07 karaf-service-template.systemd
  -rwxr-xr-x 1 sb sb  1534 Sep 26 07:07 karaf-service-template.systemd-instances
  -rwxr-xr-x 1 sb sb 59392 Sep 26 07:07 karaf-service-win.exe
  -rwxr-xr-x 1 sb sb  1732 Sep 26 07:07 karaf-service-win.xml
  -rwxr-xr-x 1 sb sb  7683 Sep 26 07:07 karaf-service.sh

What is the state of these scripts? Are they actually currently used by
anyone?  Or are they historical scripts that have been kept around?
The only file that contains the text "wrapper" is the
karaf-service-win.exe file.

(There is a debian init.d script that would have looked promising prior
to the arrival of systemd.  Now there are two systemd files that I have
no idea what to do with.  I find systemd very confusing...)

Hm... it looks like the karaf-service.sh script will set karaf up as a
service in the system it detects it is running in...?  Without the use
of karaf-wrapper...?

Looking at the history of the 4.0.7 version of the karaf-service.sh
file, it was last modified on May 16 2016, so my guess is that these
scripts are fairly recent, and that people are using them...?
  https://github.com/apache/karaf/commits/karaf-4.0.x/assemblies/features/base/src/main/resources/resources/bin/contrib/karaf-service.sh

Ah, this is why they exist:
 https://github.com/apache/karaf/commit/4f600555c986d18990f884512e8d1fdaa2ca8c35

(And the karaf-service.sh script first checks for the existence of
systemd and picks that, before it checks for whether the system is
redhat or debian, so that was the answer to what to pick first between
systemd and the debian initd for a debian "jessie" system... "jessie"
has systemd, so systemd is what should be used)

On a side note: Would it be possible to use apache commons procrun
as an alternative to the service wrapper, I wonder?
 http://commons.apache.org/proper/commons-daemon/procrun.html
(ie. as a third option, in addition to "with wrapper" and "without
wrapper")

And would running under procrun have any advantages wrt. "without
wrapper"?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> On a side note: Would it be possible to use apache commons procrun
> as an alternative to the service wrapper, I wonder?
>  http://commons.apache.org/proper/commons-daemon/procrun.html
> (ie. as a third option, in addition to "with wrapper" and "without
> wrapper")

The specific procrun application of interest is the procrun application
called "prunsrv".
 http://commons.apache.org/proper/commons-daemon/procrun.html#Procrun_service_application

> And would running under procrun have any advantages wrt. "without
> wrapper"?



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
In reply to this post by Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> Ok, now I've googled up on the karaf-wrapper
>   http://stackoverflow.com/a/27667824
>   https://wrapper.tanukisoftware.com/doc/english/download.jsp

> So the question is now: is it possible to do without the karaf-wrapper?

> There are some scripts in the apache-karaf-4.0.7/bin/contrib directory
[snip!]

Update: Now my debian package run using the systemd scripts in
bin/contrib and without karaf-wrapper, and now it works without the
previous startup problems on my virtual cloud server.

To build a debian package of karaf 4.0.7 on debian "jessie", do the
following:
 1. Add jessie-backports to /etc/apt/sources.list
     https://backports.debian.org/Instructions/#index2h2
 2. Install openjdk-8-jdk from jessie-backports (as root):
     apt-get update
     apt-get -t jessie-backports install openjdk-8-jdk openjdk-8-jre openjdk-8-jdk-headless
 3. Install pre-requisites (as root):
     apt-get install ruby ruby-dev build-essential
 4. Clone the package building project and build a new .deb package
     mkdir -p $HOME/git
     cd $HOME/git
     git clone https://github.com/steinarb/karaf-deb-packaging.git
     cd karaf-deb-packing
     ./dist_karaf.sh
     mv *.deb /tmp
 5. As root, install the new karaf .deb
     dpkg --install /tmp/karaf_4.0.7-1.deb

After this, karaf is running as user karaf, group karaf, and will be
started on boot.  

The data directory is /var/lib/karaf/data.

The logs go to /var/log/karaf.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

jbonofre
In reply to this post by Steinar Bang
Hi Steinar,

1. It sounds like a mistake i the karaf-wrapper script. I gonna check that.

2. As a workaround, you can use the systemd scripts in the contrib
folder. However, one feature of the karaf-wrapper is the respawn of the
JVM in case of failure or process exit.

Regards
JB

On 11/16/2016 05:30 PM, Steinar Bang wrote:

> Hi,
>
> I tried to install apache karaf 4.0.7 on my VPS (Virtual Private
> Server), running debian "jessie" on a virtual amd64 CPU, but karaf
> failed to start.
>
> I was wondering if anyone on the list has an idea what caused the
> startup problem? And if anyone know about a possible workaround?
> (e.g. is it possible to start karaf without the karaf-wrapper?)
>
> The messages I got on startup, were:
>
> rainey:~# systemctl status karaf.service
> ● karaf.service - LSB: Starts karaf server
>    Loaded: loaded (/etc/init.d/karaf)
>    Active: failed (Result: exit-code) since Mon 2016-11-14 21:51:42 GMT; 22h ago
>   Process: 16796 ExecStart=/etc/init.d/karaf start (code=exited, status=2)
>
> Nov 14 21:51:41 rainey.bang.priv.no su[16838]: Successful su for karaf by root
> Nov 14 21:51:41 rainey.bang.priv.no su[16838]: + ??? root:karaf
> Nov 14 21:51:41 rainey.bang.priv.no su[16838]: pam_unix(su:session): session opened for user karaf by (uid=0)
> Nov 14 21:51:42 rainey.bang.priv.no karaf[16796]: Starting karaf...
> Nov 14 21:51:42 rainey.bang.priv.no karaf[16796]: /usr/local/karaf/bin/karaf-wrapper: 1: /usr/local/karaf/bin/karaf-wrapper: Syntax error: "(" unexpected
> Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: karaf.service: control process exited, code=exited status=2
> Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: Failed to start LSB: Starts karaf server.
> Nov 14 21:51:42 rainey.bang.priv.no systemd[1]: Unit karaf.service entered failed state.
> rainey:~#
>
>
> Karaf was installed from a .deb package I created for karaf 4.0.7 using
> this build setup
>  https://github.com/steinarb/karaf-deb-packaging
>
> I forked the build setup from:
>  https://github.com/DemisR/karaf-deb-packaging
>
> What I've done since the fork is:
>  - Change the JDK to openjdk-8-jdk (installed from debian backports)
>  - Change the data directory to /var/lib/karaf (to be more debian-ish)
>  - Go back to the standard maven settings making karaf find maven
>    dependencies under ~karaf/.m2/repository
>
> The .deb package was created on an Intel i5 skylake computer, also
> running debian "jessie" and worked fine on that machine.
>
> However on the VM karaf installed from the .deb package failed tp start,
> and I think it may be related to the CPU...?  When I googled the error
> message all hits were failures to run karaf on the raspberry-pi and
> problems with the arm version.
>
> However both the i5 and the VM are presumably amd64 CPUs, so I don't
> know how relevant this is?
>
> If actually it is a CPU incompatibility with the VMs CPU and an actual
> Intel CPU, it is the first one I've seen for the 6+ years I have been
> running this VM, so I'm thinking it could be something else...?
>
> Thanks!
>
>
> - Steinar
>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
>>>>> Jean-Baptiste Onofré <[hidden email]>:

> 1. It sounds like a mistake i the karaf-wrapper script. I gonna check
> that.

> 2. As a workaround, you can use the systemd scripts in the contrib
> folder. However, one feature of the karaf-wrapper is the respawn of
> the JVM in case of failure or process exit.

Thanks for the feedback, I'm currently using the systemd scripts:
 https://github.com/steinarb/karaf-deb-packaging

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problems with karaf-wrapper for 4.0.7 on a amd64 virtual machine running debian "jessie"

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:
>>>>> Jean-Baptiste Onofré <[hidden email]>:

>> 1. It sounds like a mistake i the karaf-wrapper script. I gonna check
>>    that.

>> 2. As a workaround, you can use the systemd scripts in the contrib
>>    folder. However, one feature of the karaf-wrapper is the respawn of
>>    the JVM in case of failure or process exit.

> Thanks for the feedback, I'm currently using the systemd scripts:
>  https://github.com/steinarb/karaf-deb-packaging

One annoyance with the karaf run from the systemd scripts compared with
a karaf run from just the command line, is that:
 1. The /var/log/karaf is cluttered with log file for particular classes
    in addition to karaf.log
 2. The karaf.log file isn't rotated

Does anyone know what might be causing this?

The deb-packaged /var/log/karaf/ looks like this:
  /var/log/karaf:
  total used in directory 14024 available 10904264
  drwxr-xr-x  2 karaf karaf    4096 Feb 14 14:03 .
  drwxr-xr-x 13 root  root     4096 Mar 12 06:29 ..
  -rw-r--r--  1 karaf karaf 7997426 Mar 12 07:15 karaf.log
  -rw-r--r--  1 karaf karaf    2877 Nov 23 06:36 no.priv.bang.ukelonn.api.log
  -rw-r--r--  1 karaf karaf    2829 Nov 23 06:36 no.priv.bang.ukelonn.log
  -rw-r--r--  1 karaf karaf  169532 Jan 23 18:25 no.priv.bang.ukelonn.postgresql.db.log
  -rw-r--r--  1 karaf karaf   12032 Mar 12 07:09 org.apache.aries.blueprint.core.log
  -rw-r--r--  1 karaf karaf  157740 Mar 12 07:09 org.apache.aries.jmx.core.log
  -rw-r--r--  1 karaf karaf 2895112 Mar 12 07:14 org.apache.aries.spifly.dynamic.bundle.log
  -rw-r--r--  1 karaf karaf    2061 Nov 21 21:29 org.apache.felix.fileinstall.log
  -rw-r--r--  1 karaf karaf     990 Nov 26 16:36 org.apache.karaf.bundle.core.log
  -rw-r--r--  1 karaf karaf   59424 Nov 21 21:29 org.apache.karaf.features.core.log
  -rw-r--r--  1 karaf karaf    2385 Nov 26 16:10 org.apache.karaf.jaas.modules.log
  -rw-r--r--  1 karaf karaf    8848 Mar 12 07:10 org.apache.karaf.scr.management.log
  -rw-r--r--  1 karaf karaf  249275 Mar 12 07:11 org.apache.karaf.shell.core.log
  -rw-r--r--  1 karaf karaf     129 Feb 14 14:03 org.apache.myfaces.core.api.log
  -rw-r--r--  1 karaf karaf 1721556 Mar 12 07:15 org.apache.myfaces.core.impl.log
  -rw-r--r--  1 karaf karaf   69598 Mar 12 07:14 org.apache.shiro.web.log
  -rw-r--r--  1 karaf karaf   11835 Mar 12 07:10 org.apache.sshd.core.log
  -rw-r--r--  1 karaf karaf  168730 Mar 12 07:15 org.eclipse.jetty.util.log
  -rw-r--r--  1 karaf karaf    9042 Mar 12 07:14 org.ops4j.pax.cdi.extender.log
  -rw-r--r--  1 karaf karaf     908 Nov 21 21:28 org.ops4j.pax.url.mvn.log
  -rw-r--r--  1 karaf karaf  134974 Mar 12 07:14 org.ops4j.pax.web.pax-web-extender-war.log
  -rw-r--r--  1 karaf karaf  210434 Mar 12 07:14 org.ops4j.pax.web.pax-web-jetty.log
  -rw-r--r--  1 karaf karaf  310388 Mar 12 07:14 org.ops4j.pax.web.pax-web-jsp.log
  -rw-r--r--  1 karaf karaf   36136 Mar 12 07:13 org.ops4j.pax.web.pax-web-runtime.log
  -rw-r--r--  1 karaf karaf   14136 Mar 12 07:15 org.primefaces.log

The unpacked-and-run-as-is data/log/ directory looks like this (also on
a debian machine), ie. the way I would have liked the deb-packaged
karaf's /var/log/karaf/ to look:
  /home/sb/skrot/apache-karaf-4.0.7/data/log:
  total used in directory 10596 available 337092692
  drwxr-xr-x 2 sb sb    4096 Mar 12 14:42 .
  drwxr-xr-x 9 sb sb    4096 Nov 26 13:31 ..
  -rw-r--r-- 1 sb sb  273152 Mar 12 15:17 karaf.log
  -rw-r--r-- 1 sb sb 1048960 Mar 12 14:42 karaf.log.1
  -rw-r--r-- 1 sb sb 1048795 Dec 29 13:43 karaf.log.10
  -rw-r--r-- 1 sb sb 1048960 Mar 12 12:25 karaf.log.2
  -rw-r--r-- 1 sb sb 1048960 Mar 12 10:08 karaf.log.3
  -rw-r--r-- 1 sb sb 1048960 Mar 12 07:52 karaf.log.4
  -rw-r--r-- 1 sb sb 1048960 Mar 12 05:35 karaf.log.5
  -rw-r--r-- 1 sb sb 1048960 Mar 12 03:19 karaf.log.6
  -rw-r--r-- 1 sb sb 1048960 Mar 12 01:02 karaf.log.7
  -rw-r--r-- 1 sb sb 1049754 Mar 11 22:45 karaf.log.8
  -rw-r--r-- 1 sb sb 1051219 Jan 29 19:03 karaf.log.9

I have tried to figure out what causes this without any success so far.

The log related files in /etc/karaf of the deb-installed karaf are as
far as I can tell identical to the ones in the unpacked karaf 4.0.7.

Here are the files in the unpacked karaf etc/ directory:
  -rw-r--r--  1 sb sb  1121 Sep 26 08:07 java.util.logging.properties
  -rw-r--r--  1 sb sb  1663 Nov 26 13:30 org.apache.karaf.log.cfg
  -rw-r--r--  1 sb sb  2942 Nov 26 13:30 org.ops4j.pax.logging.cfg
 
Here are the files in /etc/karaf/ from the deb-installed karaf:
  -rw-r--r--   1 karaf karaf  1121 Sep 26 07:07 java.util.logging.properties
  -rw-r--r--   1 karaf karaf  1663 Nov 20 11:23 org.apache.karaf.log.cfg
  -rw-r--r--   1 karaf karaf  2341 Nov 20 11:23 org.ops4j.pax.logging.cfg

The karaf.log file is mentioned in this line in org.ops4j.pax.logging.cfg,
identical in both systems:
log4j.appender.out.file=${karaf.data}/log/karaf.log

The deb-installed karaf in addition has the following in the
/etc/karaf/karaf.conf file:
KARAF_SERVICE_LOG="/var/log/karaf/karaf.log"

(I don't know what this directive does, but I don't think this is the
cause of class-specific log files and no log rotation...?)

Loading...