我对 Linux/命令行的东西还很陌生,所以请原谅我的无知。
每次我尝试使用安装任何东西时,sudo apt-get install ...
都会出现依赖性错误。我试图在我的计算机上安装 OpenSSH Server 和 GitLab,每当我输入命令时,我似乎都会收到如下依赖性错误:
sudo apt-get install openssh-server
reading package lists... 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: libwrap0 (>= 7.6-4~) but it is not installable
Recommends: ssh-import-id but it is not installable
E: Unable to correct problems, you have held broken packages.
无论我尝试安装什么,似乎都会出现类似的错误。例如,使用sudo apt-get install git
,错误变为:
The following packages have unmet dependencies:
git : Depends: liberror-perl but it is not installable
E: Unable to correct problems, you have held broken packages
我正在运行 Ubuntu Server 12.04 LTS x86。我尝试过sudo apt-get clean
、、和其他类似的事情。我试过重启sudo apt-get autoclean
,sudo apt-get update
见鬼,我甚至清空了服务器并从头开始,但还是出现同样的问题。我确信我做错了什么,但我似乎无法找到原因。如果有人能帮忙,那就太好了。
更新:我确实通过全新安装服务器并在设置过程中选择 OpenSSH 使 OpenSSH 正常工作。
我发现关于 apt-get 的维基百科所以我尝试这样做sudo apt-get build-dep git
并收到错误:
E: Build-Depends-Indep dependency for git cannot be satisfied because package asciidoc has no candidate version
我不知道这是否有助于确定正在发生的事情。
答案1
要解决该问题,需要执行以下步骤:
- sudo apt-get 更新
- sudo apt-get 安装 -f
- sudo rm -rf /var/lib/apt/lists/*
- sudo apt-get 更新