In Ubuntu 18.04 (Cinnamon), the package cpp-7 depends precisely on version 7.3.0-27ubuntu1~18.04 of package gcc-7-base:

$ aptitude why gcc-7-base
i   cpp-7 Depends gcc-7-base (= 7.3.0-27ubuntu1~18.04)

Meanwhile, the package libgfortran4 depends precisely on version 7.3.0-16ubuntu3 of the same package gcc-7-base:

$ apt-cache show libgfortran4
Package: libgfortran4
Depends: gcc-7-base (= 7.3.0-16ubuntu3), libc6 (>= 2.27), libgcc1, libquadmath0

and libgfortran4 won't install if I have the other version of the package already installed:

$ sudo apt-get install libgfortran4
The following packages have unmet dependencies:
 libgfortran4 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.3.0-27ubuntu1~18.04 is to be installed
                Depends: libquadmath0 but it is not going to be installed

cpp-7 is in the dependency graph of ubuntu-desktop. libgfortran4 is in the dependency graph of gimp. Doesn't this imply that no one can ever install GIMP from the repositories on Ubuntu 18.04? Please correct me if I'm wrong, but I certainly can't.

To make the matter even more maddening, apt-cache showpkg shows that the two different versions of gcc-7-base come from the same repository and have the same MD5 hash:

$ apt-cache showpkg gcc-7-base
Package: gcc-7-base
7.3.0-27ubuntu1~18.04 (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages
                  MD5: b6e93638a6d08ea7a18929d7cf078e5d
7.3.0-16ubuntu3 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages
                  MD5: b6e93638a6d08ea7a18929d7cf078e5d

meaning (again, correct me if I'm wrong) that they're the exact same code. So, there isn't an actual dependency conflict here, only one of labels.

How does this happen and how do I fix it? For example, is there a way for me to tell either cpp-7 or libgfortran4 that it's okay to accept the other version of gcc-7-base, because it's the exact same code? Do I need to get the package maintainer(s) involved?

Edit: A few days ago I posted a question on this topic. The current question is the narrowed-down result of work I've done on it in the meantime.

Edit: These are my active sources:

$ grep -Ev '(^#|^ *$|deb-src)' /etc/apt/sources.list /etc/apt/sources.list.d/*
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
/etc/apt/sources.list:deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
/etc/apt/sources.list.d/keybase.list:deb http://prerelease.keybase.io/deb stable main
/etc/apt/sources.list.d/keybase.list.save:deb http://prerelease.keybase.io/deb stable main
/etc/apt/sources.list.d/vscode.list~:deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main

There's a commented deb-src for updates,

# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

but nothing commented or uncommented for updates that's just deb. Should I add a line

deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted


Edit: Adding

deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

to my /etc/apt/sources.list file, then $ sudo apt-get update worked. GIMP installed as expected with $ sudo apt-get install gimp. Thank you all!

  • 1
    I think this may solve your problem Dec 2 '18 at 14:56
  • @DKBose Yes, I posted that one, too. I edited my question to reference it. Thanks. Dec 2 '18 at 14:56
  • 1
    @GabrielZiegler It does not, but thanks. aptitude suggests downgrading a bunch of packages to 16.04 versions, which I think is an unreasonable solution that's bound to cause more problems than it solves, especially since there's apparently no actual conflict in the code of 18.04 package versions in this case. Dec 2 '18 at 14:59
  • 2
    I have cpp-7, gfortran, and gimp installed on 18.04 and I didn't jump through any hoops to do it. Something else must be going on. Dec 2 '18 at 15:07
  • I run both Gimp 2.8.22 (from PPA) and 2.10.8 (flatpak) on 16.04 and neither requires libgfortran4.
    – xenoid
    Dec 2 '18 at 22:37

This kind of issue is usually fixed by a simple apt update.

Let's see why by querying the madison database for the available 18.04 versions of gcc-7-base and libgfortran4.

$ rmadison gcc-7-base
 gcc-7-base | 7.3.0-16ubuntu3       | bionic         | amd64, arm64, armhf, i386, ppc64el, s390x
 gcc-7-base | 7.3.0-27ubuntu1~18.04 | bionic-updates | amd64, arm64, armhf, i386, ppc64el, s390x

$ rmadison libgfortran4
 libgfortran4 | 7.3.0-16ubuntu3       | bionic         | amd64, arm64, armhf, i386, ppc64el, s390x
 libgfortran4 | 7.3.0-27ubuntu1~18.04 | bionic-updates | amd64, arm64, armhf, i386, ppc64el, s390x

You can see that libgfortran4 is the bionic (non-updates) version, and has the bionic (non-updates) dependency. gcc-7-base, on the other hand uses the newer bionic-updates dependency.

There are two common reasons for this kind of de-sync between a base repository and it's corresponding -updates repository on a single system.

  1. The user has recently disabled the -updates repository. Easy enough to check and fix in /etc/apt/sources.list or your Software and Sources control panel.

  2. The user simply hasn't run apt update in a while to refresh (update) apt's local database of available packages from both sources. That's an easy fix, too.

Your file /etc/apt/sources.list should have some combination of mirrors and sources that adds up to:

deb [mirror URL] bionic main
deb [mirror URL] bionic-updates main
deb [mirror URL] bionic-security main

The optional universe, multiverse, and restricted repos can be included on the same lines.

  • 1
    I'm pretty sure you've nailed it. In the linked question, the OP says "but the only "updates" repos in my /etc/apt/sources.list are commented out, and I've never knowingly had them enabled." Don't know why someone would comment out "updates" repo, but there you have it. Dec 2 '18 at 15:21
  • @OrganicMarble What I meant was, I've never knowingly done anything to the "updates" repos at all. So, either it came commented out when I did a fresh install of 18.04 a few weeks ago, or it got commented out as an unexpected consequence of something else I did. Is it supposed to be enabled? Dec 2 '18 at 15:27
  • 1
    The default on my installs has always been to have the security and updates repos enabled, but Linux is so configurable I hate to say what is "supposed" to be. Dec 2 '18 at 15:30
  • 1
    @DarienMarks if you want updates (most do, you do, it's the default), then go into the file (or control panel) and enable -updates and -security. Then run an apt update. Guessing as to how or why -updates was disabled is just speculation, and seems rather wasted effort.
    – user535733
    Dec 2 '18 at 15:30
  • @OrganicMarble Follow-up question. My /etc/apt/sources.list only has a main-repo "updates" listing that begins with deb-src, which in my understanding is for source files that I want to compile myself. Should there be one that starts with just deb, or is the deb-src one the one I want to uncomment? Dec 2 '18 at 15:39

Another option is to install the snap version of GIMP. I realize some folks don't like snaps, but this may be a more palatable solution for the casual Linux user.

sudo snap install gimp

In addition to the accepted answer: If you have only default sources enabled and the latest package list (apt update) and still encounter such conflicts on basic packages like gimp, then report a bug. This is something, what should be fixed by the package maintainer and what probably is rather easy to fix for him. It also may affect more people than just you. Such bugs happen from time to time, but the maintainers need to know.

Of course you should make sure, that your configuration and package status is not the problem before, because if you e.g. have got gimp (or some of its dependencies) from a third-party repository, the ubuntu maintainers cannot help you.

  • The second paragraph is very very important. Ubuntu's Continuous Integration (CI) system weeds out almost all of these kinds of packaging mistakes before they reach the repos. So if you discover one, be really really sure it's not your setup before filing the bug.
    – user535733
    Dec 3 '18 at 15:45

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.