我正在尝试安装更新。
当我输入命令 apt update && apt upgrade -y 时出现以下情况......
root@ubuntu18:~# apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libpcre2-dev : Depends: libpcre2-posix3 (= 10.39-3+ubuntu18.04.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
Reading state information... Done
Correcting dependencies... Done
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
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
9 not fully installed or removed.
Need to get 8056 B of archives.
After this operation, 30.7 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libpcre2-posix3 amd64 10.39-3+ubuntu18.04.1+deb.sury.org+1 [8056 B]
Fetched 8056 B in 0s (53.0 kB/s)
(Reading database ... 133359 files and directories currently installed.)
Preparing to unpack .../libpcre2-posix3_10.39-3+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre2-posix3:amd64 (10.39-3+ubuntu18.04.1+deb.sury.org+1) ...
dpkg: error processing archive /var/cache/apt/archives/libpcre2-posix3_10.39-3+ubuntu18.04.1+deb.sury.org+1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libpcre2-posix.so.3.0.1', which is also in package libpcre2-posix2:amd64 10.39-2+ubuntu18.04.1+deb.sury.org+1
Errors were encountered while processing:
/var/cache/apt/archives/libpcre2-posix3_10.39-3+ubuntu18.04.1+deb.sury.org+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
你可以重试“apt --fix-broken install & apt upgrade”来解决这个问题