Can't connect to Karaf console

Hi,

I’m having trouble getting into the karaf console. I’m running Openhabian. I tried

openhab-cli console

as well as

/usr/share/openhab2/runtime/bin/client

Both give the same result:

Logging in as openhab
Failed to get the session.

Since that’s not very informative, I’ve run

openhab-cli console -v -l 4

That gives me more information:

794 [main] DEBUG org.apache.sshd.common.util.security.SecurityUtils - register([BC, true, false]) not registered - enabled=null, supported={}
801 [main] DEBUG org.apache.sshd.common.util.security.SecurityUtils - register([EdDSA, true, false]) not registered - enabled=null, supported={}
Logging in as openhab
1771 [main] TRACE org.apache.sshd.client.SshClient - addSessionListener(SshClient[24a67])[org.apache.sshd.common.session.helpers.SessionTimeoutListener@c87b21] registered
1778 [main] TRACE org.apache.sshd.common.util.threads.ThreadUtils$SshdThreadFactory - newThread(java.lang.ThreadGroup[name=main,maxpri=10])[sshd-SshClient[24a67]-timer-thread-1] runnable=java.util.concurrent.ThreadPoolExecutor$Worker@10399e[State = -1, empty queue]
1869 [main] TRACE org.apache.sshd.common.io.nio2.Nio2Connector - Creating Nio2Connector
1887 [main] DEBUG org.apache.sshd.client.config.hosts.DefaultConfigFileHostEntryResolver - resolveEffectiveHost([openhab, 127.0.0.1, 8101, null]@null:{}) => {}
1888 [main] DEBUG org.apache.sshd.client.SshClient - connect([openhab, 127.0.0.1, 8101]@null:{}) no overrides
1929 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - Connecting to /127.0.0.1:8101
1955 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - setOption([SO_REUSEADDR, true, socket-reuseaddr])[null] from property={}
1972 [Thread-0] TRACE org.apache.sshd.common.util.threads.ThreadUtils$SshdThreadFactory - newThread(java.lang.ThreadGroup[name=main,maxpri=10])[sshd-SshClient[24a67]-nio2-thread-1] runnable=java.util.concurrent.ThreadPoolExecutor$Worker@44647e[State = -1, empty queue]
1982 [sshd-SshClient[24a67]-nio2-thread-1] DEBUG org.apache.sshd.client.SshClient - operationComplete([openhab, /127.0.0.1:8101, ConnectException, Connection refused]@null) failed ({}): {}
1984 [main] DEBUG org.apache.sshd.client.SshClient - close(SshClient[24a67]) Closing immediately
2021 [main] TRACE org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) closing org.apache.sshd.common.util.closeable.Builder$1@4ed9f0
2022 [main] TRACE org.apache.sshd.client.SshClient - removeSessionListener(SshClient[24a67])[org.apache.sshd.common.session.helpers.SessionTimeoutListener@c87b21] removed
2022 [main] TRACE org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) closing org.apache.sshd.common.io.nio2.Nio2Connector@4f787b
2023 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - close(org.apache.sshd.common.io.nio2.Nio2Connector@4f787b) Closing immediately
2042 [main] TRACE org.apache.sshd.common.util.closeable.ParallelCloseable - doClose(true) completed pending: 0
2048 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - close(org.apache.sshd.common.io.nio2.Nio2Connector@4f787b)[Immediately] closed
2048 [main] TRACE org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) closing org.apache.sshd.common.io.nio2.Nio2ServiceFactory@3f4d3d
2048 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - close(org.apache.sshd.common.io.nio2.Nio2ServiceFactory@3f4d3d) Closing immediately
2049 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Shutdown group
2053 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Group successfully shut down
2054 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - close(org.apache.sshd.common.io.nio2.Nio2ServiceFactory@3f4d3d)[Immediately] closed
2054 [main] TRACE org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) closing org.apache.sshd.common.util.closeable.Builder$1@13b32d7
2056 [main] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) signal close complete
2056 [main] DEBUG org.apache.sshd.client.SshClient - close(SshClient[24a67])[Immediately] closed
org.apache.sshd.common.RuntimeSshException: Failed to get the session.
	at org.apache.sshd.client.future.DefaultConnectFuture.getSession(DefaultConnectFuture.java:59)
	at org.apache.karaf.client.Main.connectWithRetries(Main.java:372)
	at org.apache.karaf.client.Main.main(Main.java:172)
Caused by: java.net.ConnectException: Connection refused
	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252)
	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
	at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:293)
	at java.lang.Thread.run(Thread.java:748)

So, the connection is refused. But why? I’ve been using the Karaf console before, without any problems. I can’t remember changing anything that could have coused this…

Does anyone have a clue?

  • Platform information:
    • Hardware: Raspberry Pi 2 Model B Rev 1.1
    • OS: Raspbian GNU/Linux 9 (stretch), Linux 4.19.42-v7+
    • Java Runtime Environment: OpenJDK Runtime Environment (Zulu8.40.0.178-CA-linux_aarch32hf) (build 1.8.0_222-b178)
    • openHAB version: openHAB 2.5.0~M3-1

Is there any reason you have remained on such an old testing build? The current build, as of this minute, is Milestone 6.
Release Candidate 1 is expected to be released later today and stable 2.5 on Sunday…

The simple reason is that I haven’t had the time to upgrade and M3 has been running fine so far.

1 Like

Well, upgrading to 2.5.0.RC1 solved my problem. Thanks for the hint, @Bruce_Osborne!

1 Like