Read only root filesystem after powerloss

im using a openwrt OpenWrt 22.03.2 r19803-9a599fee93 x86_64 on a Intel xeon E-2224G pc as a router and SSD 128gb as storage. and i got problem readonly file system on /dev/root because power out.

already read and try this too Read only root filesystem but still not worked

BusyBox v1.35.0 (2023-07-04 20:11:53 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 22.03.2, r19803-9a599fee93
 -----------------------------------------------------
root@Router_core:~# mount -o remount,rw /
mount: mounting /dev/root on / failed: Read-only file system

mount status

root@Router_core:~# mount
/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,nsdelega                                                te)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/sda1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,ioch                                                arset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,ioch                                                arset=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)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
/dev/root on /opt/docker type ext4 (ro,noatime)

release

root@Router_core:~# uname -a
Linux Router_core 5.10.146 #0 SMP Fri Oct 14 22:44:41 2022 x86_64 GNU/Linux
root@Router_core:~# cat /etc/os-release
NAME="OpenWrt"
VERSION="22.03.2"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 22.03.2"
VERSION_ID="22.03.2"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r19803-9a599fee93"
OPENWRT_BOARD="x86/64"
OPENWRT_ARCH="x86_64"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 22.03.2 r19803-9a599fee93"

lsblk and df -h

root@Router_core:~# lsblk
NAME     MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda        8:0    0 119.2G  0 disk
├─sda1     8:1    0    16M  0 part /boot
│                                  /boot
├─sda2     8:2    0 119.2G  0 part /opt/docker
│                                  /
└─sda128 259:0    0   239K  0 part

root@Router_core:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               117.7G      2.6G    115.1G   2% /
tmpfs                     3.8G      2.8G   1000.4M  74% /tmp
/dev/sda1                16.0M      5.7M     10.2M  36% /boot
/dev/sda1                16.0M      5.7M     10.2M  36% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/root               117.7G      2.6G    115.1G   2% /opt/docker

output e2fsck on /dev/root

root@Router_core:~# e2fsck /dev/root
e2fsck 1.46.5 (30-Dec-2021)
e2fsck: No such file or directory while trying to open /dev/root
Possibly non-existent device?

before re-flashing, is there any other way to solve this?

Thank You

Try this:
e2fsck -p /dev/sda2

2 Likes

oke this command already try,

root@Router_core:~# e2fsck -p /dev/sda2
rootfs contains a file system with errors, check forced.
rootfs: Deleted inode 536 has zero dtime.  FIXED.
rootfs: Deleted inode 2067 has zero dtime.  FIXED.
rootfs: Deleted inode 2140 has zero dtime.  FIXED.
rootfs: Deleted inode 3462849 has zero dtime.  FIXED.
rootfs: Deleted inode 3462856 has zero dtime.  FIXED.
rootfs: Unattached inode 2902034


rootfs: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)

and still

root@Router_core:~# mount -o remount,rw /
mount: mounting /dev/root on / failed: Read-only file system

Well, it told you that there is still a problem. Run it as mentioned.

hmm

well fsck not found,

but using you command agan

to

e2fsck -y /dev/sda2

e2fsck 1.46.5 (30-Dec-2021)
rootfs contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #446 (1690, counted=1689).
Fix? yes
Free blocks count wrong for group #518 (13698, counted=13703).
Fix? yes
Free blocks count wrong for group #520 (32349, counted=32350).
Fix? yes
Free blocks count wrong for group #523 (4725, counted=4728).
Fix? yes
Free blocks count wrong for group #524 (32109, counted=32112).
Fix? yes
Free blocks count wrong (30165697, counted=30191856).
Fix? yes
Inode bitmap differences:  -536 -2067 -2140 +2902034 +2902055 +2902065 -3462849 -3462856
Fix? yes
Free inodes count wrong for group #0 (2973, counted=2976).
Fix? yes
Free inodes count wrong for group #436 (6654, counted=6651).
Fix? yes
Free inodes count wrong for group #520 (4899, counted=4901).
Fix? yes
Free inodes count wrong (6270899, counted=6277555).
Fix? yes

rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: ***** REBOOT SYSTEM *****
rootfs: 72269/6349824 files (0.9% non-contiguous), 1062689/31254545 blocks
root@Router_core:~# reboot

and the filesystem no longer read only

root@Router_core:~# mount
/dev/root on / type ext4 (rw,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)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
/dev/root on /opt/docker type ext4 (rw,noatime)

I'm a bit stupid for this :sweat_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.