Help needed: changes not persisting over boot (tplink tl-mr6400-v4)

I have tplink tl-mr6400-v4 and have the issue that settings (ie LTE interface settings) are not persisted over reboots. It is most probably me doing something wrong - first tries creating a openwrt image.

basically, as the "official" image from device page did not for some reason work for me, i created new by myself with:

make image PROFILE="tplink_tl-mr6400-v4" PACKAGES="modemmanager uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-material luci-app-opkg -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6onlyd"

uploading and sysupgrading it works well.

but then, if i try to enable wifi and configure LTE module as per this, everything works after i do:

ifup myLTEifName
wifi down
wifi up
/etc/init.d/firewall restart

but after reboot, everything is back in "right after flashing" state (wifi disabled, wifi name OpenWrt, LTE not configured, etc). Same happened when i tried to do changes via luci interface.

diagnostic info:

root@OpenWrt:~# mount
/dev/root on /rom type squashfs (ro,relatime)
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)
tmpfs on /tmp/root type tmpfs (rw,noatime,mode=755)
overlayfs:/tmp/root on / type overlay (rw,noatime,lowerdir=/,upperdir=/tmp/root/upper,workdir=/tmp/root/work)
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)
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 5.5M      5.5M         0 100% /rom
tmpfs                    28.4M    276.0K     28.1M   1% /tmp
tmpfs                    28.4M     60.0K     28.3M   0% /tmp/root
overlayfs:/tmp/root      28.4M     60.0K     28.3M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev

so for my limited understanding overlay is mounted correctly rw and there is plenty of space available too.

please help, what am i doing wrong? let me know if i can provide any other info for determining the cause of issue.

You are mounting overlay from RAM.
This is the output of df -h in my system:

Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    29.8M      3.2M     26.6M  11% /tmp
/dev/mtdblock3           12.2M      7.9M      4.3M  65% /overlay
overlayfs:/overlay       12.2M      7.9M      4.3M  65% /
tmpfs                   512.0K         0    512.0K   0% /dev

Do you see the difference?

1 Like

yes, i see - but where it comes from/why? i downloaded the imagebuilder for my arch and did not do any changes there afaik...where should i look, fstab somewhere in imagebuilder hierarchy?

Check the fstab, then the imagebuilder configuration.

on build host:

cat openwrt-imagebuilder-ramips-mt76x8.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/etc/fstab 
# <file system> <mount point> <type> <options> <dump> <pass>

on a router:

root@OpenWrt:~# cat /etc/fstab 
# <file system> <mount point> <type> <options> <dump> <pass>

I think that you are running out of flash. Firmware image is too big.

You only have 8 MB of flash, and not of it is usable as some is reserved for bootloader etc.

Based on this:

...you have 5.5 MB of packages (plus kernel itself). Probably you go over the max. size of the image, so that no proper overlay can be created at boot.

Check the system log for overlay & jffs2 related output

logread | grep overlay
logread | grep jffs2

PS. fstab has no role here.

Pps. What does cat /proc/mtd say about your partitions?
And there should also be a section in the kernel log, something in style of:

[    1.402240] 8 fixed-partitions partitions found on MTD device qcom_nand.0
[    1.409684] Creating 8 MTD partitions on "qcom_nand.0":
[    1.416529] 0x000000000000-0x000000c80000 : "qcadata"
[    1.426763] random: fast init done
[    1.442980] 0x000000c80000-0x000001180000 : "APPSBL"
[    1.452152] 0x000001180000-0x000001200000 : "APPSBLENV"
[    1.454059] 0x000001200000-0x000001340000 : "art"
[    1.459152] 0x000001340000-0x000001480000 : "artbak"
[    1.464115] 0x000001480000-0x000001880000 : "kernel"
[    1.473571] 0x000001880000-0x000007900000 : "ubi"
[    1.632005] 0x000007900000-0x000008000000 : "reserve"

you might be correct here:

root@OpenWrt:/# logread | grep overlay
Sun Dec  5 17:50:31 2021 daemon.err mount_root: failed - mount -t jffs2 /dev/mtdblock4 /rom/overlay: Not a tty
root@OpenWrt:/# logread | grep jffs2
Sun Dec  5 17:50:31 2021 daemon.err mount_root: failed - mount -t jffs2 /dev/mtdblock4 /rom/overlay: Not a tty

but imagebuilder builds without errors? when i tried adding zerotier for example, then builder failed with "too large image" or smth like that.

but i will try making it smaller nevertheless and report back. thank you

It is possible to create image that is large enough to fit in, but still big enough that there not enough free blocks for overlay creation.

1 Like

You might also look at the log section about partitions.

Looking at the wiki page of your device, https://openwrt.org/toh/tp-link/tl-mr6400_v4 , it contains examples of OpenWrt bootlogs.

[ 0.354403] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.360859] Creating 4 MTD partitions on "spi0.0":
[ 0.365741] 0x000000000000-0x000000020000 : "boot"
[ 0.371788] 0x000000020000-0x0000007c0000 : "firmware"
[ 0.380663] 2 tplink-fw partitions found on MTD device firmware
[ 0.386748] Creating 2 MTD partitions on "firmware":
[ 0.391809] 0x000000000000-0x0000001e5b3e : "kernel"
[ 0.397988] 0x0000001e5b40-0x0000007a0000 : "rootfs"
[ 0.404098] mtd: device 3 (rootfs) set to be root filesystem
[ 0.411993] 1 squashfs-split partitions found on MTD device rootfs
[ 0.418347] 0x000000500000-0x0000007a0000 : "rootfs_data"
[ 0.424950] 0x0000007c0000-0x0000007d0000 : "config"
[ 0.431251] 0x0000007d0000-0x000000800000 : "factory"

...


root@OpenWrt:/# dmesg | grep "partitions" -A5
[    0.393218] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.399654] Creating 4 MTD partitions on "spi0.0":
[    0.404545] 0x000000000000-0x000000020000 : "boot"
[    0.410492] 0x000000020000-0x0000007c0000 : "firmware"
[    0.419432] 2 tplink-fw partitions found on MTD device firmware
[    0.425507] Creating 2 MTD partitions on "firmware":
[    0.430549] 0x000000000000-0x00000020c383 : "kernel"
[    0.436690] 0x00000020c384-0x0000007a0000 : "rootfs"
[    0.442746] mtd: device 3 (rootfs) set to be root filesystem
[    0.450647] 1 squashfs-split partitions found on MTD device rootfs
[    0.457001] 0x000000760000-0x0000007a0000 : "rootfs_data"
[    0.463553] 0x0000007c0000-0x0000007d0000 : "config"
[    0.469606] 0x0000007d0000-0x000000800000 : "factory"
[    0.476596] libphy: Fixed MDIO Bus: probed

on that front all seems to be same...

Not quite.
The rootfs_data (=overlay) is only 4 blocks of 64 kB. That might not be enough for overlay. I think that you need at least 5 blocks.

You have too many packages.
Start with no additional packages, build and check.
Then gradually add packages.

Thank you, gentelmen - hnyman was correct - image was too big. If i only left modemmanager (only way i know currently to make LTE module work), everything works, settings are persisted.
initial
overlayfs:/tmp/root 28.4M 60.0K 28.3M 0% /
large amount of free overlay is probably a clear sign for anyone in the future, as well as the mountpoint /tmp/root

on a working system it looks like this:

Filesystem                Size      Used Available Use% Mounted on
/dev/root                 5.0M      5.0M         0 100% /rom
tmpfs                    28.4M    108.0K     28.3M   0% /tmp
/dev/mtdblock4          640.0K    224.0K    416.0K  35% /overlay
overlayfs:/overlay      640.0K    224.0K    416.0K  35% /
tmpfs                   512.0K         0    512.0K   0% /dev
1 Like

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