E:无法纠正问题,您在 Ubuntu 20.04 上尝试安装 wine 时持有损坏的软件包

E:无法纠正问题,您在 Ubuntu 20.04 上尝试安装 wine 时持有损坏的软件包

最近我尝试安装 Wine,但我意外地尝试安装 Jammy 版本,现在,当我尝试此命令时

sudo apt install --install-recommends winehq-staging

我得到这个输出

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-staging : Depends: wine-staging (= 7.6~jammy-1)
E: Unable to correct problems, you have held broken packages.

我该如何解决?我使用 sudo apt update 或 sudo apt upgrade 时没有收到任何错误

sudo apt update

Ign:1 http://packages.linuxmint.com una InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease                         
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:4 http://packages.linuxmint.com una Release                                
Hit:5 https://packages.microsoft.com/ubuntu/21.04/prod hirsute InRelease       
Hit:6 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease      
Hit:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:10 http://ppa.launchpad.net/kisak/kisak-mesa/ubuntu focal InRelease
Hit:11 http://packages.microsoft.com/repos/code stable InRelease
Hit:12 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:13 https://dl.winehq.org/wine-builds/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

如果我尝试取消保留所有保留的包裹,我会得到以下输出

sudo apt-mark unhold $(apt-mark showhold)
E: No packages found

我尝试过这些 aptitude 命令

sudo aptitude install winehq-staging
sudo aptitude -f install winehq-staging

但它们似乎没有解决任何问题, aptitude 所做的操作只是将软件包保留在当前版本。

我下载了 winehq-staging_7.6~focal-1_amd64.deb 并得到了这个输出

sudo dpkg -i --force-all winehq-staging_7.6~focal-1_amd64.deb
Selecting previously unselected package winehq-staging.
(Reading database ... 378899 files and directories currently installed.)
Preparing to unpack winehq-staging_7.6~focal-1_amd64.deb ...
Unpacking winehq-staging (7.6~focal-1) ...
dpkg: winehq-staging: dependency problems, but configuring anyway as you requested:
 winehq-staging depends on wine-staging (= 7.6~focal-1); however:
  Package wine-staging is not installed.

Setting up winehq-staging (7.6~focal-1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...

但 wine 似乎仍然不可用。我尝试使用 Synaptic Package Manager 删除损坏的软件包,第一次尝试无法删除,然后我再次尝试,损坏的软件包似乎已被删除。但我一直得到这个输出

sudo apt install --install-recommends winehq-staging
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5075 (synaptic)       
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-staging : Depends: wine-staging (= 7.6~jammy-1)
E: Unable to correct problems, you have held broken packages.

并且 sudo apt update 一直显示

Hit:10 https://dl.winehq.org/wine-builds/ubuntu jammy InRelease

我刚刚获得了 git 存储库并使用 make 构建了它,似乎解决了这个问题。但我仍然遇到https://dl.winehq.org/wine-builds/ubuntujammy InRelease 系列。

答案1

尝试安装.deb文件winehq-staging

https://pkgs.org/download/winehq-staging

下载后,运行此

sudo dpkg -i --force-all [package_name].deb

这对我有用

答案2

添加宇宙存储库

sudo add-apt-repository universe

然后更新缓存

sudo apt update

最后

sudo apt install wine

相关内容