Reputation: 93
My problem is that I wanted to install OwnCloud on ubuntu, and long story short, I had to downgrade PHP from v8 to v7.2 and I found problems
Honestly, I don't really know the problem exactly but when I run the upgrade command, for example, I get this error
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).
Even when I run the apt --fix-broken install command, I get this message:
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)
I want to solve this problem but most importantly, I want to learn more about Linux so any explanation is more than welcome. Thank you!
Upvotes: 8
Views: 6753
Reputation: 336
I had the reverse situation (posix3 instead of 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
This is what worked for me. (for you it would be libpcre2-posix3
)
sudo dpkg --purge libpcre2-posix2
sudo apt --fix-broken install
All good after that.
Hope this helps.
Upvotes: 22
Reputation: 1676
The below commands solved the issue:
srcFile="/etc/apt/sources.list.d/ondrej-ubuntu-php-impish.list"
sed -i 's/# //g' ${srcFile}
apt update
apt autoclean
apt autoremove -f -y
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php <<< "2"
apt install php7.2 -y
Upvotes: 1