0

I was trying to install a package which seemed to be broken - mysql-server to be precise. Following advice from the Internet, I ran apt-get -f install to fix dependencies, which generated a list of changes.

I accepted these changes without looking at them. Apparently, those changes were to remove many important packages --

Log started: 2017-12-21  12:41:04
(Reading database ... 111077 files and directories currently installed.)
Removing php5 (5.6.30+dfsg-0+deb8u1) ...
Removing libapache2-mod-php5 (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module pdo for apache2 SAPI
php5_invoke prerm: Disable module opcache for apache2 SAPI
php5_invoke prerm: Disable module readline for apache2 SAPI
php5_invoke prerm: Disable module json for apache2 SAPI
Module php5 disabled.
apache2_invoke prerm: Disable module php5
Removing apache2 (2.4.10-10+deb8u9) ...
Removing apache2-bin (2.4.10-10+deb8u9) ...
Removing node (0.3.2-7.4) ...
Removing ax25-node (0.3.2-7.4) ...
Removing build-essential (11.7) ...
Removing dpkg-dev (1.17.27) ...
Removing git (1:2.1.4-2.1+deb8u3) ...
Removing i2c-tools (3.1.1+svn-2) ...
Removing libsoftware-license-perl (0.103010-3) ...
Removing libdata-section-perl (0.200006-1) ...
Removing libmro-compat-perl (0.12-1) ...
Removing libclass-c3-perl (0.26-1) ...
Removing libalgorithm-c3-perl (0.09-1) ...
Removing libalgorithm-diff-xs-perl (0.04-3+b1) ...
Removing libalgorithm-merge-perl (0.08-2) ...
Removing libalgorithm-diff-perl (1.19.02-3) ...
Removing libarchive-extract-perl (0.72-1) ...
Removing libcgi-fast-perl (1:2.04-1) ...
Removing libcgi-pm-perl (4.09-1) ...
Removing libclass-c3-xs-perl (0.13-2+b1) ...
Removing libmodule-build-perl (0.421000-2+deb8u1) ...
Removing 'diversion of /usr/bin/config_data to /usr/bin/config_data.diverted by libmodule-build-perl'
Removing 'diversion of /usr/share/man/man1/config_data.1.gz to /usr/share/man/man1/config_data.diverted.1.gz by libmodule-build-perl'
Removing libcpan-meta-perl (2.142690-1) ...
Removing libsub-exporter-perl (0.986-1) ...
Removing libdata-optlist-perl (0.109-1) ...
Removing libdpkg-perl (1.17.27) ...
Removing liberror-perl (0.17-1.1) ...
Removing libfcgi-perl (0.77-1+deb8u1) ...
Removing openbsd-inetd (0.20091229-2) ...
Removing update-inetd (4.43) ...
Removing libfile-copy-recursive-perl (0.38-1) ...
Removing libfile-fcntllock-perl (0.22-1+b1) ...
Removing libterm-ui-perl (0.42-1) ...
Removing liblog-message-simple-perl (0.10-2) ...
Removing liblog-message-perl (0.8-1) ...
Removing libmodule-pluggable-perl (5.1-1) ...
Removing libmodule-signature-perl (0.73-1+deb8u2) ...
Removing libpackage-constants-perl (0.04-1) ...
Removing libparams-util-perl (1.07-2+b1) ...
Removing php5-readline (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module readline for cli SAPI
Removing php5-cli (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module pdo for cli SAPI
php5_invoke prerm: Disable module opcache for cli SAPI
php5_invoke prerm: Disable module json for cli SAPI
Removing php5-json (1.3.6-1) ...
Removing php5-common (5.6.30+dfsg-0+deb8u1) ...
Removing lsof (4.86+dfsg-1) ...
Removing libperl4-corelibs-perl (0.003-1) ...
Removing libpod-latex-perl (0.61-1) ...
Removing 'diversion of /usr/bin/pod2latex to /usr/bin/pod2latex.bundled by libpod-latex-perl'
Removing 'diversion of /usr/share/man/man1/pod2latex.1.gz to /usr/share/man/man1/pod2latex.bundled.1.gz by libpod-latex-perl'
Removing libpod-readme-perl (0.11-1) ...
Removing libregexp-common-perl (2013031301-1) ...
Removing libsub-install-perl (0.928-1) ...
Removing libtext-soundex-perl (3.4-1+b2) ...
Removing libtext-template-perl (1.46-1) ...
Removing libtimedate-perl (2.3000-2) ...
Removing rename (0.20-3) ...
Removing xml-core (0.13+nmu2) ...
Removing sgml-base (1.26+nmu4) ...

Ever since, I have been trying to reinstall these packages. This results in a bizarre situation, however ... this is what happens when I try to install apache2, for example:

root@srv2:/# apt-get install apache2
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:
 apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u12) but it is not going to be installed or
                    apache2-mpm-prefork (= 2.2.22-13+deb7u12) but it is not going to be installed or
                    apache2-mpm-event (= 2.2.22-13+deb7u12) but it is not going to be installed or
                    apache2-mpm-itk (= 2.2.22-13+deb7u12) but it is not going to be installed
           Depends: apache2.2-common (= 2.2.22-13+deb7u12) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Okay... attempting to manually install these, e.g apache2.2-common:

root@srv2:/# apt-get install apache2.2-common
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:
 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-13+deb7u12) but it is not going to be installed
                    Depends: perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

"Depends: perl" is an issue many packages seem to be reporting. However, it seems to be installed fine...

root@srv2:/# perl -v

This is perl 5, version 20, subversion 2 (v5.20.2) built for arm-linux-gnueabihf-thread-multi-64int

(with 95 registered patches, see perl -V for more detail)

To apt, it does not seem to be installed:

root@srv2:/# apt-get install perl
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:
 adduser : Depends: perl-base (>= 5.6.0) but it is not going to be installed
           Depends: passwd (>= 1:4.0.12) but it is not going to be installed
           Depends: debconf but it is not going to be installed or
                    debconf-2.0
 libfontconfig1 : Depends: fontconfig-config (>= 2.11.0-6.3+deb8u1) but it is not going to be installed
 libpython3-stdlib : Depends: libpython3.4-stdlib (>= 3.4.2-0) but it is not going to be installed
 libxt6 : Depends: libsm6 but it is not going to be installed
 logrotate : Depends: cron or
                      anacron but it is not going to be installed or
                      cron-daemon
             Recommends: mailx
 perl : Depends: perl-base (= 5.14.2-21+rpi2+deb7u2) but it is not going to be installed
        Depends: perl-modules (>= 5.14.2-21+rpi2+deb7u2) but it is not going to be installed
 python : Depends: python2.7 (>= 2.7.9-1~) but it is not going to be installed
          Depends: libpython-stdlib (= 2.7.9-1) but it is not going to be installed
 python3-minimal : Depends: python3.4-minimal (>= 3.4.2-0) but it is not going to be installed
 python3-venv : Depends: python3.4-venv (>= 3.4.2-0) but it is not going to be installed
 python3.4 : Depends: python3.4-minimal (= 3.4.2-1) but it is not going to be installed
             Depends: libpython3.4-stdlib (= 3.4.2-1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

These packages are literally installed, and apt knows it. The package adduser is literally installed on the server, and yet it is reporting it as an unmet dependency. With these issues, I cannot even begin to begin repairing the deleted packages.

More info:

root@srv2:/# apt-get install adduser
Reading package lists... Done
Building dependency tree       
Reading state information... Done
adduser is already the newest version.

root@srv2:/# apt-mark showhold
root@srv2:/# apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
  -1 http://archive.raspberrypi.org/debian/ jessie/ui armhf Packages
     release o=Raspberry Pi Foundation,a=oldstable,n=jessie,l=Raspberry Pi Foundation,c=ui
     origin archive.raspberrypi.org
  -1 http://archive.raspberrypi.org/debian/ jessie/main armhf Packages
     release o=Raspberry Pi Foundation,a=oldstable,n=jessie,l=Raspberry Pi Foundation,c=main
     origin archive.raspberrypi.org
 989 http://archive.raspbian.org/raspbian/ wheezy/non-free armhf Packages
     release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=non-free
     origin archive.raspbian.org
 989 http://archive.raspbian.org/raspbian/ wheezy/contrib armhf Packages
     release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=contrib
     origin archive.raspbian.org
 989 http://archive.raspbian.org/raspbian/ wheezy/main armhf Packages
     release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=main
     origin archive.raspbian.org
Pinned packages:
  • 1
    The removed versions where Debian 8 versions (+deb8), but you’re trying to install Debian 7 versions now (+deb7). Having a mixture of releases (or rather, installed packages from another release than the configured release) tends to lead to the kind of problems you’re running into now. Could you edit your question to show the output of apt-cache policy? – Stephen Kitt Dec 21 '17 at 8:13
  • @StephenKitt, has been done. – Joseph A. Dec 21 '17 at 8:20
  • Do you know what version of Raspbian you’re actually trying to use? Wheezy, or Jessie? – Stephen Kitt Dec 21 '17 at 8:25
  • @StephenKitt, cat /etc/os-release indicates VERSION="8 (jessie)". Therefore, I'm assuming Jessie. – Joseph A. Dec 21 '17 at 8:32
1

Some of your packages are installed from Raspbian Jessie, but your pin priorities (in /etc/apt/preferences) favour Raspbian Wheezy and prevent installation of new packages from Jessie (that’s the -1 priority). As a result, the packages you removed can’t be re-installed, because doing so would require Jessie packages, which are excluded.

To fix this, you need to:

  1. try to find out why Jessie is listed but pinned at -1;
  2. if there’s no good reason for the pin, edit /etc/apt/preferences to remove it;
  3. restore the packages you removed.

You’ll probably want to fully upgrade to Jessie at some point too, using apt dist-upgrade (but do take care this time with the package removals — if there are too many, investigate before confirming).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.