Linux

為什麼安裝 openssh-server 會刪除 openssh-client?

  • March 27, 2016

我在一台裝有 64bit Mint 17.3 Cinnamon 的機器上面臨以下情況:

$ sudo apt-get install openssh-server

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
 openssh-client:i386 openssh-sftp-server
Suggested packages:
 ssh-askpass:i386 libpam-ssh:i386 keychain:i386 monkeysphere:i386 rssh
 molly-guard monkeysphere
Recommended packages:
 ncurses-term ssh-import-id
The following packages will be REMOVED:
 openssh-client
The following NEW packages will be installed:
 openssh-client:i386 openssh-server openssh-sftp-server
0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
Need to get 928 kB of archives.
After this operation, 1 418 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

我不明白為什麼它要刪除 64 位 openssh-client 並安裝 32 位。

/etc/apt/sources.list

#deb cdrom:[Linux Mint 17.3 _Rosa_ - Release amd64 20151115]/ trusty contrib main non-free

/etc/apt/sources.list.d 文件夾包含許多 PPA:

doublecmd.list
esmska.list
getdeb.list
google-chrome.list
graphics-drivers-ppa-trusty.list
inkscape_dev-stable-trusty.list
mono-xamarin.list
nijel-phpmyadmin-trusty.list
n-muench-programs-ppa2-trusty.list
official-package-repositories.list
official-source-repositories.list
ondrej-php-trusty.list
otto-kesselgulasch-gimp-trusty.list
playonlinux.list
spideroakone.list
spotify.list
steam.list
strukturag-libde265-trusty.list
ubuntu-sdk-team-ppa-trusty.list
ubuntu-touch-coreapps-drivers-daily-trusty.list
unit193-encryption-trusty.list
videolan-master-daily-trusty.list
virtualbox.list
wfg-0ad-trusty.list
wine.list

apt-get 更新

Reading package lists... Done  

我看不到任何錯誤。

apt-get -o Debug::pkgProblemResolver=true 安裝 openssh-server

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following extra packages will be installed:
 openssh-client:i386 openssh-sftp-server
Suggested packages:
 ssh-askpass:i386 libpam-ssh:i386 keychain:i386 monkeysphere:i386 rssh
 molly-guard monkeysphere
Recommended packages:
 ncurses-term ssh-import-id
The following packages will be REMOVED:
 openssh-client
The following NEW packages will be installed:
 openssh-client:i386 openssh-server openssh-sftp-server
0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
Need to get 928 kB of archives.
After this operation, 1,418 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort. 

apt-cache 策略 openssh-client openssh-server

openssh-client:
 Installed: 1:6.6p1-2ubuntu2.6
 Candidate: 1:6.6p1-2ubuntu2.6
 Version table:
*** 1:6.6p1-2ubuntu2.6 0
       100 /var/lib/dpkg/status
    1:6.6p1-2ubuntu2.4 0
       500 http://archive.ubuntu.mirror.dkm.cz/ trusty-updates/main amd64 Packages
       500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    1:6.6p1-2ubuntu1 0
       500 http://archive.ubuntu.mirror.dkm.cz/ trusty/main amd64 Packages
openssh-server:
 Installed: (none)
 Candidate: 1:6.6p1-2ubuntu2.4
 Version table:
    1:6.6p1-2ubuntu2.4 0
       500 http://archive.ubuntu.mirror.dkm.cz/ trusty-updates/main amd64 Packages
       500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    1:6.6p1-2ubuntu1 0
       500 http://archive.ubuntu.mirror.dkm.cz/ trusty/main amd64 Packages

根據您的apt-cache policy輸出,您安裝了 openssh-client 1:6.6p1-2ubuntu2.6,但這與任何 url 都不對應,並且版本號與伺服器版本號不同。Debian ssh 軟體包要求客戶端和伺服器版本完全匹配。

所以,很清楚為什麼apt要刪除openssh-client你已經安裝的amd64版本。不太清楚的是為什麼它試圖安裝 i386 版本的openssh-client.

所以,只要做

apt-get purge openssh-client

然後同時安裝openssh-clientopenssh-server

apt-get install openssh-client openssh-server

PS:來自 Julian Andres Klode 的解釋#debian-apt

juliank> faheem:必須降級amd64版本,這是禁止的。但是 :i386 顯然可以滿足對其他架構的依賴(Multi-Arch:foreign),因此它可以安裝它。

滿足對其他架構的依賴似乎有點古怪,但我想 i386 客戶端可能與 amd64 伺服器一起使用。

引用自:https://unix.stackexchange.com/questions/272416