使用 Ubuntu 21.10 并尝试安装 php-dev,获取 libpcre2-dev:依赖:libpcre2-8-0

使用 Ubuntu 21.10 并尝试安装 php-dev,获取 libpcre2-dev:依赖:libpcre2-8-0

有人能帮我吗?我正在尝试使用此命令安装 php-dev sudo apt install php-dev,但出现此错误

The following packages have unmet dependencies:  libpcre2-dev : Depends: libpcre2-8-0 (= 10.37-0ubuntu2) but
10.38-2+ubuntu21.04.1+deb.sury.org+1 is to be installed
                Depends: libpcre2-16-0 (= 10.37-0ubuntu2) but 10.38-2+ubuntu21.04.1+deb.sury.org+1 is to be installed
                Depends: libpcre2-32-0 (= 10.37-0ubuntu2) but 10.38-2+ubuntu21.04.1+deb.sury.org+1 is to be installed E: Unable to correct problems, you have held broken packages.

我尝试过重新安装并再次安装 php,但是没有用。

我正在使用 Ubuntu 21.10

PHP 8.0.8 (cli) (built: Sep 11 2021 04:17:39) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies

apt-cache policy php-dev让我得到这个

php-dev:   Installed: (none)   Candidate: 2:8.0+82~0build1   Version table:
     2:8.0+82~0build1 500
        500 http://bg.archive.ubuntu.com/ubuntu impish/main amd64 Packages
        500 http://bg.archive.ubuntu.com/ubuntu impish/main i386 Packages

输出egrep -r deb /etc/apt/sources.list /etc/apt/sources.list.d

/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish main restricted
/etc/apt/sources.list:deb-src http://bg.archive.ubuntu.com/ubuntu/ impish main universe restricted multiverse #Added by software-properties
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish-updates main restricted
/etc/apt/sources.list:deb-src http://bg.archive.ubuntu.com/ubuntu/ impish-updates main universe restricted multiverse #Added by software-properties
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish universe
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish-updates universe
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish multiverse
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish-updates multiverse
/etc/apt/sources.list:deb http://bg.archive.ubuntu.com/ubuntu/ impish-backports main restricted universe multiverse
/etc/apt/sources.list:deb-src http://bg.archive.ubuntu.com/ubuntu/ impish-backports main restricted universe multiverse #Added by software-properties
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu impish-security main restricted
/etc/apt/sources.list:deb-src http://security.ubuntu.com/ubuntu impish-security main universe restricted multiverse #Added by software-properties
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu impish-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu impish-security multiverse
/etc/apt/sources.list:# (e.g. netinst, live or single CD). The matching "deb cdrom"
/etc/apt/sources.list.d/dart_stable.list.distUpgrade:deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute
/etc/apt/sources.list.d/sublime-text.list.save:deb https://download.sublimetext.com/ apt/stable/ # забранен при надграждане до impish
/etc/apt/sources.list.d/nordvpn.list:deb https://repo.nordvpn.com/deb/nordvpn/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/dropbox.list.distUpgrade:deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu disco main # забранен при надграждане до groovy забранен при надграждане до hirsute
/etc/apt/sources.list.d/dart_stable.list.save:deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/spotify.list.distUpgrade:deb http://repository.spotify.com stable non-free
/etc/apt/sources.list.d/nordvpn.list.save:deb https://repo.nordvpn.com/deb/nordvpn/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/teamviewer.list.dpkg-old:deb http://linux.teamviewer.com/deb stable main # забранен при надграждане до groovy
/etc/apt/sources.list.d/linrunner-ubuntu-tlp-focal.list.distUpgrade:deb http://ppa.launchpad.net/linrunner/tlp/ubuntu focal main
/etc/apt/sources.list.d/archive_uri-https_repo_protonvpn_com_debian-groovy.list.distUpgrade:deb https://repo.protonvpn.com/debian unstable main # забранен при надграждане до hirsute
/etc/apt/sources.list.d/sublime-text.list:deb https://download.sublimetext.com/ apt/stable/ # забранен при надграждане до impish
/etc/apt/sources.list.d/slack.list.distUpgrade:deb https://packagecloud.io/slacktechnologies/slack/debian/ jessie main
/etc/apt/sources.list.d/steam.list.distUpgrade:deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam # забранен при надграждане до groovy забранен при надграждане до hirsute
/etc/apt/sources.list.d/dart_stable.list:deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/nordvpn.list.distUpgrade:deb https://repo.nordvpn.com/deb/nordvpn/debian stable main # забранен при надграждане до groovy забранен при надграждане до hirsute
/etc/apt/sources.list.d/sublime-text.list.distUpgrade:deb https://download.sublimetext.com/ apt/stable/
/etc/apt/sources.list.d/skype-stable.list.distUpgrade:deb [arch=amd64] https://repo.skype.com/deb stable main
/etc/apt/sources.list.d/google-chrome.list.distUpgrade:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # забранен при надграждане до groovy забранен при надграждане до hirsute
/etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-groovy.list.distUpgrade:deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu/ hirsute main # забранен при надграждане до hirsute
/etc/apt/sources.list.d/dropbox.list:deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu disco main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/spotify.list.save:deb http://repository.spotify.com stable non-free # забранен при надграждане до impish
/etc/apt/sources.list.d/git-core-ubuntu-ppa-groovy.list.distUpgrade:deb http://ppa.launchpad.net/git-core/ppa/ubuntu/ hirsute main # забранен при надграждане до hirsute
/etc/apt/sources.list.d/google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/spotify.list:deb http://repository.spotify.com stable non-free # забранен при надграждане до impish
/etc/apt/sources.list.d/ondrej-ubuntu-php-hirsute.list.distUpgrade:deb http://ppa.launchpad.net/ondrej/php/ubuntu/ hirsute main
/etc/apt/sources.list.d/ondrej-ubuntu-php-hirsute.list.distUpgrade:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu/ hirsute main
/etc/apt/sources.list.d/google-chrome.list.save:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/slack.list:deb https://packagecloud.io/slacktechnologies/slack/debian/ jessie main # забранен при надграждане до impish
/etc/apt/sources.list.d/slack.list.save:deb https://packagecloud.io/slacktechnologies/slack/debian/ jessie main # забранен при надграждане до impish
/etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-hirsute.list.distUpgrade:deb http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/ hirsute main
/etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-hirsute.list.distUpgrade:# deb-src http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/ hirsute main
/etc/apt/sources.list.d/dropbox.list.save:deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu disco main # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/steam.list:deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish
/etc/apt/sources.list.d/steam.list.save:deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam # забранен при надграждане до groovy забранен при надграждане до hirsute забранен при надграждане до impish

答案1

我们可以使用 apt pinning 从 ubuntu 源中恢复较新的 ppa 软件包。

sudo apt install  apt-show-versions

要确定涉及的包数,请运行

 apt-show-versions | fgrep newer

如果列出的软件包不多,那么您就有很好的机会修复损坏的依赖关系。

社区维基

您可以从输出中获得正确的值

apt-cache policy

注意:首先进行备份并绘制 iso,以便进行全新安装。apt pinning 是纠正问题的最后手段。它可以工作,但不能保证

相关内容