Settings are not saved after reboot

Hey, guys! I need help, I almost got UAP v2 working on openwrt! Last problem left, my settings are not saved after reboot. It happens every time:

[ 60.311276 ] jffs2: Newly-erased block contained word 0xdeadc0de at offset 0x000000.
[ 60.319138 ] done.
[ 60.321162] jffs2: notice: (1280) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[ 60.761763] overlayfs: upper fs does not support tmpfile.

I have the same problem as here https://note.rajven.ru/?p=418 .What are the options for solving the problem, can you configure the settings to be saved to the 256k(cfg) section on a flash drive?

So, this is how I've been flashing the device:

  1. I found that mtd will unlock if I start flashing the device via UART and cancel the firmware in the middle of the process.
    fwupdate.real -m BZ.qca9342.v3.7.37.6065.170118.0908.bin -d
  2. Then I took the mtd utility from here unpacked and executed
    ./mtd -e kernel write openwrt-ath79-generic-ubnt_nanostation-loco-m-xw-squashfs-sysupgrade.bin kernel
  3. I started getting an error:
[ 0.442204] VFS: Cannot open root device "(null)" or unknown-block(0.0): error -6
[ 0.449857] Please append a correct "root=" boot option; here are the partitions:
[ 0.458355] 1f00 384 mtdblock0
[ 0.458360 ] (driver?)
[ 0.464995 ] 1f01 64 mtdblock1
[ 0.464999 ] (driver?)
[ 0.471649 ] 1f02 7424 mtdblock2
[ 0.471653 ] (driver?)
[ 0.478297 ] 1f03 256 mtdblock3
[ 0.478301 ] (driver?)
[ 0.484935 ] 1f04 64 mtdblock4
[ 0.484939 ] (driver?)
[ 0.491586] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0.0)
  1. I edited the file in the firmware of openwrt/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi (sorry for making it so unprofessional)
&spi {
	status = "okay";
	num-cs = <1>;

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x000000 0x060000>;
				read-only;
			};

			partition@40000 {
				label = "u-boot-env";
				reg = <0x060000 0x010000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x070000 0x740000>;
			};

			partition@7b0000 {
				label = "cfg";
				reg = <0x7b0000 0x040000>;
				read-only;
			};

			art: partition@7f0000 {
				label = "art";
				reg = <0x7f0000 0x010000>;
				read-only;
			};
		};
	};
};

Eventually the dot loads, everything works, but I can't save the settings. What else do I have to do to get her to save the settings somehow?

work log

[    0.000000] Linux version 4.19.108 (user@localhost.localdomain) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r12320-3660a89cb9)) #0 Tue Mar 10 14:50:55 2020
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] MIPS: machine is Ubiquiti Nanostation Loco M (XW)
[    0.000000] SoC: Atheros AR9342 rev 2
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000]   Normal zone: 144 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a8 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 57516K/65536K available (4290K kernel code, 181K rwdata, 1016K rodata, 1224K init, 206K bss, 8020K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 560.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6825930166 ns
[    0.000010] sched_clock: 32 bits at 280MHz, resolution 3ns, wraps every 7669584382ns
[    0.008326] Calibrating delay loop... 278.93 BogoMIPS (lpj=1394688)
[    0.084954] pid_max: default: 32768 minimum: 301
[    0.090131] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097200] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110300] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.120829] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.127483] pinctrl core: initialized pinctrl subsystem
[    0.134202] NET: Registered protocol family 16
[    0.173350] clocksource: Switched to clocksource MIPS
[    0.180101] NET: Registered protocol family 2
[    0.185731] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.194016] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.201442] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.208247] TCP: Hash tables configured (established 1024 bind 1024)
[    0.215169] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.221409] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.228563] NET: Registered protocol family 1
[    0.233243] PCI: CLS 0 bytes, default 32
[    0.237383] Crashlog allocated RAM at address 0x3f00000
[    0.244699] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.259487] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.265756] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.291392] io scheduler noop registered
[    0.295638] io scheduler deadline registered (default)
[    0.303548] pinctrl-single 1804002c.pinmux: 544 pins, size 68
[    0.310771] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.318439] console [ttyS0] disabled
[    0.322279] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 9, base_baud = 2500000) is a 16550A
[    0.331526] console [ttyS0] enabled
[    0.338957] bootconsole [early0] disabled
[    0.355889] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[    0.360898] 5 fixed-partitions partitions found on MTD device spi0.0
[    0.367414] Creating 5 MTD partitions on "spi0.0":
[    0.372287] 0x000000000000-0x000000060000 : "u-boot"
[    0.378324] 0x000000060000-0x000000070000 : "u-boot-env"
[    0.384786] 0x000000070000-0x0000007b0000 : "firmware"
[    0.394646] 2 uimage-fw partitions found on MTD device firmware
[    0.400662] Creating 2 MTD partitions on "firmware":
[    0.405771] 0x000000000000-0x0000001c0000 : "kernel"
[    0.411727] 0x0000001c0000-0x000000740000 : "rootfs"
[    0.417725] mtd: device 4 (rootfs) set to be root filesystem
[    0.425307] 1 squashfs-split partitions found on MTD device rootfs
[    0.431600] 0x000000450000-0x000000740000 : "rootfs_data"
[    0.438118] 0x0000007b0000-0x0000007f0000 : "cfg"
[    0.443890] 0x0000007f0000-0x000000800000 : "art"
[    0.451797] libphy: Fixed MDIO Bus: probed
[    0.815337] libphy: ag71xx_mdio: probed
[    0.820893] ag71xx 19000000.eth: connected to PHY at mdio.0:01 [uid=004dd023, driver=Atheros 8032 ethernet]
[    0.831591] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii
[    0.840548] NET: Registered protocol family 10
[    0.851631] Segment Routing with IPv6
[    0.855561] NET: Registered protocol family 17
[    0.860161] 8021q: 802.1Q VLAN Support v1.8
[    0.873947] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    0.888300] Freeing unused kernel memory: 1224K
[    0.892904] This architecture does not have kernel memory protection.
[    0.899472] Run /sbin/init as init process
[    1.679754] init: Console is alive
[    1.683584] init: - watchdog -
[    2.323371] random: fast init done
[    2.774849] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.862148] usbcore: registered new interface driver usbfs
[    2.867878] usbcore: registered new interface driver hub
[    2.873430] usbcore: registered new device driver usb
[    2.886311] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.895220] ehci-platform: EHCI generic platform driver
[    2.901782] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.919692] init: - preinit -
[    4.136765] random: jshn: uninitialized urandom read (4 bytes read)
[    4.253297] random: jshn: uninitialized urandom read (4 bytes read)
[    4.354221] random: jshn: uninitialized urandom read (4 bytes read)
[    4.761232] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    9.022441] eth0: link up (100Mbps/Full duplex)
[    9.027174] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    9.041500] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    9.077736] urandom-seed: Seed file not found (/etc/urandom.seed)
[    9.200355] eth0: link down
[    9.217753] procd: - early -
[    9.220809] procd: - watchdog -
[    9.862277] procd: - watchdog -
[    9.865917] procd: - ubus -
[   10.010491] urandom_read: 5 callbacks suppressed
[   10.010500] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.098772] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.107049] procd: - init -
[   10.908571] kmodloader: loading kernel modules from /etc/modules.d/*
[   11.099880] Loading modules backported from Linux version v5.4-rc8-0-gaf42d3466bdc
[   11.107637] Backport generated by backports.git v5.4-rc8-1-0-g368e8c51
[   11.183261] xt_time: kernel timezone is -0000
[   11.369503] PPP generic driver version 2.4.2
[   11.385067] NET: Registered protocol family 24
[   11.399947] urngd: v1.0.2 started.
[   11.527753] ath: EEPROM regdomain: 0x0
[   11.527763] ath: EEPROM indicates default country code should be used
[   11.527768] ath: doing EEPROM country->regdmn map search
[   11.527785] ath: country maps to regdmn code: 0x3a
[   11.527792] ath: Country alpha2 being used: US
[   11.527796] ath: Regpair used: 0x3a
[   11.542858] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   11.544839] ieee80211 phy0: Atheros AR9340 Rev:2 mem=0xb8100000, irq=12
[   11.653827] kmodloader: done loading kernel modules from /etc/modules.d/*
[   11.840330] random: crng init done
[   92.134923] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   92.141920] jffs2_build_filesystem(): unlocking the mtd device...
[   92.141924] done.
[   92.150206] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   92.590670] br-lan: port 1(eth0) entered blocking state
[   92.603649] br-lan: port 1(eth0) entered disabled state
[   92.609316] device eth0 entered promiscuous mode
[   92.672200] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   95.116982] jffs2: Newly-erased block contained word 0xdeadc0de at offset 0x00000000
[   95.133607] done.
[   95.135602] jffs2: notice: (1359) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   95.529651] overlayfs: upper fs does not support tmpfile.
[   96.814769] eth0: link up (100Mbps/Full duplex)
[   96.819432] br-lan: port 1(eth0) entered blocking state
[   96.824784] br-lan: port 1(eth0) entered forwarding state
[   96.851749] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[  176.893557] eth0: link down
[  176.897277] br-lan: port 1(eth0) entered disabled state
[ 3307.374652] eth0: link up (100Mbps/Full duplex)
[ 3307.380055] br-lan: port 1(eth0) entered blocking state
[ 3307.385438] br-lan: port 1(eth0) entered forwarding state
1 Like

Is the factory defined "kernel" partition (which running mtd from the factory firmware will use) large enough for the whole OpenWrt kernel + rootfs?

Often the approach is to boot an initramfs OpenWrt then use that to write to flash using the partitioning scheme that OpenWrt uses.

Newly erased block contains unexpected data suggests that there is a flash driver or hardware problem with erasing.

The 256k "cfg" is kept reserved to make it easier to revert to stock firmware. It's just dead space for OpenWrt, though if you really needed another 256kB you could re-define the partitions. OpenWrt should be saving configs as overlay files in rootfs-data.

Dont know what happen, but I think I read it wrong sorry

Hi, factory partitions are 384k(u-boot),64k(u-boot-env),7424k(kernel),256k(cfg),64k(EEPROM)

The flash memory is defined as m25p80 spi0.0: mx25l6405d (8192 Kbytes). And the board has mx25l6408emi-12g installed. Could be a problem because of this?

When the point is reloaded, all created partitions are recreated.

I solved my problem by installing a uboot from loco m2 xw. The first time I flashed I erased my native EEPROM because of that I did not have a wifi module working. Then I assembled firmware dump with native EEPROM and everything worked for me!

1 Like

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