0

When I tried to apt-get upgrade (yes, I did an update first), I get the following:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python-samba : Depends: libwbclient0 (= 2:4.5.12+dfsg-2+deb9u2) but 2:4.5.12+dfsg-2+deb9u3 is installed
                Depends: samba-libs (= 2:4.5.12+dfsg-2+deb9u2) but 2:4.5.12+dfsg-2+deb9u3 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

So the culprit appears to be libwbclient0 which is required in subversion deb9u2 but apparently installed in deb9u3. When I try to run --fix-broken as suggested by apt-get the remove scripts seem to crash because of a missing package maketrans and later ConfigParser:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  python-samba
Suggested packages:
  python-gpgme
The following packages will be upgraded:
  python-samba
1 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,364 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 567338 files and directories currently installed.)
Preparing to unpack .../python-samba_2%3a4.5.12+dfsg-2+deb9u3_amd64.deb ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 32, in <module>
    from debpython.namespace import add_namespace_files
  File "/usr/share/python/debpython/namespace.py", line 28, in <module>
    from debpython.pydist import PUBLIC_DIR_RE
  File "/usr/share/python/debpython/pydist.py", line 27, in <module>
    from string import maketrans
ImportError: cannot import name 'maketrans'
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 32, in <module>
    from debpython.namespace import add_namespace_files
  File "/usr/share/python/debpython/namespace.py", line 28, in <module>
    from debpython.pydist import PUBLIC_DIR_RE
  File "/usr/share/python/debpython/pydist.py", line 27, in <module>
    from string import maketrans
ImportError: cannot import name 'maketrans'
dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.5.12+dfsg-2+deb9u3_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
Errors were encountered while processing:
 /var/cache/apt/archives/python-samba_2%3a4.5.12+dfsg-2+deb9u3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am on debian stretch 9.4 with the kernel: Linux 3.10-2-amd64 #1 SMP Debian 3.10.7-1

After my own attempts failed and I couldn't find anything online how to fix this, I asked aptitude and synaptic to give it a go. Both tried something but also failed.

I don't even need samba, so getting rid of it would be fine, but apt doesn't want to remove anything before I don't fix the broken package:

 package is in a very bad inconsistent state; you should
 reinstall it before attempting a removal
3
ImportError: cannot import name 'maketrans'

is a Python 3 error, which results from trying to import maketrans as you would do in Python 2 code. This means that /usr/bin/python in your system is a Python 3 interpreter; this breaks Debian derivatives.

To fix this, assuming python2.7 is still installed, you need to fix the /usr/bin/python symlink so it points at /usr/bin/python2.7:

sudo ln -s python2.7 /usr/bin/python

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.