You are not logged in.

#1 2025-10-04 21:45:03

gcae
Member
Registered: 2025-07-06
Posts: 7

SSH service failing to start due to exit-code

Good morning!

When I attempt to start my SSH service, it outputs:

 Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xeu ssh.service" for details. 

Systemctl status ssh outputs:

 ssh.service - OpenSSH Server
     Loaded: loaded (/etc/systemd/system/ssh.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Sat 2025-10-04 17:30:29 EDT; 23s ago
 Invocation: f21a8c37e6074c9092e5d14a9fc04a47
    Process: 544 ExecStart=/usr/sbin/sshd (code=exited, status=255/EXCEPTION)
   Main PID: 544 (code=exited, status=255/EXCEPTION)
   Mem peak: 1.9M
        CPU: 10ms 
Oct 04 17:30:29 gcaehatescomputers systemd[1]: Starting OpenSSH Server...
Oct 04 17:30:29 gcaehatescomputers sshd[544]: fatal: listen on [0.0.0.0]:4169: Address already in use
Oct 04 17:30:29 gcaehatescomputers systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
Oct 04 17:30:29 gcaehatescomputers systemd[1]: ssh.service: Failed with result 'exit-code'.
Oct 04 17:30:29 gcaehatescomputers systemd[1]: Failed to start OpenSSH Server.

SSHD appears to be running on port 4169 and I am regrettably unsure of how those two are supposed to interact. Output of journalctl -xeu ssh.service is:

Oct 04 17:30:29 gcaehatescomputers systemd[1]: Starting OpenSSH Server...
░░ Subject: A start job for unit ssh.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit ssh.service has begun execution.
░░ 
░░ The job identifier is 134.
Oct 04 17:30:29 gcaehatescomputers sshd[544]: fatal: listen on [0.0.0.0]:4169: Address already in use
Oct 04 17:30:29 gcaehatescomputers systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit ssh.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 255.
Oct 04 17:30:29 gcaehatescomputers systemd[1]: ssh.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit ssh.service has entered the 'failed' state with result 'exit-code'.
Oct 04 17:30:29 gcaehatescomputers systemd[1]: Failed to start OpenSSH Server.
░░ Subject: A start job for unit ssh.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit ssh.service has finished with a failure.
░░ 
░░ The job identifier is 134 and the job result is failed.
Oct 04 17:39:26 gcaehatescomputers systemd[1]: Starting OpenSSH Server...
░░ Subject: A start job for unit ssh.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit ssh.service has begun execution.
░░ 
░░ The job identifier is 3033.
Oct 04 17:39:26 gcaehatescomputers sshd[2680]: error: Bind to port 4169 on 0.0.0.0 failed: Address already in use.
Oct 04 17:39:26 gcaehatescomputers sshd[2680]: error: Bind to port 4169 on :: failed: Address already in use.
Oct 04 17:39:26 gcaehatescomputers systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit ssh.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 255.
Oct 04 17:39:26 gcaehatescomputers sshd[2680]: fatal: Cannot bind any address.
Oct 04 17:39:26 gcaehatescomputers systemd[1]: ssh.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit ssh.service has entered the 'failed' state with result 'exit-code'.
Oct 04 17:39:26 gcaehatescomputers systemd[1]: Failed to start OpenSSH Server.
░░ Subject: A start job for unit ssh.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit ssh.service has finished with a failure.
░░ 
░░ The job identifier is 3033 and the job result is failed.

I am using OpenSSH on newest version of Arch with KDE, and my firewall is currently disabled. Apologies for the code-heavy post.

Offline

#2 2025-10-05 06:16:28

-thc
Member
Registered: 2017-03-15
Posts: 992

Re: SSH service failing to start due to exit-code

Please post the output of

sudo ss -tulpn

and the contents of

/etc/ssh/sshd_config

Offline

#3 2025-10-05 17:03:04

gcae
Member
Registered: 2025-07-06
Posts: 7

Re: SSH service failing to start due to exit-code

sudo ss -tulpn responds with:

 Netid       State        Recv-Q        Send-Q               Local Address:Port               Peer Address:Port       Process                                
tcp         LISTEN       0             128                        0.0.0.0:4169                    0.0.0.0:*           users:(("sshd",pid=545,fd=6))         
tcp         LISTEN       0             4096                             *:23                            *:*           users:(("systemd",pid=1,fd=94))       
tcp         LISTEN       0             128                           [::]:4169                       [::]:*           users:(("sshd",pid=545,fd=7))      

                         
/etc/ssh/sshd_config file contains:

# Include drop-in configurations
Include /etc/ssh/sshd_config.d/*.conf

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 4169
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to "no" here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to "no" to disable keyboard-interactive authentication.  Depending on
# the system's configuration, this may involve passwords, challenge-response,
# one-time passwords or some combination of these and other methods.
#KbdInteractiveAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server

Offline

#4 2025-10-05 17:25:25

ua4000
Member
Registered: 2015-10-14
Posts: 524

Re: SSH service failing to start due to exit-code

Verify the sshd config with

sudo sshd -t; echo $?

From the 1st post, please add the info, how you exactly started sshd - you only provided the output.

Offline

#5 2025-10-06 01:23:41

gcae
Member
Registered: 2025-07-06
Posts: 7

Re: SSH service failing to start due to exit-code

That command output

0

and both ssh.service and sshd.service were started with

sudo systemctl enable ssh(d).service

and then

sudo systemctl start ssh(d).service 

**note ssh(d) is meant as ssh or sshd, not what I actually input

Offline

#6 2025-10-06 05:20:29

-thc
Member
Registered: 2017-03-15
Posts: 992

Re: SSH service failing to start due to exit-code

The core of your problem is that you try to start the sshd daemon twice. The second try realizes the SSH port is already in use by the first (running) instance.

The "systemd" default contains no "ssh.service" - I can only guess how you ended up having it.

Offline

#7 2025-10-06 06:25:24

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,407
Website

Re: SSH service failing to start due to exit-code

We can find out:

$ pacman -Qo /etc/systemd/system/ssh.service
$ stat /etc/systemd/system/ssh.service

Last edited by schard (2025-10-06 06:26:17)


Inofficial first vice president of the Rust Evangelism Strike Force

Online

#8 2025-10-06 09:21:29

ua4000
Member
Registered: 2015-10-14
Posts: 524

Re: SSH service failing to start due to exit-code

gcae wrote:

**note ssh(d) is meant as ssh or sshd, not what I actually input

Weird answer. We are indeed interested in the ***exact*** used command :-)

P.S. You are using Arch Linux and you have installed it with this guide
https://wiki.archlinux.org/title/Installation_guide
?

Offline

#9 2025-10-06 12:24:53

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 68,879

Re: SSH service failing to start due to exit-code

I think the OP just means sth. like

sudo systemctl enable --now ssh{,d}.service

Offline

#10 2025-10-06 21:37:10

gcae
Member
Registered: 2025-07-06
Posts: 7

Re: SSH service failing to start due to exit-code

I am using arch installed normally with the guide.
commands were

 sudo systemctl enable —now sshd.service 

followed by

 sudo systemctl enable —now ssh.service 

I’m trying to type 2 dashes here and my phone won’t let me. I put 2 dashes in the terminal

Last edited by gcae (2025-10-06 21:38:16)

Offline

#11 2025-10-07 08:00:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 68,879

Re: SSH service failing to start due to exit-code

schard wrote:

We can find out:

$ pacman -Qo /etc/systemd/system/ssh.service
$ stat /etc/systemd/system/ssh.service

Offline

#12 2025-10-08 01:41:25

gcae
Member
Registered: 2025-07-06
Posts: 7

Re: SSH service failing to start due to exit-code

pacman -Qo /etc/systemd/system/ssh.service throws the error:

 error: No package owns /etc/systemd/system/ssh.service

stat /etc/systemd/system/ssh.service returns

 File: /etc/systemd/system/ssh.service
  Size: 141             Blocks: 8          IO Block: 4096   regular file
Device: 8,3     Inode: 11796663    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-10-04 17:30:27.795878986 -0400
Modify: 2025-10-04 17:29:31.096997906 -0400
Change: 2025-10-04 17:29:31.096997906 -0400
 Birth: 2025-10-04 16:47:30.868806469 -0400

Offline

#13 2025-10-08 06:47:42

-thc
Member
Registered: 2017-03-15
Posts: 992

Re: SSH service failing to start due to exit-code

Did you create/copy this regular file in/to this directory?

Offline

#14 2025-10-08 06:59:04

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,407
Website

Re: SSH service failing to start due to exit-code

Let's see it.

# cat /etc/systemd/system/ssh.service

And check whether it's enabled:

# systemctl list-unit-files | grep enabled | grep ssh

And then possibly disable it, if it's another SSH daemon service.

# systemctl disable --now ssh.service

Inofficial first vice president of the Rust Evangelism Strike Force

Online

#15 2025-10-10 00:01:40

gcae
Member
Registered: 2025-07-06
Posts: 7

Re: SSH service failing to start due to exit-code

cat /etc/systemd/system/ssh.service responds with

[Unit]
Description=OpenSSH Server
After=network.target
[Service]
Type=notify

ExecStart=/usr/sbin/sshd 
[Install]
WantedBy=multi-user.target

systemctl list-unit-files | grep enabled | grep ssh returns

ssh.service                                                               enabled         disabled
sshd.service                                                              enabled         disabled

Should I disable it, keep it active, or make changes?

Offline

#16 2025-10-10 07:16:14

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,407
Website

Re: SSH service failing to start due to exit-code

Yeah. Disable and remove that weird duplicate:

# systemctl disable --now ssh.service
# rm /etc/systemd/system/ssh.service

Then reboot your machine.


Inofficial first vice president of the Rust Evangelism Strike Force

Online

Board footer

Powered by FluxBB