Port 'XXX' is already in use by something else on the host

Hi,

I’m relatively new to HA and have had a system running for a month or two.

Currently, as well as the obligatory control of my Ikea lights, I’m trying to log the temperature, humidity and energy use of my house to see what I need to improve upon. As such some of the first addons I installed were InfluxDB and Graphana.

However I kept finding I returned to find I was missing data since InfluxDB had stopped running (I do have the watchdog switch turned on), often I could just start the add-on again and all would be well, except for the missing data. However sometimes I find I cannot restart due to the error “Port ‘8086’ is already in use by something else on the host”, which I can fix with a reboot.

I now find however that after my last reboot the “Terminal & SSH” add-on is reporting “Port ‘22’ is already in use by something else on the host” which is also preventing me from logging in via PuTTY.

Is there anyway to find out what is happening and how I can fix it?
It feels to me that something has failed and not cleaned up properly, so these old ports are just ‘hanging around’.

My system is

Home Assistant 2022.10.1
Supervisor 2022.09.1
Operating System 9.0
Frontend 20221006.0 - latest

I am running on a Raspberry Pi4 2Gb booting from an SSD attached to a USB3 port.

I have the following add-ons installed
ESPHome version: 2022.9.4
File editor version: 5.4.1
Grafana version: 8.0.2
Home Assistant Google Drive Backup version: 0.108.4
InfluxDB version: 4.5.0
MariaDB version: 2.5.1
Studio Code Server version: 5.4.0
Terminal & SSH version: 9.6.1

I also have HACs installed (version 1.27.2)
Which provides
I Hildebrand Glow (DCC)

1 Like

From SSH run

netstat -tanp|grep 22
1 Like

Cheers @nickrout
Changing the port of the ‘Terminal & SSH’ add-on to 23 allowed me to ssh in and see

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      136/sshd -D -e [lis
tcp        0      0 :::22                   :::*                    LISTEN      136/sshd -D -e [lis

But I don’t really know what that means.

Essentially it tells you that process 136 is listening on port 22 , and that process is sshd (the ssh server Daemon). It tells you this for IPV4 and IPV6.

So something is already running ssh on port 22, so the addon cannot start. Weird, because in HAOS there should be no other way of starting sshd except thru the addon. And if the addon is running, it shouldn’t give you the option to start.

There have been reports lately of addons not starting properly, and seeming to start, but not reporting in the UI that they are running. The solution was to restart the machine (not just restart core). Do it through this page and click the overflow menu top right and choose ‘reboot system’. Open your Home Assistant instance and show hardware information.

Thanks again @nickrout, that does indeed seem like what I have been experiencing.
The only difference is when “Terminal & SSH” is experiencing the problem, it is not just the UI that is not reporting that it is running. I was not able to SSH in from my PC on port 22 using PuTTY, so there is something else happening there.

Do you know if there is an issue on this I can follow, or potentially any logging info I can provide?