当我执行' sudo apt-get install -f '时,遇到如下错误

当我执行' sudo apt-get install -f '时,遇到如下错误
Errors were encountered while processing:
     /var/cache/apt/archives/openssh-client_1%3a6.6p1-2ubuntu2.10_amd64.deb
     /var/cache/apt/archives/openssh-server_1%3a6.6p1-2ubuntu2.10_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

当我这样做时sudo apt-get install openssh-client=1:6.6p1-2ubuntu2.10,我遇到了另一个错误:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 ssh : Depends: openssh-server (>= 1:6.6p1-2ubuntu2.10)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

打开终端并输入:

cd /var/cache/apt/archives/  
sudo rm openssh-client_1%3a6.6p1-2ubuntu2.10_amd64.deb openssh-server_1%3a6.6p1-2ubuntu2.10_amd64.deb  
sudo apt update     
sudo apt install openssh-client  

sudo apt install openssh-client或者,您可以用替换该命令sudo apt install sshssh它是一个安装安全外壳客户端和服务器的元包。

答案2

首先获取 root 权限:

sudo su

接下来做:

 lsattr /usr/bin/ssh

删除 ia:

chattr -i /usr/bin/ssh 
chattr -a /usr/bin/ssh

修复依赖项

apt-get -f install

安装 Openssh-client

apt-get install openssh-client

接下来

lsattr /usr/sbin/sshd

删除 ia:

chattr -i /usr/sbin/sshd 
chattr -a /usr/sbin/sshd

更新资质

apt-get update

安装 Openssh-client

apt-get install openssh-server

相关内容