Ubuntu 18.04。无法安装 libx11-dev。无法纠正问题,您持有损坏的软件包

Ubuntu 18.04。无法安装 libx11-dev。无法纠正问题,您持有损坏的软件包

我正在尝试编译 Aseprite,但无法安装此过程中所需的软件包:libx11-dev。以下是“sudo apt install libx11-dev”的输出

sudo apt install libx11-dev
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:
 libx11-dev : Depends: libx11-6 (= 2:1.6.4-3ubuntu0.1) but 2:1.6.4-3ubuntu0.2 is to be installed
              Depends: libxcb1-dev but it is not going to be installed
              Recommends: libx11-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

有两个未满足的依赖项。接下来我尝试安装第一个依赖项 libx11-6

sudo apt install libx11-6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libx11-6 is already the newest version (2:1.6.4-3ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

如您所见,它已安装,并且是最新版本 2:1.6.4-3ubuntu0.2。这似乎是所需的版本,如您在第一条消息中看到的那样。第二个“未满足”依赖项也发生了类似的问题。

问题似乎是我持有破损的包裹。我尝试了很多方法来解决这个问题,但据我所知,我没有持有任何破损的包裹。当我尝试:

dpkg --get-selections | grep hold

没有输出。同样,“sudo apt install -f”也没有修复任何问题。

以下是可能有帮助的更多输出

cat /etc/apt/sources.list
# deb cdrom:[Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805)]/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu bionic main restricted #Added by software-properties

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

## Major bug fix updates produced after the final release of the
## distribution.
# deb-src http://fi.archive.ubuntu.com/ubuntu/ bionic-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://fi.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://fi.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://fi.archive.ubuntu.com/ubuntu/ bionic-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://fi.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://fi.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://fi.archive.ubuntu.com/ubuntu/ bionic-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-src http://fi.archive.ubuntu.com/ubuntu/ bionic-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 bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner

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

cat /etc/apt/sources.list.d/*
deb http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic main
deb-src http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic main
deb http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic main
deb-src http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic main
deb http://ppa.launchpad.net/jtaylor/keepass/ubuntu bionic main
deb-src http://ppa.launchpad.net/jtaylor/keepass/ubuntu bionic main
deb http://ppa.launchpad.net/jtaylor/keepass/ubuntu bionic main
deb-src http://ppa.launchpad.net/jtaylor/keepass/ubuntu bionic main
deb http://ppa.launchpad.net/libretro/stable/ubuntu bionic main
deb-src http://ppa.launchpad.net/libretro/stable/ubuntu bionic main
deb http://ppa.launchpad.net/libretro/stable/ubuntu bionic main
deb-src http://ppa.launchpad.net/libretro/stable/ubuntu bionic main
deb http://ppa.launchpad.net/pedrocastro/ppa/ubuntu bionic main
deb-src http://ppa.launchpad.net/pedrocastro/ppa/ubuntu bionic main
deb http://ppa.launchpad.net/pedrocastro/ppa/ubuntu bionic main
deb-src http://ppa.launchpad.net/pedrocastro/ppa/ubuntu bionic main

答案1

因此,我通过安装并使用 aptitude 而不是 apt 来安装(sudo aptitude install [packagename])解决了该问题。这将尝试更彻底地解决问题,然后为您提供解决方案。我拒绝了第一个解决方案,下一个建议是降级依赖项。这修复了所有依赖项,并且软件包能够安装。

我仍然不明白为什么这个问题会发生在我的系统上。安装 Nvidia 驱动程序时也会出现这个问题。我不知道这是我的存储库或 ppa 的问题,还是 sources.list 或类似的东西的问题。

相关内容