Debian 10 "Buster"アップデート中にsshdをポート2222にバインドする際にエラーが発生しました。

Debian 10 "Buster"アップデート中にsshdをポート2222にバインドする際にエラーが発生しました。

更新すると、次のエラー出力が表示されます。

Errors were encountered while processing: openssh-server ssh E: Sub-process /usr/bin/dpkg returned an error code (1) Setting up openssh-server (1:7.9p1-10+deb10u1) ... rescue-ssh.target is a disabled or a static unit, not starting it. 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 "restart" failed. ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2019-10-14 12:57:57 -03; 7ms ago Docs: man:sshd(8) man:sshd_config(5) Process: 22241 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Process: 22242 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255/EXCEPTION) Main PID: 22242 (code=exited, status=255/EXCEPTION)

Oct 14 12:57:57 wdbuster systemd[1]: Starting OpenBSD Secure Shell server... Oct 14 12:57:57 wdbuster sshd[22242]: error: Bind to port 2222 on 0.0.0.0 failed: Address already in use. dpkg: error processing package openssh-server (--configure): installed openssh-server package post-installation script subprocess returned error exit status 1 dpkg: dependency problems prevent configuration of ssh: ssh depends on openssh-server (>= 1:7.9p1-10+deb10u1); however: Package openssh-server is not configured yet.

dpkg: error processing package ssh (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: openssh-server ssh Press Return to continue, 'q' followed by Return to quit.

これにより、$ sudo dpkg --audit次の出力が返されます。

The following packages have been unpacked but not yet configured. They must be configured using dpkg --configure or the configure menu option in dselect for them to work: ssh secure shell client and server (metapackage)

The following packages are only half configured, probably due to problems configuring them the first time. The configuration should be retried using dpkg --configure <package> or the configure menu option in dselect: openssh-server secure shell (SSH) server, for secure access from remote

また、.NETでは、ポート22が2222に変更されたことも考慮してください/etc/ssh/sshd_config

どんなアイデアがありますか?

答え1

これは次のように実行できます。

$ sudo systemctl disable sshd $ sudo systemctl daemon-reload $ sudo dpkg --configure openssh-server

それではついに

$ systemctl enable sshd

関連情報