"Connection refused" when ssh to openhab console from localhost

OpenHAB 1.8.3 is running as systemd service, on Raspbian.

I can’t connect to the console on localhost:

pi@raspberrypi:~ $ ssh openhab@localhost -p 8101
ssh: connect to host localhost port 8101: Connection refused

According to this documentation it is a straight forward process. Is ssh console not available by default in Runtime? Does it require configuration? Any ideas what went wrong?

Seems no process is listening on 8101. Are u shure is karaf is running?

OpenHAB is definitely running. I can access the web interface on 8080 port. Service also looks fine:

pi@raspberrypi:~ $ sudo service openhab status
● openhab.service - A vendor and technology agnostic open source automation software for your smart home.
   Loaded: loaded (/etc/systemd/system/openhab.service; enabled)
   Active: active (running) since sob 2017-03-04 18:22:32 CET; 29s ago
  Process: 2292 ExecStart=/usr/bin/openhab (code=exited, status=0/SUCCESS)
 Main PID: 2299 (java)
   CGroup: /system.slice/openhab.service
           └─2299 java -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=8080 -Djetty.po...

mar 04 18:22:32 raspberrypi openhab[2292]: Launching the openHAB runtime..
mar 04 18:22:32 raspberrypi systemd[1]: Started A vendor and technology agnostic open source automation software...ome..
mar 04 18:22:50 raspberrypi openhab[2292]: osgi> 2017-03-04 18:22:50.155 [INFO ] [.o.core.internal.CoreActivator...8.3).
mar 04 18:22:53 raspberrypi openhab[2292]: 2017-03-04 18:22:53.125 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mD...arted
mar 04 18:22:53 raspberrypi openhab[2292]: 2017-03-04 18:22:53.277 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Se...eted.
mar 04 18:23:01 raspberrypi openhab[2292]: 2017-03-04 18:23:01.950 [INFO ] [c.internal.ModelRepositoryImpl] - Lo...tems'
Hint: Some lines were ellipsized, use -l to show in full.

Is karaf supposed to be launched separately?

Looks like it’s listening on standard port after all. Documentation is misleading in this regard. Unfortunately “default” password habopen does not work.

What am I missing? Is this configurable somewhere?

pi@raspberrypi:~ $ ssh openhab@localhost
openhab@localhost's password:
Permission denied, please try again.
openhab@localhost's password:

pi@raspberrypi:~ $ ssh karaf@localhost
karaf@localhost's password:
Permission denied, please try again.
karaf@localhost's password:

You are hitting your linux OS on loopback on default port which is why it answers but doesn’t like the password.

Do you by chance have anything else running on 8101? Try stopping OH and see if it goes from connection refused to timed out.

Thanks a lot for reply!

So I disabled the service, rebooted Raspberry, ssh to localhost on port 8101, but result is the same - connection refused. Even though OpenHAB was not running.

Back to the original state - I enabled the service again, rebooted one more time and here are the active connections:

root@raspberrypi:/home/pi# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      889/smbd
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      889/smbd
tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      597/vncserver-x11-c
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      516/sshd
tcp6       0      0 :::8443                 :::*                    LISTEN      639/java
tcp6       0      0 :::445                  :::*                    LISTEN      889/smbd
tcp6       0      0 :::139                  :::*                    LISTEN      889/smbd
tcp6       0      0 :::5900                 :::*                    LISTEN      597/vncserver-x11-c
tcp6       0      0 :::8080                 :::*                    LISTEN      639/java
tcp6       0      0 :::22                   :::*                    LISTEN      516/sshd
udp        0      0 0.0.0.0:33655           0.0.0.0:*                           409/avahi-daemon: r
udp        0      0 0.0.0.0:68              0.0.0.0:*                           412/dhcpcd
udp        0      0 192.168.0.102:123       0.0.0.0:*                           633/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           633/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           633/ntpd
udp        0      0 192.168.0.255:137       0.0.0.0:*                           858/nmbd
udp        0      0 192.168.0.102:137       0.0.0.0:*                           858/nmbd
udp        0      0 0.0.0.0:137             0.0.0.0:*                           858/nmbd
udp        0      0 192.168.0.255:138       0.0.0.0:*                           858/nmbd
udp        0      0 192.168.0.102:138       0.0.0.0:*                           858/nmbd
udp        0      0 0.0.0.0:138             0.0.0.0:*                           858/nmbd
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           409/avahi-daemon: r
udp6       0      0 :::38005                :::*                                409/avahi-daemon: r
udp6       0      0 fe80::83e3:e6de:a24:123 :::*                                633/ntpd
udp6       0      0 ::1:123                 :::*                                633/ntpd
udp6       0      0 :::123                  :::*                                633/ntpd
udp6       0      0 :::5353                 :::*                                639/java
udp6       0      0 :::5353                 :::*                                409/avahi-daemon: r
root@raspberrypi:/home/pi#

I can see standard ssh listening on port 22, but there are no processes listening on 8101.
Java process (OpenHAB) is listening on 8443. I tried that too, but unfortunately still no luck.

pi@raspberrypi:~ $ ssh openhab@localhost -p 8443
ssh_exchange_identification: Connection closed by remote host

I also tried with username karaf, but it gives the same results.

So whatever component is responsible for OpenHAB ssh - it appears that it’s not running?

I may be wrong, but I think you need to be running OpenHab2 to be able to log into Karaf. As per your original post, you are on 1.8.3

Yes, that’s what I’m suspecting. I’m a bit confused - documentation does not state that it’s only referring to OpenHAB2.

To summarize: it seems that there is no access to the console when OpenHAB1 is running as a service. Not running as a service, or installing OH2 are my only choices for now. Thanks for help!

OH, I missed that you were running OH 1.8. Definitely no console for 1.8. That was introduced in the new architecture associated with OH 2.