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
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)