[SOLVED] Why do I have sshd & ssh.service on my DietPi, which one can I get rid of?

Hi,

I’m trying to install LXDE on my DietPi for remote control with x2goserver but I got the following screen:

┌───────────────────────────────┤ DietPi Error Handler: ├────────────────────────────────┐                                   
                                  │ DietPi-Software: G_AGUG                                                                                                    
                                  │  - Exit code: 100                                                                                                          
                                  │  - DietPi version: v6.26.3 (MichaIng/master) | HW_MODEL:3 | HW_ARCH:2 | DISTRO:5                                           
                                  │  - Image creator: DietPi Core Team                                                                                         
                                  │  - Pre-image: Raspbian Lite                                                                                                
                                  │                                                                                                                            
                                  │ Log file content:                                                                                                          
                                  │ Setting up openssh-server (1:7.9p1-10+deb10u1) ...^M                                                                       
                                  │ rescue-ssh.target is a disabled or a static unit, not starting it.^M                                                       
                                  │ Job for ssh.service failed because the control process exited with error code.^M                                           
                                  │ See "systemctl status ssh.service" and "journalctl -xe" for details.^M                                                     
                                  │ invoke-rc.d: initscript ssh, action "start" failed.^M                                                                      
                                  │ ^[[0;1;31m●^[[0m ssh.service - OpenBSD Secure Shell server^M                                                               
                                  │    Loaded: loaded                                                                                                          
                                  │                                                                                                                            
                                  │           Retry         : Re-run the last command that failed                                                              
                                  │           DietPi-Config : Edit network, APT/NTP mirror settings etc                                                        
                                  │           Send report   : Uploads bugreport containing system info to DietPi                                               
                                  │                                                                                                                            
                                  │                                                                                                                            
                                  │                        <Ok>                            <Exit>                                                              
                                  │                                                                                        │                                   
                                  └────────────────────────────────────────────────────────────────────────────────────────┘

and systemctl status ssh.service gives me:

root@DietPi:~# systemctl status ssh.service 
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
led)
   Active: failed (Result: exit-code) since Sun 2019-12-01 04:34:34 G
MT; 8min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 3413 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 3414 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, sta
tus=255/EXCEPTION)
 Main PID: 3414 (code=exited, status=255/EXCEPTION)

Dec 01 04:34:34 DietPi systemd[1]: Starting OpenBSD Secure Shell server...
Dec 01 04:34:34 DietPi sshd[3414]: error: Bind to port 2
2 on 0.0.0.0 failed: Address already in use.
Dec 01 04:34:34 DietPi sshd[3414]: error: Bind to port 2
2 on :: failed: Address already in use.
Dec 01 04:34:34 DietPi sshd[3414]: fatal: Cannot bind an
y address.
Dec 01 04:34:34 DietPi systemd[1]: ssh.service: Main pro
cess exited, code=exited, status=255/EXCEPTION
Dec 01 04:34:34 DietPi systemd[1]: ssh.service: Failed w
ith result 'exit-code'.

I wonder wht it’s talking about OpenBSD ssh, is that expected?
It binds port 22 which might fail because I’m logged in by ssh …
then there’s this too

root@DietPi:~# systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-12-01 04:34:34 GMT; 11min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 3413 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 3414 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255/EXCEPTION)
 Main PID: 3414 (code=exited, status=255/EXCEPTION)

Dec 01 04:34:34 DietPi systemd[1]: Starting OpenBSD Secure Shell server...
Dec 01 04:34:34 DietPi sshd[3414]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Dec 01 04:34:34 DietPi sshd[3414]: error: Bind to port 22 on :: failed: Address already in use.
Dec 01 04:34:34 DietPi sshd[3414]: fatal: Cannot bind any address.
Dec 01 04:34:34 DietPi systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
Dec 01 04:34:34 DietPi systemd[1]: ssh.service: Failed with result 'exit-code'.
Dec 01 04:34:34 DietPi systemd[1]: Failed to start OpenBSD Secure Shell server.
root@DietPi:~#

sshd is what I’d expect, rather then OpenBSD ssh…
it seems like ssh.service is conflicting with sshd… how do I best fix this? I don’t really want to lose the ability to ssh into the Pi
In intended to install autossh and have a permanent reverse tunnel to a relay server in the cloud. But this needs toi be fixed first I would think.

Thanks!

Disabled sshd with systemctl, rebooted purged sshd and things look to be back in order now… :slight_smile: