File system boot check

Just a thought, it should be fairly easy to detect if /boot has become read-only, and run those commands automatically - maybe Sam could add these few lines into the update process?

There is already code to do this but it will only work so well…

People need to stop yanking the power and then wondering why updates don’t work anymore

1 Like

I’m on a raspberry pi and recently my micro sd decided to become read-only. I only noticed when my new downloads didn’t get added to kodi’s sqlite3 database.

I now have a quick check of /proc/mounts at boot.

I don’t think mine was power/shutdown related, just bad luck, though the power here in rural Spain is often flaky. I don’t really want to use a ups, that would consume more power than the pi.

This concerns AppleTV, not Raspberry Pi.

Yes, I’m aware of that, but the read-only filesystem issue isn’t atv only, and a more universal solution could be useful.

I’m open to some suggestions but am not aware of a way to automatically resolve this.

/boot should not be read only on a Pi unless your card is very, very corrupted and if this is the case then an automated fsck is dangerous

Not really, at least not in my experience. As the microsd card was locked in read-only mode, fsck can’t change anything either. The data was 100% readable and intact, in fact I just used rsync to copy everything to a new card. If it was a full size sd card you would think the little switch had been flicked to read-only mode, but it was a microSD on a pi3. My guess is too many write cycles.

For myself, I just check /proc/mounts and if any of the mmcblk0 partitions are ro I generate a warning message and stop. (if the card is ro then all the mmcblk0 partitions will be ro). Trying to remount the card rw is impossible. Can’t even format it once it’s locked.

You could perhaps handle sd differently to hdd, as they can be remounted rw, ad maybe an auto fsck is safe enough there?

It sounds like you have a hardware fault.
The RW protect switch has not effect on Pi.

Yes the card had locked itself into read-only mode as I said earlier. It was definitely a hardware fault, but an ro boot file system is detectable, and if it’s on a hdd it may be fixable.
My solution was a short bash script to send myself a message. You could perhaps put a message on screen…

#!/bin/bash
res=grep "/boot.*\sro[\s,]" /proc/mounts | wc -l
if [ $res -ne 0 ]
then
data=‘{“title”:“OSMC warning”, “type”:“note”, “body”:“Check r/w status of boot partition”}’
curl -X POST -H ‘Access-Token: ’ -H ‘Content-Type: application/json’ -d “$data” https://api.pushbullet.com/v2/pushes
fi

I am of the opinion that it’s more pragmatic to just replace the SD card.

Yes of course, I did, as I said earlier. I used rsync to copy everything over to a new card. This feature request is about detecting the hardware failure (or ro setting) at boot time and warning the user.

Okay, I thought you wanted to:

(i.e. fsck)