I'm using Raspberry Pi 1 model B without GUI and when I try to upgrade software using sudo apt-get upgrade I get the following error:

Segmentation fault
dpkg: warning: subprocess old pre-removal script returned error exit status 139
dpkg: trying script from the new package instead ...
Segmentation fault
dpkg : error processing archive /var/cache/apt/archives/python-rpi.gpio_0.6.2~jessie-1_armhf.deb (--unpack):
subprocess new pre-removal script returned error exit status 139
Segmentation fault
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 139
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried many "solutions" for this problem but none of them have worked, so I guess asking here may help.

I tried sudo aptitude upgrade and I get

dpkg: error processing package python-rpi.gpio (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Processing triggers for libc-bin (2.19-18+deb8u3) ...
Errors were encountered while processing:
  • try sudo apt-get purge python-rpi.gpio the reinstall with sudo apt-get update && sudo apt-get install python-rpi,gpio Mar 3, 2016 at 23:35
  • 1
    A segmentation fault is a memory access violation. You can try a filesystem check - see raspberrypi.stackexchange.com/a/42022/8697 Unfortunately these are rarely recoverable, you should go back to a known backup.
    – Milliways
    Mar 4, 2016 at 0:34

1 Answer 1


[SOLVED] the user @Milliways say it was a memory access violation. so i tried using a different sd card (i was using an 8gb class 6 and now i'm using an 16gb class 10) and everything went perfect now i can upgrade and install anything

  • Please can you mark this answer as correct if it solved your problem
    – Darth Vader
    Jul 20, 2018 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.