0

After running do-release-upgrade -d on our staging EC2 instance, I've encountered a problem with dpkg.

My original problem was that mkvirtualenv command was failing with the following error:

Unknown distribution virtual 1.7.11

and some details I cannot recover, because I've erased python :(

But once I've removed python manually, and tried to re-install it, I started getting the following error at the rnd of the apt-get install process:

Setting up python-twisted-names (11.1.0-1) ...
/var/lib/dpkg/info/python-twisted-names.postinst: 8: /var/lib/dpkg/info/python-twisted-names.postinst: pycompile: not found
dpkg: error processing package python-twisted-names (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up python-twisted-web (11.1.0-1) ...
/var/lib/dpkg/info/python-twisted-web.postinst: 8: /var/lib/dpkg/info/python-twisted-web.postinst: pycompile: not found
dpkg: error processing package python-twisted-web (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 python-twisted-names
 python-twisted-web
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any help is much appreciated.

1 Answer 1

1

Have you tried reinstalling dpkg? sudo apt-get install --reinstall dpkg

If this doesn't work, this may be specific to the pythons packages. Try to modify the postinst file: gksu gedit /var/lib/dpkg/info/python-twisted-names.postinst or another text editor if you prefer.

Delete all the content and replace by

#!/bin/sh
set -e
exit 0

If this still doesn't do it, you can try deleting the status file rm /var/lib/dpkg/status and leave it like that so a new one is built, or replace it with the old one cp /var/lib/dpkg/status-old /var/lib/dpkg/status

I also know these commands dpkg --configure -a and dpkg-reconfigure -phigh -a, they should be useful but I don't know when. Try them at different points. Don't forget to sudo apt-get update at least once before the configure.

7
  • Tried re-installing, did not work Will try the other 2 ones, and if they don't work, I'll create the instance all over again - no other choice Apr 23, 2014 at 15:03
  • second option gives the following error : -bash: /usr/bin/python: No such file or directory Apr 23, 2014 at 15:05
  • After deleting the status file: E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory) E: The package lists or status file could not be parsed or opened. Apr 23, 2014 at 15:07
  • The thing with the .postinst file is a bit tinkering cause you don't actually modify dpkg nor the python package but it worked for me :p I'm no pro in Ubuntu so I don't know the whys and hows, but this solved my similar problem when I was trying to install additional dbus packages
    – Yellrag
    Apr 23, 2014 at 15:08
  • Ok, try copying the old one then, I must have gotten mixed up
    – Yellrag
    Apr 23, 2014 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .