Read only root filesystem

Mini Router/PC with Raspberry Pi Compute Module 4, Dual Gigabit Ethernet NIC s, 4GB RAM/32GB eMMC, Support OpenWRT

I have recently purchased and booted .. but the root filesystem is read-only, when I remount it, am informed the device it write-protected.

BusyBox v1.33.1 (2021-08-25 09:14:02 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02-SNAPSHOT, r16273+15-378769b555
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------

root@OpenWrt:~# passwd
Changing password for root
New password:
Retype password:
passwd: /etc/passwd: Read-only file system
passwd: can't update password file /etc/passwd

root@OpenWrt:~# mount -o remount,rw /
mount: /: cannot remount /dev/mmcblk0p2 read-write, is write-protected.

root@OpenWrt:~# mount
/dev/mmcblk0p2 on / type ext4 (ro,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)

root@OpenWrt:~# fsck -f /dev/mmcblk0p2
-ash: fsck: not found

root@OpenWrt:~# uname -a
Linux OpenWrt 5.4.142 #0 SMP Wed Aug 25 09:14:02 2021 aarch64 GNU/Linux

root@OpenWrt:~# cat /etc/os-release
NAME="OpenWrt"
VERSION="21.02-SNAPSHOT"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 21.02-SNAPSHOT"
VERSION_ID="21.02-snapshot"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r16273+15-378769b555"
OPENWRT_BOARD="bcm27xx/bcm2711"
OPENWRT_ARCH="aarch64_cortex-a72"
OPENWRT_TAINTS="no-all"
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 21.02-SNAPSHOT r16273+15-378769b555"

I've got to believe someone else has already worked this out..

In my case, I ran

e2fsck /dev/mmcblk0p2

e2fsck will fix the corrupted file system

3 Likes

Thank you very much!!
I did not get to it until today, but that exact command worked .. I should have just put the -y option on that, but even without it was not too bad.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.