OpenWrt Forum Archive

Topic: Kernel log says rootfs read-only. Perhaps this explains my problem.

The content of this topic has been archived on 27 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Same silly TP-Link 841N (dead thread:  https://forum.openwrt.org/viewtopic.php … 8#p267218)

I looked a little more, and found that the kernel doesn't like the memory boundaries, so it marks rootfs as read-only.  I guess that might explain why I can't save any configuration changes...

[    0.650000] m25p80 spi0.0: found s25sl032p, expected m25p80
[    0.660000] m25p80 spi0.0: s25sl032p (4096 Kbytes)
[    0.660000] 5 tp-link partitions found on MTD device spi0.0
[    0.670000] Creating 5 MTD partitions on "spi0.0":
[    0.670000] 0x000000000000-0x000000020000 : "u-boot"
[    0.680000] 0x000000020000-0x00000012e660 : "kernel"
[    0.690000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.700000] 0x00000012e660-0x0000003f0000 : "rootfs"
[    0.710000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.720000] mtd: device 2 (rootfs) set to be root filesystem
[    0.730000] 1 squashfs-split partitions found on MTD device rootfs
[    0.730000] 0x000000340000-0x0000003f0000 : "rootfs_data"
[    0.740000] 0x0000003f0000-0x000000400000 : "art"
[    0.750000] 0x000000020000-0x0000003f0000 : "firmware"

Is there anything else that might be of use that I can post?  Could this be fixed with some sort of patch, or do i just throw this crap out?  Makes me leery of hardware altogether, let alone more from this maker.

That is normal.   The rootfs is a squashfs which is inherently read-only anyway.  All the files are compressed and squashed together into one big block.  It is not possible to modify one file without rebuilding the whole block, which can't be done in place on the router.

So when you add or change a file, it is stored in a separate file system -- the overlayfs in the rootfs_data partition.  Further down the log you should see some messages about the creation and/or checking of a jffs2 file system.  This needs to succeed in order to have a writeable root.

The overlayfs appears to be part of the rootfs even though it is in a different place.  For example if you edit /etc/config/network, a complete copy of the new version goes into overlayfs.  The OS then knows to use that file instead of the read-only default version in the squashfs.

The 'df' command will show file systems and free space.  It should look something like this:

root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    4544      1488      3056  33% /
/dev/root                 2240      2240         0 100% /rom
tmpfs                    14540        56     14484   0% /tmp
/dev/mtdblock3            4544      1488      3056  33% /overlay
overlayfs:/overlay        4544      1488      3056  33% /
tmpfs                      512         0       512   0% /dev

On a 4 MB router there will be a lot less free space.

The discussion might have continued from here.