Hi,
I am on my digital ocean account, When I want to install update or remove any package I get an error
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
apache2 : Depends: apache2-utils (= 2.4.29-1ubuntu4.25) but it is not going to be installed
Depends: apache2-data (= 2.4.29-1ubuntu4.25) but it is not going to be installed
php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Even when i run apt --fix-broken install then
dpkg: error processing archive /var/cache/apt/archives/php7.4-cli_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb (--unpack):
unable to create '/usr/bin/phar7.4.phar.dpkg-new' (while processing './usr/bin/phar7.4.phar'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.4-dev (1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) over (7.4.24-1+ubuntu18.04.1+deb.sury.org+1) ...
dpkg: error processing archive /var/cache/apt/archives/php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb (--unpack):
unable to create '/usr/bin/php-config7.4.dpkg-new' (while processing './usr/bin/php-config7.4'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/php7.4-cli_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb
/var/cache/apt/archives/php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
The following packages have unmet dependencies:
php-apcu : Depends: php8.1-apcu but it is not going to be installed
php7.2-opcache : Depends: php7.2-common (= 7.2.34-33+ubuntu18.04.1+deb.sury.org+1) but 7.2.34-24+ubuntu18.04.1+deb.sury.org+1 is to be installed
php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
@tayyabshahzad1 Are you running php7.4 or 8.1? It seems you have both. php comes with apache2 so this might be the issue. I would probably uninstall php7.4 and either reinstall it if thats what you use, or php8.1 if that what you use
@Sinnbeck I just run sudo apt install php8.1
The Error
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:
php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
php8.1 : Depends: libapache2-mod-php8.1 but it is not going to be installed or
php8.1-fpm but it is not going to be installed or
php8.1-cgi but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
@tayyabshahzad1 Yeah uninstall php7.4 first if you dont need it. But be sure to make a backup of any virtual host files you have in /etc/apache2/sites-available or /etc/apache2/sites-enabled
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:
libapache2-mod-php7.4 : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
Recommends: apache2 but it is not going to be installed
php7.4 : Depends: php7.4-common but it is not going to be installed
php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-curl : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-gd : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-imagick : Depends: php7.4-common but it is not going to be installed
php7.4-imap : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-intl : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-json : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-mbstring : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-mysql : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-opcache : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-readline : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-soap : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-xml : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-xmlrpc : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
php7.4-zip : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
libapache2-mod-php7.4 : Depends: php7.4-cli but it is not going to be installed
Depends: php7.4-json but it is not going to be installed
Depends: php7.4-opcache but it is not going to be installed
Recommends: apache2 but it is not going to be installed