Raspbian Stretch OS
I tried sudo apt-get update
and then upgrade
There is no issue with update but upgrade or while installing any package for instance sudo apt-get install tightvncserver
gives the following error :
dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: /var/cache/apt/archives/python-phatbeat_0.1.1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
The first time I encountered it was while installing npm:
dpkg: dependency problems prevent configuration of node-gyp: node-gyp depends on gyp (>= 0.1+20150913git1f374df9); however: Package gyp is not configured yet.
When I tried again installation stuck at:
57% [Connecting to raspbian.raspberrypi.org (2a00:1098:0:80:1000:75:0:3)]^C
And then on every install or upgrade I see dpkg
everywhere.
I tried :
- Uninstalling perl
sudo apt-get remove perl
(Same error occurred) Not able to install it again - As suggested here
sudo rm /etc/apt/sources.list
butsudo software-properties-gtk
command not found error. sudo apt-get autoremove && sudo apt-get autoclean
resulted in Error:
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
sudo dpkg --configure -a
gives :dpkg: error processing package python-phatbeat (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Processing triggers for hicolor-icon-theme (0.15-1) ... Errors were encountered while processing: gyp python-phatbeat
sudo apt --fix-broken install
resulted in Error:perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "en_GB.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_GB.UTF-8"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory (Reading database ... 109991 files and directories currently installed.) Preparing to unpack .../python-phatbeat_0.1.1_all.deb ... /var/lib/dpkg/info/python-phatbeat.prerm: 6: /var/lib/dpkg/info/python-phatbeat.prerm: pyclean: not found dpkg: warning: subprocess old pre-removal script returned error exit status 127 dpkg: trying script from the new package instead ... /var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found dpkg: error processing archive /var/cache/apt/archives/python-phatbeat_0.1.1_all.deb (--unpack): subprocess new pre-removal script returned error exit status 127 /var/lib/dpkg/info/python-phatbeat.postinst: 6: /var/lib/dpkg/info/python-phatbeat.postinst: pycompile: not found dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: /var/cache/apt/archives/python-phatbeat_0.1.1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
*same errors.
In response to @Ingo :
It all started after I tried to install node and npm then uninstalled it. (sudo apt-get install node
then npm and removed them sudo apt-get remove nodejs
+ sudo apt-get remove npm
)
As I removed the sources.list file and couldn't generate again. I created with the content you provided and followed the procedure:
Result: (Also, fixed the locale error)
pi@raspberrypi:~ $ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
fakeroot g++ g++-6 libfakeroot read-edid
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
python-phatbeat
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
8 not fully installed or removed.
Need to get 0 B/5,646 B 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 ... 109860 files and directories currently installed.)
Preparing to unpack .../python-phatbeat_0.1.1_all.deb ...
/var/lib/dpkg/info/python-phatbeat.prerm: 6: /var/lib/dpkg/info/python-phatbeat.prerm: pyclean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found
dpkg: error processing archive /var/cache/apt/archives/python-phatbeat_0.1.1_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python-phatbeat.postinst: 6: /var/lib/dpkg/info/python-phatbeat.postinst: pycompile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/python-phatbeat_0.1.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to reinstall python-phatbeat
and configure gyp and gconf2
?
On pi@raspberrypi:~ $ sudo dpkg --audit | more
:
The following packages are in a mess due to serious problems during installation. They must be reinstalled for them (and any packages that depend on them) to function properly: python-phatbeat Python library for the Pimoroni pHAT BEAT.
The following packages are only half configured, probably due to problems configuring them the first time. The configuration should be retried using dpkg --configure or the configure menu option in dselect: gconf2 GNOME configuration database system (support tools) gyp Cross-platform build script generator
I tried sudo dpkg --configure gconf2
:
Setting up gconf2 (3.2.6-4) ...
/var/lib/dpkg/info/gconf2.postinst: 45: /var/lib/dpkg/info/gconf2.postinst: gconf-schemas: not found
dpkg: error processing package gconf2 (--configure):
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
gconf2