我正在尝试安装你的这需要php7.2-fpm
。但是,在安装它时,我得到了这个:
The following packages have unmet dependencies.
php7.2-fpm : Depends: php7.2-common (= 7.2.10-0ubuntu0.18.04.1) but 7.2.12-1+ub
untu14.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
这是我前段时间从 14.04 更新的机器。我似乎仍然安装了一堆来自 14.04 的软件包:
; apt list --installed | ag ubuntu14 | wc -l
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
49
我该如何解决?
以下是评论者要求的附加信息:
; apt-cache policy php7.2-common
php7.2-common:
Installed: 7.2.12-1+ubuntu14.04.1+deb.sury.org+1
Candidate: 7.2.12-1+ubuntu14.04.1+deb.sury.org+1
Version table:
*** 7.2.12-1+ubuntu14.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
7.2.10-0ubuntu0.18.04.1 500
500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
7.2.3-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
和
; grep -R trusty /etc/apt
grep: /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg: No such file or directory
/etc/apt/sources.list.d/apt-fast-stable-precise.list.save:1:# deb http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/apt-fast-stable-precise.list.save:2:# deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list.save:1:# deb http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list.save:2:# deb-src http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/neovim-ppa-unstable-trusty.list:2:# deb-src http://ppa.launchpad.net/neovim-ppa/unstable/ubuntu trusty main
/etc/apt/sources.list.d/gophers-archive-trusty.list.save:2:# deb-src http://ppa.launchpad.net/gophers/archive/ubuntu trusty main
/etc/apt/sources.list.d/apt-fast-stable-precise.list:1:# deb http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/apt-fast-stable-precise.list:2:# deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/nginx-stable-precise.list.distUpgrade:1:# deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/nginx-stable-precise.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/pi-rho-dev-precise.list.distUpgrade:1:# deb http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/pi-rho-dev-precise.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/neovim-ppa-unstable-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/neovim-ppa/unstable/ubuntu trusty main
/etc/apt/sources.list.d/fish-shell-release-2-trusty.list.save:2:# deb-src http://ppa.launchpad.net/fish-shell/release-2/ubuntu trusty main
/etc/apt/sources.list.d/certbot-certbot-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/certbot/certbot/ubuntu trusty main
/etc/apt/sources.list.d/fish-shell-release-2-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/fish-shell/release-2/ubuntu trusty main
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list:1:# deb http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list:2:# deb-src http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/certbot-certbot-trusty.list.save:2:# deb-src http://ppa.launchpad.net/certbot/certbot/ubuntu trusty main
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list.distUpgrade:1:# deb http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ultrafredde-ppa-precise.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/ultrafredde/ppa/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/apt-fast-stable-precise.list.distUpgrade:1:# deb http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/apt-fast-stable-precise.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ondrej-php-trusty.list:2:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu trusty main
/etc/apt/sources.list.d/ondrej-php-trusty.list.save:2:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu trusty main
/etc/apt/sources.list.d/pi-rho-dev-precise.list:1:# deb http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/pi-rho-dev-precise.list:2:# deb-src http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/fish-shell-release-2-trusty.list:2:# deb-src http://ppa.launchpad.net/fish-shell/release-2/ubuntu trusty main
/etc/apt/sources.list.d/certbot-certbot-trusty.list:2:# deb-src http://ppa.launchpad.net/certbot/certbot/ubuntu trusty main
/etc/apt/sources.list.d/nginx-stable-precise.list:1:# deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/nginx-stable-precise.list:2:# deb-src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/ondrej-php-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu trusty main
/etc/apt/sources.list.d/git-core-ppa-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main
/etc/apt/sources.list.d/neovim-ppa-unstable-trusty.list.save:2:# deb-src http://ppa.launchpad.net/neovim-ppa/unstable/ubuntu trusty main
/etc/apt/sources.list.d/git-core-ppa-trusty.list.save:2:# deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main
/etc/apt/sources.list.d/pi-rho-dev-precise.list.save:1:# deb http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/pi-rho-dev-precise.list.save:2:# deb-src http://ppa.launchpad.net/pi-rho/dev/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/gophers-archive-trusty.list.distUpgrade:2:# deb-src http://ppa.launchpad.net/gophers/archive/ubuntu trusty main
/etc/apt/sources.list.d/nginx-stable-precise.list.save:1:# deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/nginx-stable-precise.list.save:2:# deb-src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main # disabled on upgrade to trusty
/etc/apt/sources.list.d/git-core-ppa-trusty.list:2:# deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main
/etc/apt/sources.list.d/gophers-archive-trusty.list:2:# deb-src http://ppa.launchpad.net/gophers/archive/ubuntu trusty main
/etc/apt/sources.list.bak:13:deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
/etc/apt/sources.list.bak:14:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
/etc/apt/sources.list.bak:18:deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
/etc/apt/sources.list.bak:19:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
/etc/apt/sources.list.bak:24:deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
/etc/apt/sources.list.bak:25:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
/etc/apt/sources.list.bak:26:deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
/etc/apt/sources.list.bak:27:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
/etc/apt/sources.list.bak:34:deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
/etc/apt/sources.list.bak:35:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
/etc/apt/sources.list.bak:36:deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
/etc/apt/sources.list.bak:37:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
/etc/apt/sources.list.bak:44:deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
/etc/apt/sources.list.bak:45:deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
/etc/apt/sources.list.bak:47:deb http://security.ubuntu.com/ubuntu trusty-security main restricted
/etc/apt/sources.list.bak:48:deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
/etc/apt/sources.list.bak:49:deb http://security.ubuntu.com/ubuntu trusty-security universe
/etc/apt/sources.list.bak:50:deb-src http://security.ubuntu.com/ubuntu trusty-security universe
/etc/apt/sources.list.bak:51:deb http://security.ubuntu.com/ubuntu trusty-security multiverse
/etc/apt/sources.list.bak:52:deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
然而:
; apt update
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/neovim-ppa/stable/ubuntu bionic InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 252 kB in 1s (253 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up-to-date.
答案1
这里的关键线索在于 apt-cache 输出:
*** 7.2.12-1+ubuntu14.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
1)这意味着该包未由任何启用的源提供,但它位于您本地的 /var/cache/apt/archives 中。
2)查看软件包的命名方式,该软件包似乎来自某些非 Ubuntu 来源。
它进入本地缓存的最可能方式是,你过去曾启用过非 Ubuntu 源。当你禁用非 Ubuntu 源时,似乎你可能忘记从该源卸载软件包。
令人高兴的是,这个问题通常很容易解决:卸载所有非 Ubuntu 软件包然后返回到原始 Ubuntu。然后 apt 将再次正常工作。