Linux – Problem on Linux NAND Root Filesystem

corruptionfilesystemslinuxmemory

I'm have a JFFS2 root filesystem running on a large NAND device. Every once in a while, when I restart the computer, I get error messages about invalid ELF headers when /sbin/init or /bin/login try to load dynamically linked shared libraries from the /lib folder

The errors cause a kernel panic and I'm stuck reflashing the NAND to get the computer up and running again.

Example:

/sbin/init: error while loading shared libraries: /lib/libc.so.6: invalid ELF header
Kernel panic - not syncing: Attempted to kill init!
Call Trace:
[dffc1d20] [c0007c74]  (unreliable)
[dffc1d60] [c0020d68] 
[dffc1db0] [c0025074] 
[dffc1e80] [c00250bc] 
[dffc1f40] [c000f340] 

It seems that somehow the dynamically linked libraries in the /lib folder are becoming corrupted. I don't think that dynamically linked libraries are even written to disk during normal operation (unless you're doing an update). So that rules out a partial write with a loss of power causing the corruption.

So the only other causes I can think of are that either JFFS2 has some sort of terrible bug that is corrupting files that aren't even being written to? Or the NAND itself is being corrupted?

Does anyone have any other ideas? Or am I way off base?

Best Answer

Are you mounting the root partition, or whatever partition your libraries exist on with the "noatime" option? If not, every access is causing a write.