linuxubuntu

dpkg: error processing archive


I got this error when trying to install anything on ubuntu 16.04.

SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-
samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 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 while cleaning up:
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
/var/cache/apt/archives/python-libxml2_2.9.3+dfsg1-1ubuntu0.2_amd64.deb
/var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried apt-get -f install but it shows the same error . could anyone help ?


Solution

  • After a while in searching , i have fixed the problem with those lines in terminal:

     $ sudo apt-get clean
     $ sudo apt-get update
     $ sudo apt-get install --reinstall python-minimal python-lockfile
     $ sudo apt-get -f install