OpenWRT suddenly become read-only file system

ubus call system board; uptime; free; df -h; mount
/root$ ubus call system board; uptime; free; df -h; mount
{
	"kernel": "5.15.137",
	"hostname": "OpenWrt",
	"system": "Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz",
	"model": "Dell Inc. OptiPlex 3020",
	"board_name": "dell-inc-optiplex-3020",
	"rootfs_type": "ext4",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.2",
		"revision": "r23630-842932a63d",
		"target": "x86/64",
		"description": "OpenWrt 23.05.2 r23630-842932a63d"
	}
}
 00:51:14 up 1 day, 10:49,  load average: 0.00, 0.00, 0.00
              total        used        free      shared  buff/cache   available
Mem:        3952280      244680     3644044         304       63556     3641532
Swap:             0           0           0
Filesystem                Size      Used Available Use% Mounted on
/dev/root               110.3G      4.7G    105.6G   4% /
tmpfs                     1.9G    168.0K      1.9G   0% /tmp
/dev/sda1                16.0M      6.1M      9.8M  38% /boot
/dev/sda1                16.0M      6.1M      9.8M  38% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/root 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/sda1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda1 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,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
bpffs on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)


Can someone help me? I can't save settings anymore nor update the AdGuardHome filters. Thanks.

This was the last update to my AdGuardHome Filter (Last May 2024)

df -kh ... ?

/root$ df -kh
Filesystem                Size      Used Available Use% Mounted on
/dev/root               110.3G      4.7G    105.6G   4% /
tmpfs                     1.9G    168.0K      1.9G   0% /tmp
/dev/sda1                16.0M      6.1M      9.8M  38% /boot
/dev/sda1                16.0M      6.1M      9.8M  38% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

Your ext4 root partition detected some orphaned files and therefore has prevented the root partition from being mounted as r/w. Boot a linux distro such as gparted and simply run a check with autorepair on your openwrt root partition then just restart your Dell 3020 and you should be fine.

1 Like

Will try this and I'll let you know!

Also, some commands that may help this problem:

/root$ dmesg | grep -i error
[    6.394160] EXT4-fs error (device sda2): ext4_mb_generate_buddy:1149: group 46, block bitmap and bg descriptor inconsistent: 15510 vs 15839 free clusters
[  304.814848] EXT4-fs (sda2): error count since last fsck: 79
[  304.814989] EXT4-fs (sda2): initial error at time 1714454139: __ext4_new_inode:1281
[  304.815104] EXT4-fs (sda2): last error at time 1730440904: ext4_mb_generate_buddy:1149
[86806.186479] EXT4-fs (sda2): error count since last fsck: 79
[86806.186626] EXT4-fs (sda2): initial error at time 1714454139: __ext4_new_inode:1281
[86806.186796] EXT4-fs (sda2): last error at time 1730440904: ext4_mb_generate_buddy:1149
[173312.664685] EXT4-fs (sda2): error count since last fsck: 79
[173312.664836] EXT4-fs (sda2): initial error at time 1714454139: __ext4_new_inode:1281
[173312.665012] EXT4-fs (sda2): last error at time 1730440904: ext4_mb_generate_buddy:1149

Whole dmesg output:

it's just reporting some inconsistencies in the file structure. Simply boot a distro such as gparted and run an autofix on the root partition should fix it without issues.

1 Like

Yet another reason to have two Openwrt installs on x86, one small to do recovery of the live one :slight_smile:

Or to use squash and mount data disks in fscked places.

I personally don't write to my ext4 root partition i.e. just leave it acting like a squashfs partition. It is the persistent writing to the ext4 root partition that causes the filesystem check flag to fire at mount which forces root to mount r/o. Instead, I mount an alternate f2fs partition for all my write-outs such as logging, static leases, etc. Never had a problem since.

I used to report this issue in this thread OpenWRT fsck at boot - #11 by Barney and How to force fsck at boot? - #25 by rakesh, I was constantly fscking the system every reboot in failsafe which was PITA... I've had enough

I just built my own image and enabled CONFIG_TARGET_EXT4_JOURNAL=y and had zero issues ever since (for a couple of months now...)

The argument why this is not enabled by default is because of SBCs like RPi4 killing SD Cards due to journaling (ext4 is apparently preferred de facto/preferred FS for these boards found in old tutorials), but this is just not the case for x86. People tend to hate prematurely killing flash storages here at the cost of minor inconviences...

If you don't want to format your install, then e2fsk it and enable journaling on the partition, that's what I did, zero complaints..

hi,
i use 23.05.4 ext4 setup and tune2fs -l shows Filesystem features: has_journal ext_attr resize_inode filetype needs_recovery extent sparse_super large_file uninit_bg. has_journal if i am not mistaken means journaling is on. as i cannot recall any special configuration was required, i assume by default journaling is on?