1

On Ubuntu 16.04 I've problems with gcc-5-base package:

user@laptop:~$ sudo apt install libgfortran3
The following packages have unmet dependencies:
 libgfortran3 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.11) but 5.5.0-12ubuntu1~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.

No hold packages: dpkg --get-selection | grep hold returns nothing.

No automatic fixes to apply:

user@laptop:~$ sudo apt -f install
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Reinstall says that everything is ok (but of course is not):

user@laptop:~$ sudo apt install gcc-5-base
gcc-5-base is already the newest version (5.5.0-12ubuntu1~16.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

No dependencies to clean:

user@laptop:~$ sudo apt-get --purge autoremove
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

I think that the problem arose upgrading from 14.04 to 16.04: I've used these commands to fix libstdc++, after do-release-upgrade.

Any other hints?

Thank you.

caneta
  • 121
  • Sounds like an outdated package list; have you run apt update recently? – fkraiem Sep 12 '19 at 08:38
  • Yes, I forgot to mention: sudo apt update returns All packages are up to date. No issue with repositories at all. And I don't have PPAs. – caneta Sep 12 '19 at 09:40
  • You definitely have an issue with your repositories, because Apt wants to install version 5.5.0-12ubuntu1~16.04 of gcc-5-base despite its not being the latest version (the latest version is 5.4.0-6ubuntu1~16.04.11). Maybe apt-cache policy gcc-5-base could give a hint... – fkraiem Sep 12 '19 at 10:09
  • Your command reports gcc-5-base: Installed: 5.5.0-12ubuntu1~16.04 Candidate: 5.5.0-12ubuntu1~16.04 Version table: *** 5.5.0-12ubuntu1~16.04 100 100 /var/lib/dpkg/status 5.4.0-6ubuntu1~16.04.11 500 500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages 5.4.0-6ubuntu1~16.04.10 500 500 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages 5.3.1-14ubuntu2 500 500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages – caneta Sep 12 '19 at 10:54
  • Further info: dpkg --get-selections | grep deinstall returns nothing as well. – caneta Sep 13 '19 at 09:57
  • The problem is that you have this 5.5.0-12ubuntu1~16.04 version installed, and it's not clear where it's coming from (it's not from the official repos). You could try reverting to the correct one with sudo apt install gcc-5-base=5.4.0-6ubuntu1~16.04.11, but if you have other packages that depend on the 5.5 version, they would need to be reverted as well. – fkraiem Sep 13 '19 at 14:29
  • Ok, how could you say that the official one is 5.4.0 instead of 5.5.0? Because in synaptic I see that only 5.5.0 is available and the latest one...and if I run your command i get E: Version '5.4.0-6ubuntu1~16.04' for 'gcc-5-base' was not found – caneta Sep 13 '19 at 14:36
  • You didn't copy the command correctly (it's 16.04.11). ;) You can see in the apt-cache policy output that version 5.5.0-12ubuntu1~16.04 does not correspond to any repository. The reason why it appears is that it's installed, but it's unclear where you got it from. – fkraiem Sep 13 '19 at 14:52
  • You are right @fkraiem, thank you for pointing it out. I solved with this discussion, I will post it below. – caneta Sep 13 '19 at 15:26

2 Answers2

0

From the problem description, the issue is completely clear.

Your issue is:

libgfortran3 is what you wish to install.
=>=> but it requires gcc-5-base (= 5.4.0-6ubuntu1~16.04.11)
.. .. ..=>=> But gcc-5-base (5.5.0-12ubuntu1~16.04) is available.

See, the problem is, to install libgfortran3 you need (exactly, because of = sign) 5.4.0-6ubuntu1~16.04.11, but this version is not available. What IS available is: 5.5.0-12ubuntu1~16.04, which cannot satisfy the dependency (because the condition is exact match). So nothing is installed.

And since nothing has been, your installation base is also correct, and in correct state. But the package IS broken.

Solution

First download the deb of libgfortran3

 sudo apt download libgfortran3
 sudo dpkg -i --force-depends libgfortran [your version] .deb

The first will download the libgfortan3-version.deb to your pwd.

Next, modify /var/lib/dpkg/status to make dpkg shut up.

 /var/lib/dpkg/status
  • edit /var/lib/dpkg/status
  • Find the package with the broken dependencies
  • edit the Depends: line to stop the package complaining.

Find the line:

Package: libgfortan3

Next edit the line Depends (a few line after the previous one)

Modify:

Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.11)

To:

Depends: gcc-5-base (>= 5.4.0-6ubuntu1~16.04.11)

That should fix it.

0

I solved using sudo apt install gcc-5-base=5.4.0-6ubuntu1~16.04.11. That removed a lot of things, also a critical package to me: xubuntu-desktop.

But reinstalling it with sudo apt install xubuntu-desktop solved other broken dependencies and I was able to do sudo install libgfortran3 with success.

Thanks everyone.

caneta
  • 121