You are not logged in.

#1 2015-11-14 17:57:35

lastopier
Member
Registered: 2015-08-01
Posts: 7

[SOLVED] sshd.socket fails to start - address is already in use

Hi, I've enabled sshd.socket through systemctl, but sshd.socket fails to start. What does 'address already in use' mean? I can't find it anywhere.
Here's output from 'systemctl status sshd.socket':

● sshd.socket
   Loaded: loaded (/usr/lib/systemd/system/sshd.socket; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/sshd.socket.d
           └─override.conf
   Active: failed (Result: resources)
   Listen: [::]:22 (Stream)
           [::]:22 (Stream)
           [::]:5000 (Stream)
 Accepted: 0; Connected: 0

Nov 14 18:38:55 mipo44-arch systemd[1]: sshd.socket: Failed to listen on sockets: Address already in use
Nov 14 18:38:55 mipo44-arch systemd[1]: Failed to listen on sshd.socket.
Nov 14 18:38:55 mipo44-arch systemd[1]: sshd.socket: Unit entered failed state.
Nov 14 18:40:09 mipo44-arch systemd[1]: Closed sshd.socket.
Nov 14 18:40:09 mipo44-arch systemd[1]: sshd.socket: Failed to listen on sockets: Address already in use
Nov 14 18:40:09 mipo44-arch systemd[1]: Failed to listen on sshd.socket.

Output from 'systemctl status sshd.service':

● sshd.service - OpenSSH Daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

And this is my config file when I edit sshd.socket through systemctl edit:

[Socket]
ListenStream=22
ListenStream=5000

Last edited by lastopier (2015-11-15 12:09:37)

Offline

#2 2015-11-14 18:10:29

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,349

Re: [SOLVED] sshd.socket fails to start - address is already in use

It means that something else is already listening on port 22

Take a look at the output of sudo netstat -tulpn

Here is mine

ewaller@turing ~ 1014 %sudo 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:17500           0.0.0.0:*               LISTEN      5839/dropbox        
tcp        0      0 127.0.0.1:17600         0.0.0.0:*               LISTEN      5839/dropbox        
tcp        0      0 127.0.0.1:8384          0.0.0.0:*               LISTEN      489/syncthing       
tcp        0      0 127.0.0.1:17603         0.0.0.0:*               LISTEN      5839/dropbox        
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      491/systemd-resolve 
tcp        0      0 127.0.0.1:9292          0.0.0.0:*               LISTEN      13042/emacs         
tcp        0      0 0.0.0.0:7634            0.0.0.0:*               LISTEN      474/hddtemp         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      490/sshd            
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      485/cupsd           
tcp6       0      0 :::6600                 :::*                    LISTEN      863/mpd             
tcp6       0      0 :::5355                 :::*                    LISTEN      491/systemd-resolve 
tcp6       0      0 :::22000                :::*                    LISTEN      489/syncthing       
tcp6       0      0 :::22                   :::*                    LISTEN      490/sshd            
tcp6       0      0 ::1:631                 :::*                    LISTEN      485/cupsd           
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           8976/chromium       
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           491/systemd-resolve 
udp        0      0 192.168.1.3:68          0.0.0.0:*                           477/systemd-network 
udp        0      0 0.0.0.0:17500           0.0.0.0:*                           5839/dropbox        
udp        0      0 0.0.0.0:44445           0.0.0.0:*                           489/syncthing       
udp        0      0 0.0.0.0:21027           0.0.0.0:*                           489/syncthing       
udp6       0      0 :::5355                 :::*                                491/systemd-resolve 
udp6       0      0 :::33475                :::*                                489/syncthing       
udp6       0      0 :::21027                :::*                                489/syncthing       
ewaller@turing ~ 1015 %

I can see that port 22 is open and is in use by sshd.   Something on your system will have that port open (Or port 5000)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2015-11-14 18:57:51

lastopier
Member
Registered: 2015-08-01
Posts: 7

Re: [SOLVED] sshd.socket fails to start - address is already in use

It only lists one port - 68 used by dhcpcd.

Also I forgot to mention that sshd.service works fine if I start it manually.

Offline

#4 2015-11-15 11:10:29

SaltySockets
Member
Registered: 2015-10-10
Posts: 22

Re: [SOLVED] sshd.socket fails to start - address is already in use

lastopier wrote:

It only lists one port - 68 used by dhcpcd.

Also I forgot to mention that sshd.service works fine if I start it manually.

Make sure that sshd.service is stopped and disabled and that no other process is listening to the ports you've specified. Only one process at any given time can use a specific port.

ss -atn46

If you look closely on the status of sshd.socket, you'll see that port 22 is specified twice which isn't possible. There's also a sshd override file which might be the problem. If port 22 is specified once in sshd.socket and then again in the override.conf then you'll have port 22 specified twice and will likely cause the port conflict which you describe.
Do systemctl edit again and remove the port 22 directive. Does that solve it? Don't forget systemctl daemon-reload. Port 22 is already specified in sshd.socket.

Offline

#5 2015-11-15 12:08:54

lastopier
Member
Registered: 2015-08-01
Posts: 7

Re: [SOLVED] sshd.socket fails to start - address is already in use

Ah, it indeed was the specification to listen on port 22 in sshd.socket config. Thanks a lot.

Offline

Board footer

Powered by FluxBB