錯誤命令行
root@ubuntu:/etc/apt# apt install vim 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: vim : Depends: vim-common (= 2:7.4.052-1ubuntu3.1) but 2:8.0.1453-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.
原因
已有安裝過vim,但沒有安裝成功
解決方案
- 先執行 sudo apt-get remove vim-common 卸載vim-common
- 再進行安裝vim,執 sudo apt-get install vim
舉一反三
執行安裝命令的時候,只要報出類似這樣的錯誤,則需要先remove,然后再次install;下面這個就是 apt-get install openssh-client 報的錯誤,解決方案相同
重點在於: Unable to correct problems, you have held broken packages. ,表示有一個破碎的包
The following packages have unmet dependencies: openssh-server : Depends: openssh-client (= 1:6.6p1-2ubuntu2.13) Recommends: ssh-import-id but it is not going to be installed E: Unable to correct problems, you have held broken packages.