我收到以下错误:
root@56709:/etc/nginx/conf.d# apt install php7.4-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:
php7.4-dev : Depends: libpcre2-dev (>= 10.30) but it is not going to be installed
Depends: libssl-dev but it is not going to be installed
Depends: php7.4-common (= 7.4.3-4ubuntu2.4) but 7.4.11-6+ubuntu16.04.1+deb.sury.org+1 is to be installed
Recommends: pkg-php-tools but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
运行时有apt install php7.4-dev关于如何修复它的任何想法吗?
我尝试使用 aptitude 而不是 apt,这就是我得到的
root@56709:/etc/nginx/conf.d# sudo aptitude install php7.4-dev
The following NEW packages will be installed:
libpcre2-16-0{a} libpcre2-32-0{a} libpcre2-dev{ab} libpcre2-posix2{a} libssl-dev{ab} php7.4-dev{b} pkg-php-tools{a} shtool{a}
0 packages upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
Need to get 3,295 kB of archives. After unpacking 17.7 MB will be used.
The following packages have unmet dependencies:
php7.4-dev : Depends: php7.4-common (= 7.4.3-4ubuntu2.4) but 7.4.11-6+ubuntu16.04.1+deb.sury.org+1 is installed
libpcre2-dev : Depends: libpcre2-8-0 (= 10.34-7) but 10.35-5+ubuntu16.04.1+deb.sury.org+1 is installed
libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2) but 1.1.1g-1+ubuntu16.04.1+deb.sury.org+1 is installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libpcre2-dev [Not Installed]
2) libssl-dev [Not Installed]
3) php7.4-dev [Not Installed]
Run Code Online (Sandbox Code Playgroud)
我目前使用的是 ubuntu 20.0.4,但如果我看到上面的内容,我想我仍然指的是 16.04 .. 需要以某种方式更新源吗?
小智 5
@Henning Kockerbeck 的解释很棒。这是本博客文章中介绍的两行解决方案
复制粘贴代码以避免将来出现链接失效:
# apt install libssl-dev
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.9) but 1.1.1d-1+ubuntu18.04.1+deb.sury.org+2 is to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
这解释了相互冲突的各个版本,因此您可能必须将包“保留”到看起来apt不是最新版本的特定版本:
# apt-cache policy libssl1.1
libssl1.1:
Installed: 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1
Candidate: 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1
Version table:
*** 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
1.1.1-1ubuntu2.1~18.04.9 500
500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
1.1.0g-2ubuntu4 500
500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)
这将安装特定版本。请记住,这是一个定时炸弹,当您稍后想要升级时,您必须删除该版本的软件包/取消保留它。
# apt install libssl1.1=1.1.1-1ubuntu2.1~18.04.9
Run Code Online (Sandbox Code Playgroud)
现在版本正常,php7.x-dev 将正确安装
# apt-cache policy libssl1.1
libssl1.1:
Installed: 1.1.1-1ubuntu2.1~18.04.9
Candidate: 1.1.1-1ubuntu2.1~18.04.9
Version table:
*** 1.1.1-1ubuntu2.1~18.04.9 500
500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
1.1.0g-2ubuntu4 500
500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)
上面的次要版本可能有所不同,但想法是相同的 - Sury 的软件包导致系统的 libssl 软件包出现问题。必须有其他解决方案来继续使用 Sury 版本的 libssl,毕竟他已经维护这些软件包十年了,这意味着他必须知道自己在做什么,但我不知道这种替代方法的细节。
| 归档时间: |
|
| 查看次数: |
11841 次 |
| 最近记录: |