【问题标题】:libpcre2-dev dependencies unmet problem on UbuntuUbuntu 上的 libpcre2-dev 依赖项未解决问题
【发布时间】:2022-01-04 14:13:50
【问题描述】:

我的问题是我想在 ubuntu 上安装 OwnCloud,长话短说,我不得不将 PHP 从 v8 降级到 v7.2,然后我发现了问题

老实说,我真的不知道确切的问题,但是当我运行升级命令时,例如,我得到了这个错误

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libpcre2-dev : Depends: libpcre2-posix2 (= 10.39-2+ubuntu21.10.1+deb.sury.org+1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

即使我运行 apt --fix-broken install 命令,我也会收到以下消息:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libpcre2-posix3
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libpcre2-posix2
The following NEW packages will be installed:
  libpcre2-posix2
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
12 not fully installed or removed.
Need to get 0 B/8,300 B of archives.
After this operation, 33.8 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 251030 files and directories currently installed.)
Preparing to unpack .../libpcre2-posix2_10.39-2+ubuntu21.10.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre2-posix2:amd64 (10.39-2+ubuntu21.10.1+deb.sury.org+1) ...
dpkg: error processing archive /var/cache/apt/archives/libpcre2-posix2_10.39-2+ubuntu21.10.1+deb.sury.
org+1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libpcre2-posix.so.3', which is also in package libpcre
2-posix3:amd64 10.37-0ubuntu2
Errors were encountered while processing:
 /var/cache/apt/archives/libpcre2-posix2_10.39-2+ubuntu21.10.1+deb.sury.org+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我想解决这个问题,但最重要的是,我想了解更多关于 Linux 的知识,所以任何解释都非常受欢迎。谢谢!

【问题讨论】:

  • 正如文字所说:no longer required: libpcre2-posix3 .......所以请尝试使用sudo apt remove libpcre2-posix3删除
  • 您好,感谢您的回复,但是当我执行命令时,与第一个错误的输出相同

标签: linux ubuntu


【解决方案1】:

我遇到了相反的情况(posix3 而不是 posix2):

The following package was automatically installed and is no longer required:
  libpcre2-posix2
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libpcre2-posix3
The following NEW packages will be installed:
  libpcre2-posix3

这对我有用。 (对你来说是libpcre2-posix3

sudo dpkg --purge libpcre2-posix2
sudo apt --fix-broken install

之后一切都好。

希望这会有所帮助。

【讨论】:

  • 它对我有用,无需升级/降级等+1
【解决方案2】:
我之前想降级 php8.0 -> php7.4 时遇到了同样的问题。

以下命令解决了这个问题:

 srcFile="/etc/apt/sources.list.d/ondrej-ubuntu-php-impish.list"

 sed -i 's/# //g' ${srcFile}
 apt update
 apt autoclean
 apt autoremove -f -y 
 

如果一切顺利,你仍然需要 php7.2,见下图:


  1. 如果你使用的是php-gearman,需要添加ppa:ondrej/pkg-gearman
  2. 如果您使用的是 apache2,建议您添加 ppa:ondrej/apache2
  3. 如果你使用的是nginx,建议添加ppa:ondrej/nginx-mainline

安装php7.2:

 LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php <<< "2"
 apt install php7.2 -y

【讨论】:

    猜你喜欢
    • 2015-04-16
    • 2015-12-13
    • 2021-12-24
    • 1970-01-01
    • 2017-05-20
    • 2020-07-17
    • 1970-01-01
    • 1970-01-01
    • 2019-06-07
    相关资源
    最近更新 更多