I've been having a serious issue with running Karaf as a server/daemon on Ubuntu 14.04 and Linux Mint. As soon as I exit the ssh to the host machine (NOT the karaf remote shell) Karaf terminates. I've done several experiments over the past several days and I've come to the conclusion it is something to do with Karaf itself.
To clarify the issue, here is how I start and use Karaf. 1. I have an Ubuntu 14.04 server which I ssh into to administer etc. I do NOT use a local console and this includes installing software, starting Karaf etc. 2. I start Karaf by ssh into the Ubuntu host and then execute the bin/start. According to the docs this should make Karaf behave as a daemon and this is what does happen. I can at this point log into the Karaf server with 'ssh -p 8101 karaf@karaf_host' from any other machine. 3. If I now close the ssh to the Ubuntu host (NOT the ssh terminal to karaf itself), the karaf instance dies. I have confirmed this on a Linux Mint host as well. However this does NOT happen on a RaspberryPi device running Raspbian. 4. I have tried using 'setsid', 'nohup' and 'screen' with bin/start but the problem remains. 5. After I start Karaf, ps -elf shows the Karaf executing with the following options: /usr/bin/java -server -Xms128M -Xmx512M -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/usr/lib/jvm/jdk1.7.0_67/jre/lib/endorsed:/usr/lib/jvm/jdk1.7.0_67/lib/endorsed:/home/shuttle/apache/test/apache-karaf-3.0.3/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/jdk1.7.0_67/jre/lib/ext:/usr/lib/jvm/jdk1.7.0_67/lib/ext:/home/shuttle/apache/test/apache-karaf-3.0.3/lib/ext -Dkaraf.instances=/home/shuttle/apache/test/apache-karaf-3.0.3/instances -Dkaraf.home=/home/shuttle/apache/test/apache-karaf-3.0.3 -Dkaraf.base=/home/shuttle/apache/test/apache-karaf-3.0.3 -Dkaraf.data=/home/shuttle/apache/test/apache-karaf-3.0.3/data -Dkaraf.etc=/home/shuttle/apache/test/apache-karaf-3.0.3/etc -Djava.io.tmpdir=/home/shuttle/apache/test/apache-karaf-3.0.3/data/tmp -Djava.util.logging.config.file=/home/shuttle/apache/test/apache-karaf-3.0.3/etc/java.util.logging.properties -Djavax.management.builder.initial=org.apache.karaf.management.boot.KarafMBeanServerBuilder -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /home/shuttle/apache/test/apache-karaf-3.0.3/lib/karaf-jaas-boot.jar:/home/shuttle/apache/test/apache-karaf-3.0.3/lib/karaf-jmx-boot.jar:/home/shuttle/apache/test/apache-karaf-3.0.3/lib/karaf-org.osgi.core.jar:/home/shuttle/apache/test/apache-karaf-3.0.3/lib/karaf.jar org.apache.karaf.main.Main I have tried removing various options but the problem remains. 6. To check whether it's my Java install I created a simple Java daemon DaemonTest.java <http://karaf.922171.n3.nabble.com/file/n4038855/DaemonTest.java> . I can start this with the command 'java DaemonTest &' and it runs in the background. I can then use nc to connect to the daemon from another machine: nc daemon_host 6002 I can start DaemonTest on the daemon_host by connecting through ssh, then close the ssh terminal and DaemonTest is NOT terminated and I can connected to it as described above. i.e. it works as a server. This seems to prove my Java installation. 7. I tried Java 7 and 8 but the result is still the same with Karaf. It looks to me as though it's an issue with Karaf or perhaps Karaf with Ubuntu and flavours of it. Anyone have any ideas? -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-terminates-after-last-ssh-connection-to-the-Karaf-HOST-terminates-tp4038855.html Sent from the Karaf - Dev mailing list archive at Nabble.com.
