Cannot access console

  • Platform information:

    • Raspberry Pi 3B+, 1GB RAM, plenty space on SSD
    • OS Raspbian, latest version fully up to date
    • Java Runtime Environment: Oracle Java 8:
      java version “1.8.0_241”
      Java™ SE Runtime Environment (build 1.8.0_241-b07)
      Java HotSpot™ Client VM (build 25.241-b07, mixed mode)
    • openHAB version:
      openhab-distro : 2.5.2
      openhab-core : 2.5.0
      openhab1-addons : 1.14.0
      openhab2-addons : 2.5.2
      karaf : 4.2.7
  • Issue of the topic: Unable to access console
    I have installed openHAB on a headless RPi, and have got as far as installing the UIs and starting to add bindings. One of the main ones I need is for the IKEA TRÅDFRI gateway, through which I hope to be able to control some lights and power outlets from a Logitech Harmony remote. The TRÅDFRI binding documentation says it needs to be supplied with the code from the base of the gateway box – I have the code – but the docs don’t explain how to supply that code to the binding.
    I have surmised that I need to do this through the console, and I would expect to do this via SSH, as the server is running on my headless RPi.
    But I see that for security reasons I can’t use a remote ssh session (would be from my laptop on the same home network). I am therefore using a terminal in a VNC session onto the Pi.
    First attempt was this, with these results:
    ssh -p 8101 openhab@localhost
    ssh: connect to host localhost port 8101: Connection refused
    Next I tried this, also without success:
    openhab-cli console

    Logging in as openhab
    Failed to get the session.

And now I’m stuck.
There’s nothing in the logs that appears obviously to touch on this, though I am seeing errors such as “AES KeyGenerator not available”.

Advice welcome.

Update: I have now discovered how to enter the gateway security code via the PaperUI, and have done so, but the gateway isn’t coming active. I disabled/re-enabled it and it now shows as “Initializing” and has done so for quite a long time. I tried rebooting the Pi but that didn’t help.
And I still can’t get to the console, though my immediate need for it has gone.

First idea: is ssh installed (meta package for openssh-client and openssh-server)?
Is the daemon started (systemctl status sshd)?

You should not need ssh for the karaf console, but vnc is sort of :nauseated_face: for terminal access…

Maybe openHAB (meh… apache karaf) relies on ssh? Idk.

1 Like

Thanks for looking at this.Yes, I can confirm that ssh (client and server) is definitely installed on the RPi, and it’s running. I regularly access it from my laptop via ssh and I can also ssh from there back to the laptop (and to other systems on my network).
For unrelated reasons, the RPi that I’m running OH2 on is in a very inaccessible place, with just a single CAT5 cable supplying power and network to it. I’m only using VNC when I need a graphical desktop on the RPi, because the Raspberry Pi docs suggest it - I’d be open to using some other remote desktop software.

Well, why would you need a desktop on the Pi at all? openHAB2 should run fine headless, Desktop is only overhead.

How did you install openHAB? Best way for Pi is openHABian image, but if using some other software which prevents to use the image, you could also use the pure openHABian scripts without the image (Other Linux Systems, add openHABian just like any other software).

Why would I need a desktop? Well, let’s just say that openHAB is not the only thing I use this machine for. Which (apart from the fact that I don’t have easy physical access to the machine) also explains why I didn’t go for an openHABian image.

But I was under the impression I was doing the next best thing, by installing it from the openHAB2 repository as described here: https://www.openhab.org/docs/installation/linux.html#package-repository-installation

Sadly, none of this yak-shaving is really helping me achieve what I’m trying to do (which is to control some IKEA lights with a Harmony remote), so for now I think I’ll go looking elsewhere for a solution.

:man_shrugging:

Did it in that way, too. I am using some kind of a raspberry clone.
The access to karaf console from the raspberry clone itself to localhost works.
ssh to karaf console from remote computer does not work because it is bound to localhost only in ${OPENHAB_USERDATA}/etc/org.apache.karaf.shell.cfg.

The karaf console itself independent of ssh/sshd installation. It’s part of the openhab modules and compiled into one of the java classes.

To check it the prozess is running you may run

lsof -i :8101

The output should show the prozess that opened the port 8101. According to the output that you got when you tried to connect localhost port 8101 I would assume that this port is not open.

You also may run

netstat -tulpe | grep LISTEN | grep java

which results e.g. in:

tcp6       0      0 [::]:8443               [::]:*                  LISTEN      openhab    96883778    12640/java      
tcp6       0      0 localhost:8101          [::]:*                  LISTEN      openhab    96883040    12640/java      
tcp6       0      0 localhost:54158         [::]:*                  LISTEN      openhab    96883767    12640/java      
tcp6       0      0 [::]:5007               [::]:*                  LISTEN      openhab    96883801    12640/java      
tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN      openhab    96883053    12640/java