Can't connect to Karaf console


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

openhab-cli console

as well as


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 - register([BC, true, false]) not registered - enabled=null, supported={}
801 [main] DEBUG - 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 - Creating Nio2Connector
1887 [main] DEBUG org.apache.sshd.client.config.hosts.DefaultConfigFileHostEntryResolver - resolveEffectiveHost([openhab,, 8101, null]@null:{}) => {}
1888 [main] DEBUG org.apache.sshd.client.SshClient - connect([openhab,, 8101]@null:{}) no overrides
1929 [main] DEBUG - Connecting to /
1955 [main] DEBUG - 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, /, 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
2023 [main] DEBUG - close( Closing immediately
2042 [main] TRACE org.apache.sshd.common.util.closeable.ParallelCloseable - doClose(true) completed pending: 0
2048 [main] DEBUG - close([Immediately] closed
2048 [main] TRACE org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(true) closing
2048 [main] DEBUG - close( Closing immediately
2049 [main] DEBUG - Shutdown group
2053 [main] DEBUG - Group successfully shut down
2054 [main] DEBUG - close([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(
	at org.apache.karaf.client.Main.connectWithRetries(
	at org.apache.karaf.client.Main.main(
Caused by: Connection refused
	at Method)

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