I was doing a pi project where pi communicates with a UHF ID card reader via hardware serial and read cards. Pi gets the card information through serial and upload them to a remote database. Also some other common peripherals like LCD, RTC are connected to pi. I programmed the project with python2. OS is raspbian stretch lite.

The project works OK. But after 15 to 30 days later program crashes with error

Illegal instruction

. And when this happens python2 package no longer run. If I run python2 from a terminal it throws same error and exits. Just a single line as shown above.

Can't understand why this is happening. I searched through internet and found that in some cases some modules cause this problem which are related to CPU instructions(Though they are for PCs). But in this case it is not some module which are the source of the problem because if it was then the python interpreter should work properly.

What additional tests can I do to trace the problem?


  • 1
    You should check your power supply. Such spurious errors after dozens of days are unlikely connected to anything software-related. It could also be connected to heat or power glitches introduced by your connected ID reader hardware. – Janka Apr 18 '18 at 4:15
  • 1
    SD card corruption (of course which may be caused by a poor power supply) can also create this problem. Generally more than one command would be affected though. – joan Apr 18 '18 at 4:27
  • I have checked the SD card with badblocks -nv for badblocks in both partition. But found no badblock. @joan Power could be an issue. Both the CPU and reader heated up. But I'm using a 5V 5A power supply. I will give a close look in the power supply. @Janka – Ashfaqur Rahman Apr 18 '18 at 6:10
  • if it is after a specific amount of time then I would look at memory and disk (/tmp) space issues. Also check if any scheduled tasks are setup to run weekly/monthly that might starve the Pi of CPU/Ram etc. If you find the answer please post so others can benefit. – rob Apr 20 '18 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.