我已经用尽了在网上找到的所有方法来尝试修复 ubuntu 22.04 上的问题
#apt install libpcre2-dev
The following packages have unmet dependencies:
libpcre2-dev : Depends: libpcre2-8-0 (= 10.39-3ubuntu0.1) but 10.40-1+ubuntu21.10.1+deb.sury.org+1 is to be installed
Depends: libpcre2-16-0 (= 10.39-3ubuntu0.1) but 10.40-1+ubuntu21.10.1+deb.sury.org+1 is to be installed
Depends: libpcre2-32-0 (= 10.39-3ubuntu0.1) but 10.40-1+ubuntu21.10.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
显然,问题是由于 21.10 中的 dist-upgrade 问题造成的。
到目前为止我已经尝试过:
apt upgrade
apt install -f libpcre2-dev
apt autoclean
apt --fix-broken install
以下是输出
apt-cache policy libpcre2-8-0
libpcre2-8-0:
Installed: 10.40-1+ubuntu21.10.1+deb.sury.org+1
Candidate: 10.40-1+ubuntu21.10.1+deb.sury.org+1
Version table:
*** 10.40-1+ubuntu21.10.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
10.39-3ubuntu0.1 500
500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
10.39-3build1 500
500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
我不确定如何使用……?
答案1
最终我通过以下方式解决了这个问题:
- 已安装 apptitude
sudo apt install aptitude
- 然后
aptitude install libpcre2-dev
- 不接受默认选项以保留现有,选择 N
- 接受降级解决方案
以下操作将解决这些依赖关系:
Downgrade the following packages:
1) libpcre2-16-0 [10.40-1+ubuntu21.10.1+deb.sury.org+1 (now) -> 10.39-3ubuntu0.1 (jammy-security, jammy-updates)]
2) libpcre2-16-0:i386 [10.40-1+ubuntu21.10.1+deb.sury.org+1 (now) -> 10.39-3ubuntu0.1 (jammy-security, jammy-updates)]
3) libpcre2-32-0 [10.40-1+ubuntu21.10.1+deb.sury.org+1 (now) -> 10.39-3ubuntu0.1 (jammy-security, jammy-updates)]
4) libpcre2-8-0 [10.40-1+ubuntu21.10.1+deb.sury.org+1 (now) -> 10.39-3ubuntu0.1 (jammy-security, jammy-updates)]
5) libpcre2-8-0:i386 [10.40-1+ubuntu21.10.1+deb.sury.org+1 (now) -> 10.39-3ubuntu0.1 (jammy-security, jammy-updates)]
Accept this solution? [Y/n/q/?] Y