Ubuntu 18.04LTS Library dependency error when installing

Asked by Benjamin Körnig

On my fresh Ubuntu 18.04LTS installation I get the following error when I try to install terminator:

sudo apt install terminator

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:
 terminator : Depends: python-cairo but it is not going to be installed
              Depends: python-dbus but it is not going to be installed
              Depends: python-gi but it is not going to be installed
              Depends: python-gi-cairo but it is not going to be installed
              Depends: python-psutil but it is not going to be installed
              Depends: python:any (>= 2.7.5-5~)
E: Unable to correct problems, you have held broken packages.

What can I do to solve this? Why is this happening to a fresh Ubuntu OS and all the standard Ubuntu libraries?

Best regards,

BK

Question information

Language:
English Edit question
Status:
Solved
For:
Terminator Edit question
Assignee:
No assignee Edit question
Solved by:
Benjamin Körnig
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

For diagnostic purposes please provide the output that you receive for the commands

uname -a
lsb_release -crid
apt-cache policy terminator python-cairo python-dbus python-gi python-gi-cairo python-psutil python
apt --simulate install terminator python-cairo python-dbus python-gi python-gi-cairo python-psutil python

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#2

uname -a
Linux bcomp 4.18.0-16-generic #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

apt-cache policy terminator python-cairo python-dbus python-gi python-gi-cairo python-psutil python
terminator:
  Installed: (none)
  Candidate: 1.91-1
  Version table:
     1.91-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
python-cairo:
  Installed: (none)
  Candidate: 1.16.2-1
  Version table:
     1.16.2-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python-dbus:
  Installed: (none)
  Candidate: 1.2.6-1
  Version table:
     1.2.6-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python-gi:
  Installed: (none)
  Candidate: 3.26.1-2
  Version table:
     3.26.1-2 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python-gi-cairo:
  Installed: (none)
  Candidate: 3.26.1-2
  Version table:
     3.26.1-2 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
python-psutil:
  Installed: (none)
  Candidate: 5.4.2-1
  Version table:
     5.4.2-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

apt --simulate install terminator python-cairo python-dbus python-gi python-gi-cairo python-psutil python
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:
 python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

ok, one step deeper in the dependency chain, what is the output of

apt-cache policy python python-minimal python2.7
apt --simulate install python python-minimal python2.7

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#4

apt-cache policy python python-minimal python2.7
python:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python-minimal:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python2.7:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

apt --simulate install python python-minimal python2.7
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:
 python-minimal : Depends: python2.7-minimal (>= 2.7.15~rc1-1~) but it is not going to be installed
 python2.7 : Depends: python2.7-minimal (= 2.7.15~rc1-1) but it is not going to be installed
             Depends: libpython2.7-stdlib (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.

you are awesome

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

This seems to be the hint to the root cause:
Depends: libpython2.7-stdlib (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is to be installed

It seems that the candidate for python2.7 is from bionic/main, but for libpython2.7-stdlib it is from bionic-security/main

What is the output of the commands (in this sequence)

apt-get policy python2.7 python2.7-minimal libpython2.7-stdlib
sudo apt update
apt-get policy python2.7 python2.7-minimal libpython2.7-stdlib

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#6

apt-get policy python2.7 python2.7-minimal libpython2.7-stdlib
E: Invalid operation policy

apt update
Hit:1 http://de.archive.ubuntu.com/ubuntu bionic InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

apt-get policy python2.7 python2.7-minimal libpython2.7-stdlib
E: Invalid operation policy

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

Sorry, mein Fehler

apt-cache policy python2.7 python2.7-minimal libpython2.7-stdlib
sudo apt update
apt-cache policy python2.7 python2.7-minimal libpython2.7-stdlib

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#8

kein problem :)

apt-cache policy python2.7 python2.7-minimal libpython2.7-stdlib
python2.7:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python2.7-minimal:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libpython2.7-stdlib:
  Installed: 2.7.15~rc1-1ubuntu0.1
  Candidate: 2.7.15~rc1-1ubuntu0.1
  Version table:
 *** 2.7.15~rc1-1ubuntu0.1 100
        100 /var/lib/dpkg/status
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

apt update
Hit:1 http://de.archive.ubuntu.com/ubuntu bionic InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

apt-cache policy python2.7 python2.7-minimal libpython2.7-stdlib
python2.7:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python2.7-minimal:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libpython2.7-stdlib:
  Installed: 2.7.15~rc1-1ubuntu0.1
  Candidate: 2.7.15~rc1-1ubuntu0.1
  Version table:
 *** 2.7.15~rc1-1ubuntu0.1 100
        100 /var/lib/dpkg/status
     2.7.15~rc1-1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

Cause for the problem are the settings for the selection of sources for Ubuntu packages on your system.

Apparently at a certain point in time "bionic-security" was selected as repository source, and at that time libpython2.7-stdlib was installed (and the package management system selected the version from that source).
It seems that later "bionic-security" was deselected, and now the package management cannot find matching package versions for python2.7 and libpython2.7-stdlib.

Possible solutions:
re-enable "bionic-security" as repository source
or
downgrade libpython2.7-stdlib to the version in "bionic"

I recommend the first option, because this enables that security updates (also for other packages) can quickly be installed.

What is the output of the command

cat -n /etc/apt/sources.list

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#10

cat -n /etc/apt/sources.list
     1 # deb cdrom:[Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)]/ bionic main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
     6 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
    11
    12 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    13 ## team. Also, please note that software in universe WILL NOT receive any
    14 ## review or updates from the Ubuntu security team.
    15 deb http://de.archive.ubuntu.com/ubuntu/ bionic universe
    16 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic universe
    17 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates universe
    18
    19 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    20 ## team, and may not be under a free licence. Please satisfy yourself as to
    21 ## your rights to use the software. Also, please note that software in
    22 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    23 ## security team.
    24 deb http://de.archive.ubuntu.com/ubuntu/ bionic multiverse
    25 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic multiverse
    26 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    27
    28 ## N.B. software from this repository may not have been tested as
    29 ## extensively as that contained in the main release, although it includes
    30 ## newer versions of some applications which may provide useful features.
    31 ## Also, please note that software in backports WILL NOT receive any review
    32 ## or updates from the Ubuntu security team.
    33 # deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    34
    35 ## Uncomment the following two lines to add software from Canonical's
    36 ## 'partner' repository.
    37 ## This software is not part of Ubuntu, but is offered by Canonical and the
    38 ## respective vendors as a service to Ubuntu users.
    39 # deb http://archive.canonical.com/ubuntu bionic partner
    40 # deb-src http://archive.canonical.com/ubuntu bionic partner
    41
    42 # deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
    43 # deb-src http://security.ubuntu.com/ubuntu bionic-security universe
    44 # deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

Revision history for this message
Benjamin Körnig (plattenquatsch) said :
#11

you solve it!

turns out i at some point disabled automatic updates and remove the sources.

reenabled it and did

apt update && apt upgrade

aber allmost 60 updates that have been missing ... i was able to install terminator.

thank you :*