I'm using a custom buildroot Linux kernel for Raspberry Pi, based on the Pi kernel 5.10.92 (64-bit). I've flashed this image onto micro SD cards from two different manufacturers and installed them in a custom Pi CM4 PCBA.
After several weeks of use, some SD cards have become unbootable. When I insert the SD card into a Linux machine and run
dmesg, it displays the following:
sd 2:0:0:1: [sdd] 61069312 512-byte logical blocks: (31.3 GB/29.1 GiB) sd 2:0:0:1: [sdd] Write Protect is on sd 2:0:0:1: [sdd] Mode Sense: 23 00 80 00 sdd: sdd1 sdd2 sdd3 sdd4
Some things to note:
Due to the use case of the hardware, the OS automatically reboots every 12 hours
U-boot is the target of the pi’s bootloader to enable a dual-partition (A/B) failover scheme. It checks it’s environment (
The image layout is as follows:
First 4 MB are reserved for u-boot’s environment
Boot partition (fat32)
Rootfs A (ext4)
Rootfs B (ext4)
Persistent data partition (ext4)
When I tried mounting each of the partitions individually on another Linux system, the boot partition (
/dev/sdd1) mounted as read-only. For the other three
EXT4-fs (sdd2): INFO: recovery required on readonly filesystem EXT4-fs (sdd2): write access unavailable, cannot proceed (try mounting with noload)
Even when mounting with the
noload option, the device is still reported as write-protected and mounted read-only, like the FAT32 boot partition.
I'm trying to understand what might have caused the entire block device to become read-only. Currently, I haven't found a consistent method to reproduce this issue on more SD cards, so any suggestions for reproducing the problem would be appreciated. We have other SD cards that have been in use for the same duration or longer without any issues.