apt-get 依赖问题 Open-SSH 客户端

apt-get 依赖问题 Open-SSH 客户端

这是在 Ubuntu 12.04 服务器上。

apt-get install当我尝试运行任何(尝试安装不相关的任意包)时出现此错误:

dpkg: dependency problems prevent configuration of openssh-server:
 openssh-server depends on openssh-client (= 1:5.9p1-5ubuntu1.1); however:
  Version of openssh-client on system is 1:5.9p1-5ubuntu1.4.
dpkg: error processing openssh-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency probms prevent configuration of ssh:
 ssh depends on openssh-server; however:
  Package openssh-server is not configured yet.
dpkg: error processing ssh (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encounter while processing:
 openssh-server
 ssh
E: Sub-process /usr/bin/dpkg returned an error code (1)

安装有问题的客户端版本会导致:

sudo apt-get install openssh-client=1:5.9p1-5ubuntu1.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '1:5.9p1-5ubuntu1.1' for 'openssh-client' was not found

由于缺乏背景知识,各种修复尝试都失败了,例如

dpkg-reconfigure -a
apt-get -f install

有人可以提供建议如何解决这个问题,可能需要我提供更多必要的信息?

如何恢复或取消 openssh 更新(我猜是失败了),以便我能够安装其他软件包?

编辑:

的输出apt-cache policy openssh-client为:

openssh-client:
  Installed: 1:5.9p1-5ubuntu1.4
  Candidate: 1:5.9p1-5ubuntu1.4
  Version table:
 *** 1:5.9p1-5ubuntu1.4 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:5.9p1-5ubuntu1.3 0
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     1:5.9p1-5ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

只是为了完整性/etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse

答案1

只需删除这些包即可使用apt其他包。在终端中执行此命令。

sudo apt-get remove openssh-server openssh-client --purge && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get update

然后重新安装 openssh 服务器和客户端。

sudo apt-get install openssh-server openssh-client

答案2

当无法删除/清除 openssh-server 和 openssh-client 时(例如当另一个包依赖于它们时)

这对我来说很有效:

sudo dpkg -i /var/cache/apt/archives/openssh-*.deb
sudo dpkg --configure -a

相关内容