ubuntu 20.04 上 openssh-server 的问题

ASe*_*ton 5 ssh openssh

我的机器上的 openssh-server 似乎出了问题。我使用的是 Ubuntu 20.04。\n我注意到它试图安装另一个依赖于 openssh-server 的软件包。

\n

当我尝试重新安装时,它说它正在配置“部分安装的软件包”,所以我想我一定在之前的升级中错过了该软件包发生的事情。

\n
andy@andy-UX303UA:~$ sudo aptitude install openssh-server\nThe following partially installed packages will be configured:\n  openssh-server \nNo packages will be installed, upgraded, or removed.\n0 packages upgraded, 0 newly installed, 0 to remove and 20 not upgraded.\nNeed to get 0 B of archives. After unpacking 0 B will be used.\nSetting up openssh-server (1:8.2p1-4ubuntu0.2) ...\nrescue-ssh.target is a disabled or a static unit, not starting it.\nJob for ssh.service failed because the control process exited with error code.\nSee "systemctl status ssh.service" and "journalctl -xe" for details.\ninvoke-rc.d: initscript ssh, action "restart" failed.\n\xe2\x97\x8f ssh.service - OpenBSD Secure Shell server\n     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)\n     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-26 10:25:29 BST; 9ms ago\n       Docs: man:sshd(8)\n             man:sshd_config(5)\n    Process: 45270 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)\n\nMay 26 10:25:29 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.\ndpkg: error processing package openssh-server (--configure):\n installed openssh-server package post-installation script subprocess returned error exit status 1\nErrors were encountered while processing:\n openssh-server\nE: Sub-process /usr/bin/dpkg returned an error code (1)\nSetting up openssh-server (1:8.2p1-4ubuntu0.2) ...\nrescue-ssh.target is a disabled or a static unit, not starting it.\nJob for ssh.service failed because the control process exited with error code.\nSee "systemctl status ssh.service" and "journalctl -xe" for details.\ninvoke-rc.d: initscript ssh, action "restart" failed.\n\xe2\x97\x8f ssh.service - OpenBSD Secure Shell server\n     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)\n     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-26 10:25:34 BST; 9ms ago\n       Docs: man:sshd(8)\n             man:sshd_config(5)\n    Process: 45546 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)\ndpkg: error processing package openssh-server (--configure):\n installed openssh-server package post-installation script subprocess returned error exit status 1\nErrors were encountered while processing:\n openssh-server\n                                         \nandy@andy-UX303UA:~$ apt-cache policy openssh-server\nopenssh-server:\n  Installed: 1:8.2p1-4ubuntu0.2\n  Candidate: 1:8.2p1-4ubuntu0.2\n  Version table:\n *** 1:8.2p1-4ubuntu0.2 500\n        500 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages\n        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages\n        100 /var/lib/dpkg/status\n     1:8.2p1-4 500\n        500 http://gb.archive.ubuntu.com/ubuntu focal/main amd64 Packages\n\n
Run Code Online (Sandbox Code Playgroud)\n

对于我来说,建议的寻找更多细节的地方似乎并没有提供特别的信息。

\n
andy@andy-UX303UA:~$ systemctl status ssh.service\n\xe2\x97\x8f ssh.service - OpenBSD Secure Shell server\n     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)\n     Active: failed (Result: exit-code) since Wed 2021-05-26 10:27:27 BST; 7min ago\n       Docs: man:sshd(8)\n             man:sshd_config(5)\n    Process: 45953 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)\n\nMay 26 10:27:26 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.\nMay 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.\nMay 26 10:27:27 andy-UX303UA systemd[1]: Stopped OpenBSD Secure Shell server.\nMay 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Start request repeated too quickly.\nMay 26 10:27:27 andy-UX303UA systemd[1]: ssh.service: Failed with result 'exit-code'.\nMay 26 10:27:27 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.\n
Run Code Online (Sandbox Code Playgroud)\n
andy@andy-UX303UA:~$ journalctl -xe\n-- Support: http://www.ubuntu.com/support\n-- \n-- A start job for unit ssh.service has finished with a failure.\n-- \n-- The job identifier is 17319 and the job result is failed.\nMay 26 10:36:35 andy-UX303UA update-notifier.desktop[47663]: /var/lib/dpkg/lock:\nMay 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.\n-- Subject: Automatic restarting of a unit has been scheduled\n-- Defined-By: systemd\n-- Support: http://www.ubuntu.com/support\n-- \n-- Automatic restarting of the unit ssh.service has been scheduled, as the result for\n-- the configured Restart= setting for the unit.\nMay 26 10:36:35 andy-UX303UA systemd[1]: Stopped OpenBSD Secure Shell server.\n-- Subject: A stop job for unit ssh.service has finished\n-- Defined-By: systemd\n-- Support: http://www.ubuntu.com/support\n-- \n-- A stop job for unit ssh.service has finished.\n-- \n-- The job identifier is 17399 and the job result is done.\nMay 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Start request repeated too quickly.\nMay 26 10:36:35 andy-UX303UA systemd[1]: ssh.service: Failed with result 'exit-code'.\n-- Subject: Unit failed\n-- Defined-By: systemd\n-- Support: http://www.ubuntu.com/support\n-- \n-- The unit ssh.service has entered the 'failed' state with result 'exit-code'.\nMay 26 10:36:35 andy-UX303UA systemd[1]: Failed to start OpenBSD Secure Shell server.\n-- Subject: A start job for unit ssh.service has failed\n-- Defined-By: systemd\n-- Support: http://www.ubuntu.com/support\n-- \n-- A start job for unit ssh.service has finished with a failure.\n-- \n-- The job identifier is 17399 and the job result is failed.\nMay 26 10:36:35 andy-UX303UA anacron[46167]: Job `cron.daily' terminated\nMay 26 10:36:35 andy-UX303UA anacron[46167]: Normal exit (1 job run)\nMay 26 10:36:35 andy-UX303UA systemd[1]: anacron.service: Succeeded.\n-- Subject: Unit succeeded\n-- Defined-By: systemd\n-- Support: http://www.ubuntu.com/support\n-- \n-- The unit anacron.service has successfully entered the 'dead' state.\nMay 26 10:36:36 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null\n                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>\n                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>\nMay 26 10:36:37 andy-UX303UA sudo[46492]: pam_unix(sudo:session): session closed for user root\nMay 26 10:36:41 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null\n                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>\n                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>\nMay 26 10:36:46 andy-UX303UA gnome-shell[1916]: JS ERROR: TypeError: windowActor is null\n                                                _addWindowEffect@resource:///org/gnome/shell/ui/clos>\n                                                vfunc_show@resource:///org/gnome/shell/ui/closeDialo>\nlines 2174-2227/2227 (END)\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n

我的ubuntu版本:

\n
andy@andy-UX303UA:~$ lsb_release -a\nLSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch\nDistributor ID: Ubuntu\nDescription:    Ubuntu 20.04.2 LTS\nRelease:    20.04\nCodename:   focal\n\n
Run Code Online (Sandbox Code Playgroud)\n

She*_*don 3

我不知道是否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
Run Code Online (Sandbox Code Playgroud)

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