当我尝试在 Ubuntu 20.04.2 LTS 上安装 wine 时,出现此错误:
jayden@UbuntuInstall:~$ sudo apt install --install-recommends winehq-stable
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:
winehq-stable : Depends: wine-stable (= 6.0.1~hirsute-1)
E: Unable to correct problems, you have held broken packages.
我尝试安装此依赖项,然后出现另一个错误,提示我需要更多依赖项。
jayden@UbuntuInstall:~$ sudo apt install wine-stable
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:
wine-stable : Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
Depends: wine-stable-i386 (= 6.0.1~hirsute-1)
Depends: wine-stable-amd64 (= 6.0.1~hirsute-1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
当我深入研究它时,我不断收到更多缺失依赖项错误。我也不知道如何删除损坏的软件包,因为我尝试过的所有方法都没有用。
我不知道如何获取适用于 20.04 的旧版本 wine,因为这可能是问题所在。
有谁知道我该如何解决这个问题。
答案1
为了从 WineHQ 安装 Wine,您需要按照以下说明进行操作https://wiki.winehq.org/Ubuntu。
您需要确保添加正确系统版本的 repo,这似乎是您的问题所在。查看 中的文件/etc/apt/sources.list.d/
,找到一个包含 Wine repo 的文件,并将其中所有出现的 替换为 (hirsute
对于focal
您的 Ubuntu 20.04)(您可以使用命令 验证您正在使用的版本的名称lsb_release --codename
)。
除此之外,请确保您执行以下操作:
sudo apt update && sudo apt upgrade
在安装任何新软件包之前,确保过时的软件包不会在安装新软件包时引起任何问题。例如,新软件包的依赖项可能会引用依赖项的新版本,如果apt
不更新,则无法知道这些依赖项,从而导致相同的错误。
答案2
似乎您安装了错误的存储库。首先您需要删除它,然后安装正确的存储库。首先在终端中打开您的存储库列表:
sudo nano /etc/apt/sources.list
向下滚动页面以找到以下代码行或类似代码:
deb https://dl.winehq.org/wine-builds/ubuntu/ focal main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ focal main
就你的情况而言,可能你安装了“hirsute main”。在这种情况下,你需要删除两行并保存(ctrl+s)列表并退出(ctrl+x)。此外,如果你安装了其他版本,它们也会在那里。如果是这样,请保留正确的行并删除其他行。如果你没有安装其他版本,只需运行正确的代码。例如:(针对焦点版本)
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
更新包:
sudo apt update
然后安装 wine:
sudo apt install --install-recommends winehq-stable