RPi2 "illegal instruction" even though nothing changed

Hello, first time posting here, can't believe "derek" wasn't taken.

I set up node red on a Raspberry Pi 2 to act as an RFID reader, and everything worked perfectly fine for about a week. I had it set up so node red launches right after startup, but now after running any variation of "node-red" or "node-red-pi" it immediately exists with "Illegal instruction", giving no useful error output. I have tried renaming flows.json to flows0.json thinking that maybe I accidentally saved the flow I have either unfinished or with some error but that did nothing. The error appears so instantly that I don't believe it is even at the point where it is reading the flows.

As far as I know there was no system update or change - the RPi was turned off yesterday after it worked fine, and turned on today and it doesn't work anymore.

EDIT: Obviously I looked it up, but it seems like in others' cases the error was either introduced after installing a node/module or it was present right on first launch of node red after installing

EDIT2:

Some more information; after I renamed the flow.json to flow0.json and rebooted, node-red started again. I renamed flow0.json back to flow.json, restarted node-red and everything worked, the flow and the dashboard. Then I rebooted again and now it doesn't work again, getting a "segmentation fault" instead of "illegal operation".

npm -v returns the segfault, node -v reports its version correctly. node-red-start itself works but then gets into a reset loop because it looks like its also getting the segfault internally

How was it turned off? Did you pull the plug/remove power OR shut it down safely?

It might have been just unplugged (done by someone after my shift), though there is no file rw operations being done by the flow (just network sends), and that is a kind of situation that it ideally would have to survive in case of an outage or damage. Do you think something could have gotten corrupted doing that?

Some more information; after I renamed the flow.json to flow0.json and rebooted, node-red started again. I renamed flow0.json back to flow.json, restarted node-red and everything worked, the flow and the dashboard. Then I rebooted again and now it doesn't work again, getting a "segmentation fault" instead of "illegal instruction".

npm -v returns the segfault, node -v reports its version correctly. node-red-start itself works but then gets into a reset loop because it looks like its also getting the segfault internally

This is a good sign of file corruption.

The SD cards do not last forever anyway so it may have been bad timing but pulling the plug does not help.

You could try reinstalling node and npm! And it might work for a while. But I would recommend a new, well-branded SD card with wear levelling and plenty of extra space (to minimise wear) (I'm sure you know all this)

Faulty SD card is what I am suspecting too at this point, I don't have any information about its use history so who knows how much wear it might have gone through (and it is relatively "small" 16 GB). I backed up my home folder while it still can be accessed and I guess I will reinstall the rpi and node red on a new card.

I know this is sort of off-topic, but do you have any tips on SD card selection? I don't reckon ever seeing wear levelling being advertised as a feature, so I'm guessing I should just go for one of the known manufacturer brands.

I will be migrating the entire project onto a SanDisk Max Endurance SD card, and if it no longer shows any problems I will mark this as solved

I keep SD card image backups of all my important Pi systems so that when one fails I can easily burn a replacement. I have six such systems and probably lose about 1 card/year, though I think the frequency is going down as I replace old cards with bigger and better quality new ones.

That seems quite high, have you not considered a small ssd with usb adapter, not that expensive.

From what I understand the RPi can not boot from USB. It can boot from SD and then hand over (?) to USB but it makes the setup more complicated. The high endurance cards seem to be cheap enough, and should have a similar lifespan to an SSD of the same size.

An average life of six years does not seem to be a high failure rate to me.