Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read-only file system #409

Closed
olskar opened this issue Jun 4, 2018 · 32 comments
Closed

Read-only file system #409

olskar opened this issue Jun 4, 2018 · 32 comments

Comments

@olskar
Copy link
Contributor

olskar commented Jun 4, 2018

I sometimes get message when for example running autoupdate or trying to edit files: "Read-only file system"

I do not think it is my sd-card that is faulty as I can solve the problem bu running
mount -o remount,rw /system/sdcard
or rebooting.

For some reason the filesystem is made read-only sometimes?

@nik0
Copy link
Collaborator

nik0 commented Jun 4, 2018

I 've got this when the sdcard was "corrupted" it mounts the flesystem in read only.
I had to check fisk on my windows machine.

@goermezer
Copy link

I had this issue too with the previous changes. With the last changes I have not recognized it.

@olskar olskar closed this as completed Jun 9, 2018
@helto4real
Copy link

Getting this alot. Know I have a ok SD card

@youqingkui
Copy link

I have also had this error recently.

@jmtatsch
Copy link
Collaborator

jmtatsch commented Jul 6, 2018

@youqingkui can you please test #527?

@eribowo
Copy link

eribowo commented Jul 11, 2018

  1. update your firmware so there is FSCK tools FSCK tools #527
  2. on your ssh console type mount to see your sdcard mount location. mine /dev/mmcblkop1 . Dont use /system/sdcard path
  3. type dosfsck [flag] [sdcard path] eg:
    dosfsck -a /dev/mmcblkop1

@nik0
Copy link
Collaborator

nik0 commented Jul 11, 2018

There is a way to add this command in run.sh ? I don't know if we can check the status before ...

@olskar
Copy link
Contributor Author

olskar commented Jul 11, 2018

Use fsck on a mounted file system? Thought that was a big NO-NO?

@dmolner
Copy link

dmolner commented Aug 3, 2018

After last update I have this error
I type dosfsck -a /dev/mmcblkop1
the answer is -sh: dosfsck: not found

@jmtatsch
Copy link
Collaborator

jmtatsch commented Aug 3, 2018

Dosfsck is probably not on your path. Either add /system/sdcard/bin to your path or cd there and run it from there.

@dmolner
Copy link

dmolner commented Aug 3, 2018

Hello,
I write
/system/sdcard/bin/dosfsck -a /dev/mmcblkop1 with the same result.
cd /system/sdcard/bin/ dosfsck -a /dev/mmcblkop1 with the same result.

@Dopeyr
Copy link
Contributor

Dopeyr commented Aug 3, 2018

@dmolner Should be /dev/mmcblk0p1 instead of /dev/mmcblkop1 (Zero instead of the letter o)

@dmolner
Copy link

dmolner commented Aug 3, 2018

@Dopeyr
In my /bin i not have dosfsck
I'm sorry , I need help

@Dopeyr
Copy link
Contributor

Dopeyr commented Aug 3, 2018

@dmolner

Hmm, if the sdcard was read only when you did the update, you might not have dosfsck as it could not write it (I guess?).

It's probably best to take the card out, check it on a different machine, format it and then install everything from scratch. You might want to keep a copy of your wpa_supplicant.conf (the wifi settings).

@reikred
Copy link
Contributor

reikred commented Aug 10, 2018

This issue should be reopened. I still have the same problem with ro mount today. Was able to fix via ssh login to shell and running the command

mount -o remount,rw /system/sdcard

So it is presumably not the sdcard that is broken nor a corrupted filesystem. But is does occur when cycling the power to the cameras. Not good for a standalone and remote security camera to behave like this -- one might not have ssh access (to fix the problem) and one might not even notice the problem.

I have had to remount multiple times in the same session, as indicated by dmesg output:

[root@DAFANG:bin]# dmesg | grep unmounted
[ 5.826444] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 101.869210] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 896.681059] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Hardware: Wyzecam V2

@ioanbsu
Copy link

ioanbsu commented Sep 13, 2018

+1 @reikred . I have this issue on regular basis.
running mount -o remount,rw /system/sdcard solves it, but temporary only.

@k1ng440
Copy link

k1ng440 commented Sep 22, 2018

same issue but i cant access ssh.

@sevenofnine-jni
Copy link

Also having the same issue. But when this happens ssh is not working so the only solution is to remove the sd card from the camera wich is a pain beacuse all my cameras are mounted on the wall near the cealing.

@stainlessray
Copy link

Same issue

@ortegafernando
Copy link

Same issue. Sometimes sdcard is read only (Dafang)

@FrankLeith
Copy link

Same issue...

@LouiS22
Copy link
Contributor

LouiS22 commented Oct 22, 2018

Have the same issue

@stainlessray
Copy link

I resolved my issue by formatting the SD and re flashing from scratch. Windows line endings were inserted in several of the config files and rather than trying to find and fix them all I took that route and made sure any file I edited had the LF line endings before saving the file.

@k1ng440
Copy link

k1ng440 commented Nov 15, 2018

can we have an option in the UI to remount the sdcard?

mount -o remount,rw /system/sdcard

@CeccoCQ
Copy link

CeccoCQ commented Dec 8, 2018

Same issue here

@jamman9000
Copy link

jamman9000 commented Dec 18, 2018

Now finally getting my wyzecam v2 jx23 connected to my wifi, I'm having this issue too. Unable to SSH to it either.

Edit: I found a small partition on my SD card that was not being used, seems it may have been the cause of this. If you're fluent with Windows, insert your SD card, right click on "My PC" in file explorer, select Manage. Low on the list you'll see "Storage" and "Disk Management", select that. In the center window there will be a bottom portion that shows the physical disks and then the partitions within them. If your SD card has more than one, kill it all, format, and put the files back on the card.

Edit 2: after unintentional reboots from attempts to use other software integrations (like homebridge), I got this error again. It's able to be cleared by the mount command mentioned above, but pretty sure it will only be temporarily.

@jmtatsch
Copy link
Collaborator

Just start from scratch then

@jgwinner
Copy link

jgwinner commented Jan 6, 2019

I had the same error today; power out. Was about to write it up as the auto-link didn't find the bug, so this is pretty formal :)

  • exact camera hardware:

Wyze Cam, v2 (WYZEC2)

  • the Xiaomi-Dafang-Hacks commitid (from git log) you are experiencing the issue with:
    Downloaded today

Description

I got everything working, changed some settings (Camera name, disabled arrows)

I then pulled the plug to reboot. (I know … probably dumb, but consumers are like that)

Now, despite running fsck from a root terminal session, it still says settings can't be changed, read only file system.

I checked dmesg, and this doesn't look good:

[   20.670239] FAT-fs (mmcblk0p1): error, clusters badly computed (17 != 16)
[   20.677686] FAT-fs (mmcblk0p1): Filesystem has been set read-only

What did you do to debug the issue

Ran fsck:

[root@CARECAM_1:~]# fsck -A -V
fsck (busybox 1.29.0.git)
Checking all filesystems
[root@CARECAM_1:~]#

No joy. No error messages, even with -v, but it didn't fix it either.

Evidence

dmesg given above.

Contribute Back

The fix for me was to move the sdcard back to my PC, and run chkdsk /f. Oddly, it reported no errors:

[C:\]chkdsk e: /f
The type of the file system is FAT.
Volume NEW VOLUME created 1/6/2019 8:28 AM
Volume Serial Number is BCCE-6382
Windows is verifying files and folders...
File and folder verification is complete.

  536,584,192 bytes total disk space.
       16,384 bytes in 2 hidden files.
      253,952 bytes in 31 folders.
   39,690,240 bytes in 211 files.
  496,623,616 bytes available on disk.

        8,192 bytes in each allocation unit.
       65,501 total allocation units on disk.
       60,623 allocation units available on disk.

I'm not sure if the linux distro can handle power outs, but maybe we should convert to ext file system? I'll report back if I figure it out.

@jamman9000
Copy link

What did you do to debug the issue

Ran fsck:

[root@CARECAM_1:~]# fsck -A -V
fsck (busybox 1.29.0.git)
Checking all filesystems
[root@CARECAM_1:~]#

No joy. No error messages, even with -v, but it didn't fix it either.

Evidence

dmesg given above.

Contribute Back

The fix for me was to move the sdcard back to my PC, and run chkdsk /f.

Did you try the command mentioned above? mount -o remount,rw /system/sdcard

@jgwinner
Copy link

jgwinner commented Jan 6, 2019

Did you try the command mentioned above? mount -o remount,rw /system/sdcard

No, honestly I had already fixed it via chkdsk before I saw this thread.

I realize this would help with debugging, but I don't see shell access as a permanent fix. At the most, there could be a UI for doing this in the web pages under setup, but that could generate a DOS attack too.

@devnull404-pi
Copy link

I hope it helps:

Once I had this problem with a Dafang with motion detection activated and capturing snapshots in local storage (I didn't notice I ever activated that option). I was missing that I had only 512MB, and the read only flag in notifications appeared because the storage was already full. Yet, after deleting all media, the error remained. I just had to delete all from de SD card and copy the modified firmware, easy as c/p. Not need to reflash.

@Bazowsky
Copy link

Bazowsky commented Nov 13, 2022

Have same issue every power cycle on camera with ALWAYS ON TIME LAPSE RECORDING to sdcard.

Found dirty solution to put script in /system/sdcard/config/userscripts/startup/chkRO.sh

#!/bin/sh
PATH=/system/sdcard/bin:/system/bin:/bin:/sbin:/usr/bin:/usr/sbin

mkdir /system/sdcard/ReadOnlyTest/
if [ $? -ne 0 ] ; then
        /system/sdcard/bin/audioplay /usr/share/notify/CN/speaker.wav 100
        dosfsck -a /dev/mmcblk0p1
        mount -o remount,rw /system/sdcard
        rm -rf /system/sdcard/ReadOnlyTest/
        reboot
else
        rm -rf /system/sdcard/ReadOnlyTest/
fi

Dont forget to chmod +x /system/sdcard/config/userscripts/startup/chkRO.sh
This runs on every startup, and if mkdir fails, then run dosfsck, then remount, and reboot.

Typical dosfsck output is:

0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
Automatically removing dirty bit.
*** Filesystem was changed ***
Writing changes.
/dev/mmcblk0p1: 1582 files, 11615/60924 clusters

In my case doing just dosfsck and remount, without proper reboot will always cause some problems and kernel crush in next 5-10 minutes.
With proper reboot, all going fine until next power cycle.

/system/sdcard/bin/audioplay /usr/share/notify/CN/speaker.wav 100
command just for fun, you can drop it in you script.

Another approach to do same check, is in placing script in
/system/sdcard/config/cron/periodic/15min/chkRO.sh
But, CRON trying to write log on sdcard, and drop errors like this,

crond: crond (busybox 1.32.0.git) started, log level 8
crond: USER root pid 23646 cmd busybox run-parts /system/sdcard/config/cron/periodic/15min
crond: can't open '/system/sdcard/log/crond.log': Read-only file system

And some times fails to execute script, some times run it, have no idea about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests