cant update after configure of opensshserver

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
User avatar
sessho
Posts: 6
Joined: Fri Aug 31, 2018 10:09 pm

cant update after configure of opensshserver

Post by sessho »

Hello all ! I have really trouble upgrading my dietpi client and i really need your help . Some days ago i had install manually open ssh server , change permissions and add the authorized keys. All good ,, now i m able to connect through my computer without problem and without digit any pass. The problem although that i have now is that i cant update at all the dietpi client. I got an error "

Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.
invoke-rc.d: initscript ssh, action "start" failed.
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-08-31 22:02:23 CEST; 30ms ago
Process: 6971 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Process: 6967 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 6971 (code=exited, status=255)

Aug 31 22:02:23 DietPi systemd[1]: Starting OpenBSD Secure Shell server...
Aug 31 22:02:23 DietPi sshd[6971]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Aug 31 22:02:23 DietPi systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Aug 31 22:02:23 DietPi systemd[1]: Failed to start OpenBSD Secure Shell server.
Aug 31 22:02:23 DietPi systemd[1]: ssh.service: Unit entered failed state.
Aug 31 22:02:23 DietPi systemd[1]: ssh.service: Failed with result 'exit-code'.
dpkg: error processing package openssh-server (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

"
What can i do ? i suppose i modify the initial image and it cannot upgrade now ?

I really cant reinstall from the beginning everything , is something i can do ?Thanx in advance for any help !
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: cant update after configure of opensshserver

Post by MichaIng »

error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Is dropbear still installed?
User avatar
sessho
Posts: 6
Joined: Fri Aug 31, 2018 10:09 pm

Re: cant update after configure of opensshserver

Post by sessho »

10000x tnx ! Tried to uninstall dropbear (as it was by default selected on the graphical interface) through software update but was constantly failing so i apt-get purged it and all works ! updated now without problem ! thanx one more time !
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: cant update after configure of opensshserver

Post by MichaIng »

Great that it works 8).

Hmm, selecting OpenSSH within dietpi-software (and then select "Install") should work as well.

If you set up a new image, changing the related entry in dietpi.txt before booting the first time should work as well.

If one of the above didn't work for you, I will try to replicate/sync.
smeech
Posts: 1
Joined: Sat Dec 29, 2018 3:36 pm

Re: cant update after configure of opensshserver

Post by smeech »

I had a similar port 22 binding problem trying to install OpenSSH over dropbear on an up and running DietPi. I tried all the above without success until I issued a "sudo killall dropbear" before successfully trying again.
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: cant update after configure of opensshserver

Post by MichaIng »

Hey guys,

strange that you face port 22 binding issues. Is/was this still the case with current DietPi v6.19?

We already stop Dropbear and OpenSSH services when SSH server choice changes, however it does not break the current SSH session.

I made some tests: https://github.com/Fourdee/DietPi/issues/2375

Tried to switch SSH server multiple times in both directions on Jessie and Stretch system and with active SSH session and never faced this issue. However I fixed/tuned some other parts of our SSH server setup I recognized during testing intensively, but those are not related to a port bind issue.

Might I ask which device you use, Raspbian or Debian repo? I tested on Debian VM, but perhaps on Raspbian, or on certain devices, port bindings are somehow handled differently.

Could be failsafe to uninstall and kill active SSH server/process before installing the new one, but of course this would make it impossible to do this on an active SSH session, so breaks the switch for headless devices (without HDMI/keyboard port) at all.
Post Reply