如果我尝试使用一个“apt”命令安装多个软件包,则更有可能出现依赖性错误

如果我尝试使用一个“apt”命令安装多个软件包,则更有可能出现依赖性错误

如果我尝试执行此 AIO 命令:

sudo apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --install-recommends build-essential checkinstall ubuntu-restricted-extras libglib2.0-dev libgtk2.0-dev rar zip unzip p7zip p7zip-full gparted hardinfo lprng gimp geany thonny thunderbird birdtray skypeforlinux putty screen net-tools winehq-stable expect ipscan google-chrome-stable teamviewer

apt 返回:

The following packages have unmet dependencies:
 winehq-stable : Depends: wine-stable (= 6.0.0~groovy-1)
E: Unable to correct problems, you have held broken packages.

如果我尝试仅安装该包:

sudo apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --install-recommends winehq-stable

沒有發生錯誤。

为什么?

如何方便地使用单个命令安装所有软件包而不会出现 wineHQ 错误?

更新:

这是 /etc/apt/sources.list:

# deb cdrom:[Ubuntu 20.10 _Groovy Gorilla_ - Release amd64 (20201022)] groovy main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu groovy main restricted
deb-src http://archive.ubuntu.com/ubuntu groovy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu groovy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu groovy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu groovy universe
deb-src http://archive.ubuntu.com/ubuntu groovy universe
deb http://archive.ubuntu.com/ubuntu groovy-updates universe
deb-src http://archive.ubuntu.com/ubuntu groovy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu groovy multiverse
deb-src http://archive.ubuntu.com/ubuntu groovy multiverse
deb http://archive.ubuntu.com/ubuntu groovy-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu groovy-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu groovy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu groovy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu groovy partner
deb-src http://archive.canonical.com/ubuntu groovy partner

deb http://security.ubuntu.com/ubuntu groovy-security main restricted
deb-src http://security.ubuntu.com/ubuntu groovy-security main restricted
deb http://security.ubuntu.com/ubuntu groovy-security universe
deb-src http://security.ubuntu.com/ubuntu groovy-security universe
deb http://security.ubuntu.com/ubuntu groovy-security multiverse
deb-src http://security.ubuntu.com/ubuntu groovy-security multiverse

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

这是 /etc/apt/sources.list.d/angry-ip-scanner.list

deb [trusted=yes] http://ppa.launchpad.net/upubuntu-com/network/ubuntu wily main
deb-src [trusted=yes] http://ppa.launchpad.net/upubuntu-com/network/ubuntu wily main

这是 /etc/apt/sources.list.d/google-chrome.list

deb [signed-by=/usr/share/keyrings/google-archive-keyring.gpg] http://dl.google.com/linux/chrome/deb stable main
deb-src [signed-by=/usr/share/keyrings/google-archive-keyring.gpg] http://dl.google.com/linux/chrome/deb stable main

这是 /etc/apt/sources.list.d/skype-stable.list

deb [signed-by=/usr/share/keyrings/skypeforlinux-archive-keyring.gpg] https://repo.skype.com/deb stable main
deb-src [signed-by=/usr/share/keyrings/skypeforlinux-archive-keyring.gpg] https://repo.skype.com/deb stable main

这是 /etc/apt/sources.list.d/teamviewer.list

deb [signed-by=/usr/share/keyrings/teamviewer-archive-keyring.gpg] http://linux.teamviewer.com/deb stable main
deb-src [signed-by=/usr/share/keyrings/teamviewer-archive-keyring.gpg] http://linux.teamviewer.com/deb stable main

这是 /etc/apt/sources.list.d/winehq.list

deb [signed-by=/usr/share/keyrings/winehq-archive-keyring.gpg] https://dl.winehq.org/wine-builds/ubuntu/ groovy main
deb-src [signed-by=/usr/share/keyrings/winehq-archive-keyring.gpg] https://dl.winehq.org/wine-builds/ubuntu/ groovy main

答案1

您可以通过使用不带额外选项的命令并为您的发行版提供正确的源来解决此问题。您通常会看到无法安装,因为当使用来自两个不同发行版的错误混合源代码行时,此包不可用。大多数情况下,使用较新的版本来获取安装在旧版本上的新更高版本的软件,它永远不会安装。我们需要看到您的/etc/apt/sources.list才能进一步帮助您,一个apt-cache policy winehq-stable和另一个会很好,以及您运行的 Ubuntu 版本,因为错误表明它应该是 20.10 Groovy Gorilla。

答案2

问题在于将“ubuntu restricted-extras”与“winehq”放在同一个“apt”命令中。如果我将它们分开:

sudo apt -y install --install-recommends ubuntu-restricted-extras
sudo apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --install-recommends build-essential checkinstall libglib2.0-dev libgtk2.0-dev rar zip unzip p7zip p7zip-full gparted hardinfo lprng gimp geany thonny thunderbird birdtray skypeforlinux putty screen net-tools winehq-stable expect ipscan google-chrome-stable teamviewer

那么一切正常。

答案3

我已经停止使用 Apt-Get 来安装多个软件包,因为它总是会引起很多问题。我开始使用 sudo dpkg -i,详情如下:

sudo dpkg -i /path/to/packages/*.deb
< all the packages were installed at once... >
< now, the command below is to ensure that no dependency was left behind >
sudo apt-get -f install
< if needed, this will automatically download all dependencies for you >

就应该这样。

现在,如果您需要的是一种在系统中安装 Wine 的特定版本的方法,并且手动执行此操作,而无需处理 Apt-Get 存储库,那么我已在下面为您详细介绍了该过程,该过程是从我发布的另一个答案中复制而来的。

在 Debian/Ubuntu 系统存储库中安装比最新版本更旧或不同的 Wine 版本是一件非常麻烦的事。

计划 B:如果可能的话,考虑转到 Manjaro。为什么?因为 Manjaro 版本的 Wine 软件包捆绑在一个软件包中,您可以使用单个命令安装它:

sudo pacman -U /local_path/wine-staging-5.1-1-x86_64.pkg.tar.zst
or, in the case you miss dependencies..
sudo pacman -Sy /path/wine...
(I think that's the command... I'm not in Manjaro right now,
the Sy command will download the dependencies for you 
WITHOUT performing a full system upgrade, only the packages you need...
pacman -U is the equivalent of sudo dpkg -i , for manual install)

好的。如果您无法转到 Arch/Manjaro,以下是在基于 Debian/Ubuntu 的发行版上手动安装旧版本 Wine 的步骤:

  1. 假设您要安装 Wine 版本 4.1(Wineprefix 大小从 100 MB 直接增加到 600 MB 之前的最后一个 Wine 版本之一,没有任何额外的好处,也没有避免过去 10 年常见的错误...)
    转到https://dl.winehq.org/wine-builds/
    并下载所有名称中包含 4.1 的软件包(它们应该具有相同的日期)

对于 Wine 4.1(我发现的最佳版本),这些就是您需要的软件包。您总共需要五个软件包。

winehq-staging_4.1_buster_amd64.deb
wine-staging_4.1_buster_amd64.deb
wine-staging_4.1_buster_i386.deb
wine-staging-amd64_4.1_buster_amd64.deb
wine-staging-i386_4.1_buster_i386.deb
  1. 安装顺序。这是最棘手的部分,第一次安装后,下次应该会更容易。首先,始终安装最大的 i386 包。然后,安装小的 i386 包。然后,安装大的 amd64 包和小的 amd64 包。最后安装的应该是 winehq(仅以 amd64 格式提供)

下面是我的 bash 历史记录的副本,其中列出了我在最短时间内执行此操作时使用的命令顺序。

sudo dpkg --add-architecture i386
sudo apt-get update
sudo dpkg -i /path/wine-staging-i386_4.1_buster_i386.deb
sudo apt-get install -f
sudo dpkg -i /path/wine-staging_4.1_buster_i386.deb
sudo apt-get install -f
sudo dpkg -i /path/wine-staging-amd64_4.1_buster_amd64.deb
sudo apt-get install -f
sudo dpkg -i /path/wine-staging_4.1_buster_amd64.deb
sudo apt-get install -f
sudo dpkg -i /path/winehq-staging_4.1_buster_amd64.deb
sudo apt-get install -f
sudo apt-get update
...
winecfg    <used to create the initial Wine prefix>
<use these ones below to reassure that you have all libs installed correctly>
...
WINEPREFIX=~/.wine32 WINEARCH=win32 winecfg  <to test if 32-bit is working OK>
WINEPREFIX=~/.wine64 WINEARCH=win64 winecfg  <to test if 64-bit is working OK>
<you should not see errors in the terminal of the type
"but the wrong architecture is being used" >

注意你需要如何运行

sudo apt-get install -f  

每次安装每个软件包时。这将确保在安装下一个软件包之前,安装和配置每个软件包的各个依赖项。(这仅在您第一次执行此操作时才需要……之后,您可以将所有这些依赖项放在备份位置,然后使用 sudo dpkg -i /path/*.deb 一次性安装它们)

  1. 有时,我不明白为什么会发生这种情况,您将无法使用 Wine 64 位,或者您将无法使用 Wine 32 位,两者之一。如果发生这种情况,只需重新安装其中一个大型 Wine 软件包(取决于您是否需要 amd64 或 i386)

    sudo dpkg -i /path/wine-staging-amd64_4.1_buster_amd64.deb

很不幸,Wine 在 Debian/Ubuntu 系统上以这种方式分发,这是一个过于复杂的过程,浪费了大量的时间。Manjaro 的做法应该成为 Wine 从现在开始的官方分发方式。

相关内容