3

I am running Ubuntu 14.04 64-bit. I have an error in my system tray:

System tray error

sudo apt-get update runs normally.

But sudo apt-get upgrade returns the following:

Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libqt4-opengl:i386 : Depends: libqtcore4:i386 (= 4:) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 is installed
E: Unmet dependencies. Try using -f.

As suggested, I ran sudo apt-get install -f in an attempt to fix it. Another error was returned:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libqt4-opengl:i386
The following packages will be upgraded:
  libqt4-opengl:i386
1 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
Need to get 0 B/300 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
dpkg: error: parsing file '/var/lib/dpkg/status' near line 24899 package 'libqt4-opengl:i386':
 'Depends' field, reference to 'libqtcore4': error in version: nothing after colon in version number
E: Sub-process /usr/bin/dpkg returned an error code (2)

The output of sudo apt-cache policy libqtcore4:i386 is:

libqtcore4:i386:
  Installed: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
  Candidate: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
  Version table:
 *** 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 0
        500 http://pt.archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
        100 /var/lib/dpkg/status

The output of cat -n /var/lib/dpkg/status | sed -n '/Package: libqt4-opengl/,/Depends/p' is:

 24865  Package: libqt4-opengl
 24866  Status: install ok installed
 24867  Priority: optional
 24868  Section: libs
 24869  Installed-Size: 1228
 24870  Maintainer: Kubuntu Developers <kubuntu-devel@lists.ubuntu.com>
 24871  Architecture: amd64
 24872  Multi-Arch: same
 24873  Source: qt4-x11
 24874  Version: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
 24875  Depends: libc6 (>= 2.14), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libqtcore4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libqtgui4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libstdc++6 (>= 4.1.1), libx11-6, libxrender1
 24889  Package: libqt4-opengl
 24890  Status: install ok installed
 24891  Priority: optional
 24892  Section: libs
 24893  Installed-Size: 1220
 24894  Maintainer: Kubuntu Developers <kubuntu-devel@lists.ubuntu.com>
 24895  Architecture: i386
 24896  Multi-Arch: same
 24897  Source: qt4-x11
 24898  Version: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
 24899  Depends: libc6 (>= 2.4), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libqtcore4 (= 4:), libqtgui4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libstdc++6 (>= 4.1.1), libx11-6, libxrender1

How can I fix this issue?

fabiomaia
  • 387
  • 1
    Run sudo apt-get update and then sudo apt-get upgrade. Also what is the output of apt-cache policy libqtcore4:i386 and your Ubuntu version/arch? – Salem Aug 09 '14 at 23:20
  • @Salem: sudo apt-get update runs OK. sudo apt-get upgrade returns the same as before. The output of sudo apt-cache policy libqtcore4:i386 has been added above. I'm running Ubuntu 14.04 64-bit. I have updated the post with this information. – fabiomaia Aug 10 '14 at 11:40
  • 1
    According to this, you have the correct libqtcore4 package installed. It's just that your /var/lib/dpkg/status file is corrupted. What's the output of cat -n /var/lib/dpkg/status | sed -n '/Package: libqt4-opengl/,/Depends/p'? – Alaa Ali Aug 10 '14 at 12:14
  • @AlaaAli: I have updated the post with the output. – fabiomaia Aug 10 '14 at 13:26

1 Answers1

4

Execute the following commands:

sudo cp /var/lib/dpkg/status{,.bak}
sudo sed -i '24899s/(= 4:)/(= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4)/' /var/lib/dpkg/status
sudo apt-get install -f

This should fix it.


Explanation

From the output of your sudo apt-get upgrade and sudo apt-get install -f:

The following packages have unmet dependencies:
 libqt4-opengl:i386 : Depends: libqtcore4:i386 (= 4:) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 is installed

dpkg: error: parsing file '/var/lib/dpkg/status' near line 24899 package 'libqt4-opengl:i386': 'Depends' field, reference to 'libqtcore4': error in version: nothing after colon in version number

libqt4-opengl:i386 needs libqtcore4:i386 to be installed, but for some reason, it's looking for its version 4: (look at the last line in the output I requested). That's a wrong version number. I don't know what could've caused it to do this, but we'll try to fix the version it's looking for.

According to this page, we can see that the version of libqtcore4:i386 it really needs is 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 (which you already have installed, from the output of apt-cache policy libqtcore4:i386). So we might be able to fix this by editing the /var/lib/dpkg/status file to make it look for the correct version, and then try the apt-get command again.

Alaa Ali
  • 31,535