1

I can not install anything using sudo apt-get install

For example when I try to install libnlopt-dev, it gives the following error:

$ sudo apt-get install libnlopt-dev
[sudo] password for burcak: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package apport needs to be reinstalled, but I can't find an archive for it.

When I try to dist-upgrade, I get the following error:

$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package apport needs to be reinstalled, but I can't find an archive for it.

And also sudo dpkg --configure -a gives the following error:

    $ sudo dpkg --configure -a
Setting up python-gpgme (0.3-1.1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-gpgme (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of apport-gtk:
     apport-gtk depends on apport (>= 0.41); however:
      Package apport is not configured yet.

    dpkg: error processing package apport-gtk (--configure):
     dependency problems - leaving unconfigured
    Setting up python-gobject-2 (2.28.6-12ubuntu1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-gobject-2 (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-cairo (1.8.8-2) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-cairo (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-lockfile (1:0.12.2-1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-lockfile (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-pil:amd64 (3.1.2-0ubuntu1.1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-pil:amd64 (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of asymptote:
     asymptote depends on python-pil; however:
      Package python-pil:amd64 is not configured yet.

    dpkg: error processing package asymptote (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of nautilus-dropbox:
     nautilus-dropbox depends on python-gpgme; however:
      Package python-gpgme is not configured yet.

    dpkg: error processing package nautilus-dropbox (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of python-gtk2:
     python-gtk2 depends on python-cairo (>= 1.0.2-1.1); however:
      Package python-cairo is not configured yet.
     python-gtk2 depends on python-gobject-2 (>= 2.21.3); however:
      Package python-gobject-2 is not configured yet.

    dpkg: error processing package python-gtk2 (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of python-pil.imagetk:amd64:
     python-pil.imagetk:amd64 depends on python-pil (= 3.1.2-0ubuntu1.1); however:
      Package python-pil:amd64 is not configured yet.

    dpkg: error processing package python-pil.imagetk:amd64 (--configure):
     dependency problems - leaving unconfigured
    Processing triggers for libc-bin (2.23-0ubuntu9) ...
    Errors were encountered while processing:
     python-gpgme
     apport-gtk
     python-gobject-2
     python-cairo
     python-lockfile
     python-pil:amd64
     asymptote
     nautilus-dropbox
     python-gtk2
     python-pil.imagetk:amd64

Any help?

Terrance
  • 41,612
  • 7
  • 124
  • 183
burcak
  • 111
  • What version of Ubuntu are you running? – Terrance Feb 14 '18 at 22:06
  • Does apt update help with anything? – user8292439 Feb 14 '18 at 22:18
  • My ubuntu version: Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial – burcak Feb 14 '18 at 22:19
  • It seems that $ sudo apt-get update works but does not help me to install. Hit:1 http://mirror.hmc.edu/ubuntu xenial InRelease Hit:2 http://mirror.hmc.edu/ubuntu xenial-updates InRelease
    Hit:3 http://mirror.hmc.edu/ubuntu xenial-backports InRelease
    Hit:4 http://mirror.hmc.edu/ubuntu xenial-security InRelease
    Hit:5 http://ppa.launchpad.net/libreoffice/ppa/ubuntu xenial InRelease
    Reading package lists... Done
    – burcak Feb 14 '18 at 22:21
  • Did you try sudo apt install -f (idem --fix-broken)? Fix; attempt to correct a system with broken dependencies in place, man apt-get for more info. – Pablo Bianchi Feb 14 '18 at 22:29
  • It also asks for apport package $sudo apt install -f Reading package lists... Done Building dependency tree Reading state information... Done E: The package apport needs to be reinstalled, but I can't find an archive for it. – burcak Feb 14 '18 at 22:34
  • What do type python and python --version say? – steeldriver Feb 14 '18 at 22:37
  • My python version is Python 3.5.2. But I have also python 2.7 installed. – burcak Feb 14 '18 at 22:39

1 Answers1

0

From these error messages:

E: The package apport needs to be reinstalled, but I can't find an archive for it.
Package apport is not configured yet.

It would seem there is an issue with apport.
Kindly change your download servers then try reinstalling apport.

sudo apt install --reinstall apport

Edit 1

To change the download server, kindly search in dash for 'Software & Updates' and open it. On the first tab, in the section 'Download from' kindly select the main server if another is selected.
See screenshot below:

enter image description here

Parto
  • 15,325
  • 24
  • 86
  • 117
  • How to change the download server? `$ sudo apt install --reinstall apport

    Reading package lists... Done Building dependency tree
    Reading state information... Done E: The package apport needs to be reinstalled, but I can't find an archive for it.`

    – burcak Feb 14 '18 at 22:37
  • Hi @burcak I have added in the instructions – Parto Feb 14 '18 at 22:46
  • I changed the download server to Main Server. It gave the same error in dialog box. Failed to load the package list This is a serious problem. Try again later. If this problem appears again, please report an error to the developers E:The package apport needs to be reinstalled, but I can't find an archive for it. – burcak Feb 14 '18 at 22:50
  • @burcak Kindly check out this answer and see if it helps: https://askubuntu.com/a/88375/163331 – Parto Feb 14 '18 at 22:53
  • $ sudo dpkg --remove --force-all apport did not work – burcak Feb 14 '18 at 22:59
  • It gave dpkg: apport: dependency problems, but removing anyway as you requested: apport-gtk depends on apport (>= 0.41). and it goes on – burcak Feb 14 '18 at 23:00
  • I tried dpkg --remove --force-remove-reinstreq apport and I got `dpkg: dependency problems prevent removal of apport: apport-gtk depends on apport (>= 0.41).

    dpkg: error processing package apport (--remove): dependency problems - not removing Errors were encountered while processing: apport`

    – burcak Feb 14 '18 at 23:01
  • I followed these steps: sudo -i cd /var/lib/dpkg/info rm -rf apport*

    dpkg --remove --force-remove-reinstreq

    – burcak Feb 14 '18 at 23:02