ubuntu 20.04 上的 openssh-server 问题

ubuntu 20.04 上的 openssh-server 问题

我的机器上的 openssh-server 似乎出了问题。我在 Ubuntu 20.04 上。我在尝试安装另一个依赖于 openssh-server 的软件包时注意到了这一点。

当我尝试重新安装时,它说正在配置“部分安装的包”,所以我想我一定是错过了上次升级时这个包发生的某些事情。

andy@andy-UX303UA:~$ sudo aptitude install openssh-server
The following partially installed packages will be configured:
  openssh-server 
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Setting up openssh-server (1:8.2p1-4ubuntu0.2) ...
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; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-26 10:25:29 BST; 9ms ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 45270 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)

May 26 10:25:29 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up openssh-server (1:8.2p1-4ubuntu0.2) ...
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; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-26 10:25:34 BST; 9ms ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 45546 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 openssh-server
                                         
andy@andy-UX303UA:~$ apt-cache policy openssh-server
openssh-server:
  Installed: 1:8.2p1-4ubuntu0.2
  Candidate: 1:8.2p1-4ubuntu0.2
  Version table:
 *** 1:8.2p1-4ubuntu0.2 500
        500 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1:8.2p1-4 500
        500 http://gb.archive.ubuntu.com/ubuntu focal/main amd64 Packages

建议寻找更多详细信息的地方对我来说似乎没有特别有用的信息。

andy@andy-UX303UA:~$ systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-05-26 10:27:27 BST; 7min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 45953 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)

May 26 10:27:26 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.
May 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
May 26 10:27:27 andy-UX303UA systemd[1]: Stopped OpenBSD Secure Shell server.
May 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Start request repeated too quickly.
May 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Failed with result 'exit-code'.
May 26 10:27:27 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.
andy@andy-UX303UA:~$ journalctl -xe
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit ssh.service has finished with a failure.
-- 
-- The job identifier is 17319 and the job result is failed.
May 26 10:36:35 andy-UX303UA update-notifier.desktop[47663]: /var/lib/dpkg/lock:
May 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit ssh.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
May 26 10:36:35 andy-UX303UA systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: A stop job for unit ssh.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit ssh.service has finished.
-- 
-- The job identifier is 17399 and the job result is done.
May 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Start request repeated too quickly.
May 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit ssh.service has entered the 'failed' state with result 'exit-code'.
May 26 10:36:35 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: A start job for unit ssh.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit ssh.service has finished with a failure.
-- 
-- The job identifier is 17399 and the job result is failed.
May 26 10:36:35 andy-UX303UA anacron[46167]: Job `cron.daily' terminated
May 26 10:36:35 andy-UX303UA anacron[46167]: Normal exit (1 job run)
May 26 10:36:35 andy-UX303UA systemd[1]: anacron.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit anacron.service has successfully entered the 'dead' state.
May 26 10:36:36 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null
                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>
                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>
May 26 10:36:37 andy-UX303UA sudo[46492]: pam_unix(sudo:session): session closed for user root
May 26 10:36:41 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null
                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>
                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>
May 26 10:36:46 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null
                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>
                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>
lines 2174-2227/2227 (END)

aptitude remove openssh-server运行并尝试重新安装后,我遇到了同样的错误。有什么想法可以尝试下一步吗?

我的ubuntu版本:

andy@andy-UX303UA:~$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:   focal

答案1

我不知道是否aptitude remove清除了配置,手册页在我看来不太清楚。aptitude remove openssh-server您可以尝试apt-get purge openssh-server重新安装该软件包。

如果这没有帮助,您可以尝试获取有关此错误的更多信息:

dpkg: error processing package openssh-server (--configure):
installed openssh-server package post-installation script subprocess returned error exit status 1

了解安装后脚本失败的原因会很有帮助。在(重新)安装软件包后,您可以运行dpkg-reconfigure openssh-server。我认为这值得一试,因为与使用 aptitude 包装相比,单独执行此步骤可能会提供更多信息。

相关内容