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)