Timeout in Karaf console

I like to keep a SSH session to the Karaf console open with log:tail running. However every 1/2 an hour or so I get thrown out with the following:

[WARN ] [sshd.server.session.ServerSessionImpl] - exceptionCaught(ServerSessionImpl[openhab@/:50946])[state=Opened] InterruptedByTimeoutException: null

I’ve tried changing the sshIdleTimout in /var/lib/openhab2/etc/org.apache.karaf.shell.cfg but it doesn’t seem to have any effect.

Any ideas?

Thanks,
Matt

Same problem here since upgrading to newer version. Might be a setting I’m not sure about.

Same Problem here. Wasn’t able to figure out where it comes from.

ssh to the host and tail -f /var/log/openhab2/*.log

did you restart the OH2 service? I think that changing the sshIdleTimeout will not affect a running service.

another option is to use a SSH client that sends keep alive messages

XshellCore_2017-10-25_22-49-40

1 Like

That’s not the same thing. A log:tail in karaf gives you the output from both openhab.log and events.log combined. In nice colors!

I have this problem as well. I always ssh into karaf from localhost. In 2.1 I could tail the log forever but after upgrading to 2.2 snapshot I’m thrown out after a while.

1 Like

OpenHAB restarted & host rebooted.

Ok, I’ve just changed the keepalive settings to send every 60s. Will report back.

No change with keepalive enabled, Karaf console still throws me out.

It’s a change since 2.2, in 2.1 could log in Karaf console and keep log:tail going…

then… this seems to be related to embedded SSHd server (1.6.0) that is included in Karaf 4.1.2

It may be a bug of that component:

openhab> list -s -t 0 | grep sshd
 68 │ Active   │  30 │ 1.6.0                  │ org.apache.sshd.core

openhab> headers 68

Apache Mina SSHD :: Core (68)
-----------------------------
Bnd-LastModified = 1498727707328
Build-Jdk = 1.8.0_91
Built-By = gnodet
Created-By = Apache Maven Bundle Plugin
Implementation-Title = Apache Mina SSHD :: Core
Implementation-URL = http://www.apache.org/sshd/sshd-core/
Implementation-Vendor = The Apache Software Foundation
Implementation-Vendor-Id = org.apache.sshd
Implementation-Version = 1.6.0
Manifest-Version = 1.0
Specification-Title = Apache Mina SSHD :: Core
Specification-Vendor = The Apache Software Foundation
Specification-Version = 1.6.0
Tool = Bnd-3.2.0.201605172007

No it’s not a bug!. You should check the userdata folder of openHAB located (for package installations) /var/lib/openhab2/etc and in the file org.apache.karaf.shell.cfg modify the default:

sshIdleTimeout = 1800000

It lets you modify the ssh karaf shell timeout!

:wink:

I’ve tried changing the sshIdleTimout in /var/lib/openhab2/etc/org.apache.karaf.shell.cfg but it doesn’t seem to have any effect.

Did you restart openHAB after the change?
I had the same issue, I modified the value and things are working as planned!

Yes, have both restarted openHAB and rebooted the host.

What build are you using?

2.2.0-SNAPSHOT
Build #1068

Just updated to Build #1070, and rebooted. Testing.

I believe that any OH 2.2.0 Snapshot Build above 1009 will not modify the behavior of the SSHd

S1009 upgraded the Karaf version from 4.0.8 to 4.1.2.
The SSHd is a part of the Karaf shell component and doesn’t get refreshed with the openHAB 2.2 Snapshots.

To get a newer version of the SSHd than the current 1.6.0, you would need to get a newer Karaf bundle upgrade from a future OH 2.2 snapshot release.

(or… you could try to manually deploy a newer version of the SSHd bundle :stuck_out_tongue: )

Another thing to try is:
/etc/openhab2/services/runtime.cfg

org.apache.karaf.shell:sshIdleTimeout = 0

Usually, stuff in the /var/lib/openhab2/etc/ folder get created from parameters that you set in the files contained in the /etc/openhab2/ folders

Since sshIdleTimeout = 1800000 is the default (30 mins)… even if you change this setting in the /var/lib/openhab2/etc/org.apache.karaf.shell.cfg file, the setting will most likely be overwritten with the default value after service restart.

Setting the time out in the /etc/openhab2/ area will make OH2 read that parameter and update both the running config as well as the /var/lib/ files.

openhab> config:list |grep sshIdleTimeout
   sshIdleTimeout = 0
2 Likes

by the way: I tested S1070 also and get the same but much faster than the 30 mins timeout…
I got busted with

17:03:45.946 [WARN ] [sshd.server.session.ServerSessionImpl] - exceptionCaught(ServerSessionImpl[openhab@/0:0:0:0:0:0:0:1:59771])[state=Opened] InterruptedByTimeoutException: null

after about 14mins of logging in via the local ssh shell and issuing log:tail

Exactly the same I’m getting. Clocked 11 minutes here now…

I’m having exactly same issue. 10-15minutes max.
Note that i tried all of the above without any success
Using 2.2.0-SNAPSHOT Build #1073