无法在 debian 10.4 上安装 sshd(openssh-server)

无法在 debian 10.4 上安装 sshd(openssh-server)

这是 Debian-10.4 的全新安装。sources.list 文件如下:

# deb cdrom:[Debian GNU/Linux 10.4.0巴斯特- 官方 amd64 DVD Binary-1 20200 0509-10:26]/ buster contrib main

deb http://security.debian.org/debian-security buster/updates main contrib
deb-src http://security.debian.org/debian-security buster/updates main contrib

# buster-updates, previously known as 'volatile'
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
deb http://deb.debian.org/debian/ buster-updates main contrib
deb-src http://deb.debian.org/debian/ buster-updates main contrib

当我尝试安装 sshd (openssh-serverr) 时,出现以下信息:

[root@smb4-a ~]# apt install -f openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openssh-server : Depends: openssh-client (= 1:7.9p1-10+deb10u1) but 1:7.9p1-10+deb10u2 is to be installed
                  Depends: openssh-sftp-server but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我甚至不会去想象哪种发行版不提供安全远程访问作为基本安装的一部分。无论原因是什么,Debian 的情况都是如此,而我需要这样的。问题似乎是这样的:

 openssh-server : Depends: openssh-client (= 1:7.9p1-10+deb10u1) but 1:7.9p1-10+deb10u2 is to be installed

如何强制安装损坏的依赖项?

更多信息:

[root@smb4-a ~]# apt-get update
Get:1 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Get:3 http://deb.debian.org/debian buster-updates/main Sources [3,088 B]
Get:4 http://deb.debian.org/debian buster-updates/main amd64 Packages [7,380 B]
Get:5 http://deb.debian.org/debian buster-updates/main Translation-en [5,166 B]
Fetched 64.9 kB in 0s (358 kB/s)           
Reading package lists... Done
[root@smb4-a ~]# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

更多信息:

# apt policy openssh-*
openssh-sftp-server:
  Installed: (none)
  Candidate: 1:7.9p1-10+deb10u1
  Version table:
     1:7.9p1-10+deb10u1 500
        500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
openssh-tests:
  Installed: (none)
  Candidate: 1:7.9p1-10+deb10u1
  Version table:
     1:7.9p1-10+deb10u1 500
        500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
openssh-server:
  Installed: (none)
  Candidate: 1:7.9p1-10+deb10u1
  Version table:
     1:7.9p1-10+deb10u1 500
        500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
openssh-client:
  Installed: 1:7.9p1-10+deb10u2
  Candidate: 1:7.9p1-10+deb10u2
  Version table:
 *** 1:7.9p1-10+deb10u2 100
        100 /var/lib/dpkg/status
     1:7.9p1-10+deb10u1 500
        500 http://security.debian.org/debian-security buster/updates/main amd64 Packages

答案1

似乎在安装过程中,您对“使用网络镜像吗?”这个问题回答了“否”,因此您的系统配置为没有镜像(或者您在安装过程中可能没有网络连接)。顺便说一句,您的 sources.list 表明了这一点:

# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.

因此,现在您有一个不完整的sources.list,其中包含更新和安全修复,但不包含基本系统。我不知道 DVD 行是如何从您的 中删除的sources.list,因为如果没有网络镜像,安装程序不会将其删除。

您必须配置镜像才能正确安装软件包。将此行添加到您的sources.list

deb http://ftp.us.debian.org/debian/ buster main contrib non-free

并运行apt update。之后,您就可以安装openssh-server

您可能希望将镜像切换到离您更近的镜像,这可以通过更改usURL 的一部分以对应您的国家/地区或提供不同的镜像来实现。镜像站点列表可用这里

或者,您可以安装该netselect-apt软件包,它将搜索您附近最快的镜像。

附注:Debian 确实提供了一个安全的远程 shell,您所要做的就是在安装过程中在“软件选择”页面上勾选“SSH 服务器”(为什么默认情况下不选择它我不知道,但仍然)。

答案2

echo "deb http://deb.debian.org/debian/ buster-updates main contrib" >> /etc/apt/sources.list

相关内容