Ubuntu – Apport aptget returning E: Sub-process /usr/bin/dpkg returned an error code (1)


There seems to be a lot of question like this but none have solved my problem. I was trying to install libprotobuf-dev and protobuf-compiler packages. but couldn't install that. got this error

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libprotobuf-dev is already the newest version (2.6.1-1.3).
protobuf-compiler is already the newest version (2.6.1-1.3).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up apport (2.20.1-0ubuntu2.14) ...
/var/lib/dpkg/info/apport.postinst: 13: /var/lib/dpkg/info/apport.postinst: pycompile: not found
dpkg: error processing package apport (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

One of the solutions told me to move all apport related files from the /var/lib/dpkg/info into /tmp, that also didn't work I get the same error. I have spend several hours behind this error. Couldn't get it sorted. Is there any possible solution?

Best Answer

You need to reinstall pycompile, try this

sudo apt purge apport # purge apport
sudo apt reinstall python-minimal # reinstall python-minimal
sudo apt install apport # install apport
sudo dpkg --configure -a && sudo apt-get install -f # resume last APT session

purging apport makes sure that you can start a clean fresh installation of apport and re-install python-minimal installs pycompile, which is needed for apport

Related Question