Welcome! Log In Create A New Profile

Advanced

Zyxel NAS326 Installation Instruction

Posted by bodhi 
Re: Zyxel NAS326 Installation Instruction
June 05, 2023 02:29PM
xanatos,

I don't reread posts in unless I try to find something. Did not realize there were more info when you updated.

> So the stock kernel seems to be much much faster
> (at least with btrfs).

I did not pay much attention to btrfs. So not sure what can be improved in the kernel or user space.

> Made some tests with Ext4. The Ext4 partition is
> at the end of the disk. The results with the stock
> kernel and with the latest kernel are much more
> similar:

> Stock firmware:

> 3040387403 bytes (2.8GB) copied, 24.732981
> seconds, 117.2MB/s

> real 0m 24.73s
> user 0m 0.08s
> sys 0m 3.38s

> Debian Kernel 6.2.8:

> 3040387403 bytes (3.0 GB, 2.8 GiB) copied, 24.3131
> s, 125 MB/s

> real 0m24.328s
> user 0m0.248s
> sys 0m6.969s

> The sys time doubles (that for a small CPU like
> the one in the NAS326 is important),

Usually I'd like to see the sys time larger in task like this. It just mean the modern Ext4 file system driver is different.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
August 02, 2023 04:16PM
Might not be the best place to post this, feel free to remove - just wanted to say I appreciate your hard work in keeping this hardware useful. You're the man.

-ds
Re: Zyxel NAS326 Installation Instruction
August 02, 2023 11:28PM
ds,

Thanks for the feedback!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
August 11, 2023 11:20AM
No way to install debian on NAND?.

Maybe the hdd would be an alternative, but I'm worried about it not being able to sleep and spin down.

Any advice?.
Re: Zyxel NAS326 Installation Instruction
August 12, 2023 12:01AM
Pachis,

> No way to install debian on NAND?.

This box NAND flash is too small for Debian rootfs.


> Maybe the hdd would be an alternative, but I'm
> worried about it not being able to sleep and spin
> down.

I would not worry about HDD not spinning down.


However, if you really want to keep the HDD sleeping most of the time, you can run the rootfs on USB. Take precaution such as backing up regularly, and move logs to /tmp to prolong the USB flash drive life.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
August 14, 2023 05:08PM
Thanks for your support bodhi.

Didn't take in account this is a full Debian, was thinking on OS like Openwrt whose space requirements are more reduced.

I just bought a small usb flash drive with good performance (Samsung FIT), planning to install rootfs on it. Original firmware lacks a lot of functionality nowadays... no VPN client/server, no Zerotier... only basic usage.
Re: Zyxel NAS326 Installation Instruction
August 16, 2023 04:12PM
I have been struggling with SMB performance and other protocols. With stock firmware you get +- 90MB/s (gigabit limit more or less) and about 30% cpu usage, pretty good for a cheap NAS. With Debian and OMV6 you get 40MB/s at most with the CPU maxed out.

I tried to fine tuning SMB with all kind of parameteres, turning flow control off and so on, but couldn't pass 50MB/s with 90%CPU.

After investigating I noticed a thing that could be relevant and is that latest kernel lacks the cryptodev module (https://github.com/cryptodev-linux/cryptodev-linux), you can check that /dev/crypto is non existant in 6.3.8 kernel, but it exists in stock firmware kernel.

I can't assure that this issue has a direct impact in SMB performance, but I think is likely to occur. Anyway, missing cryptodev module will impact in SSL and AES encryption tasks (https, webdav, vpn, zerotier, ...), as hardware dedicated crypto engine from ARMADA 38x chip is not being used.

I tried to compile module by myself but my Linux skills are limited, it seems that kernel headers are missing and MAKE throws an error. Any advice?.
Re: Zyxel NAS326 Installation Instruction
August 17, 2023 12:40AM
Pachis,

> After investigating I noticed a thing that could
> be relevant and is that latest kernel lacks the
> cryptodev module
> (https://github.com/cryptodev-linux/cryptodev-linux),
> you can check that /dev/crypto is non existant in
> 6.3.8 kernel, but it exists in stock firmware
> kernel.

This box has Armada 380 SoC, so no need to compile cryptodev. The driver used is armada-38x-crypto. Also the rootfs Debian-5.13.8-mvebu-tld-1-rootfs-bodhi.tar.bz2 is armhf. So you have all necessary parts regarding encryption tasks.

Samba performance is a different issue. This Wiki thread post about Samba tuning could be a bit old, but it's worth a try.

Quote

Perfornance Tuning & Benchmarks

Pogo ProV3 vs Pogo E02
Another Pogo Pro V3 benchmarks
Network performance - SAMBA - NFS (various protocols)
Pogo Pro V3 Network NFS benchmarks
Kirkwood vs OXNAS network performance (with flow control)
Kirkwood vs OXNAS network performance (flow control turned off )
OXNAS vs OXNAS network performance (flow control turned off)
Samba Tuning
Mount NTFS with big_writes
Increase NFSD max_block_size
Reduce NFSD threads

Note that Samba performance is also affected by the network and HDD performance. Network performance has been checked out to be optimal with this kernel. HDD performance is harder to tell in general, because each user's hardware configuration is different.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
August 18, 2023 05:18AM
Also, check your dmesg for armada-38x-crypto.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
August 19, 2023 05:05PM
> This box has Armada 380 SoC, so no need to compile
> cryptodev. The driver used is armada-38x-crypto.
> Also the rootfs
> Debian-5.13.8-mvebu-tld-1-rootfs-bodhi.tar.bz2 is
> armhf. So you have all necessary parts regarding
> encryption tasks.

I might need to check one more thing regarding encryption tasks for this box. I forgot whether the crypto SRAM definitions are needed in the DTS for this NAS326 box.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
October 19, 2023 02:40PM
I'm trying to start Debian according to your instructions.
Section B. The firmware lacks the fw_saveenv command, and without it, values ​​entered through fw_setenv are not saved after a reboot
Re: Zyxel NAS326 Installation Instruction
October 19, 2023 03:48PM
RRRrrr,

> I'm trying to start Debian according to your
> instructions.
> Section B. The firmware lacks the fw_saveenv
> command, and without it, values ​​entered
> through fw_setenv are not saved after a reboot

You can either:

1. Run the fw_setenv directly from the Debian rootfs. Assuming the USB Debian rootfs is mounted at /mnt/sdb1.

/mnt/sdb1/usr/bin/fw_printenv
/mnt/sdb1/usr/bin/fw_setenv

or

2. Download the binpack that I provided a long time ago:

https://forum.doozan.com/read.php?3,27280

While in stock OS, you can download the following binpack so that the normal tools for use in nand installation will be available in the system. Since Dropbox use https, you can download it to an USB stick on another Linux box and copy this tarball to the stock OS (I'll upload this to my available storage here so stock wget can be used, when I can).

Quote

Dowload at Dropbox
linux-tools-installation-bodhi.tar.gz
md5:
e58f442411eb35e641d40ea0577e00ff linux-tools-installation-bodhi.tar.gz
sha256:
88dfa8eadb319e2e286320643a654bf89bff0b0d450562fce09938e7f3b0007d linux-tools-installation-bodhi.tar.gz
Date: May 18 00:31 PST

This binpack contains these files:
tools/
tools/busybox
tools/e2fsck
tools/nanddump
tools/fw_printenv
tools/flash_erase
tools/nandwrite
tools/fw_env.config

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
October 20, 2023 05:48AM
> 1. Run the fw_setenv directly from the Debian
> rootfs. Assuming the USB Debian rootfs is mounted
> at /mnt/sdb1.

> 2. Download the binpack that I provided a long
> time ago:

To issue commands from Debian, you must first run it. And for this you need to make changes to boot_env.
The original software has the commands fw_setenv and fw_printenv, but there is no command fw_saveenv (not fw_setenv). And without it, the settings in mtd are not saved.
It works via UART. But there is another thought and I think I’ll write it later.



Edited 4 time(s). Last edit at 10/20/2023 10:38AM by RRRrrr.
Re: Zyxel NAS326 Installation Instruction
October 20, 2023 01:21PM
RRRrrr,

> The original software has the commands fw_setenv
> and fw_printenv, but there is no command
> fw_saveenv (not fw_setenv).

There is no such command as fw_saveenv. To change and save envs at the same time, use fw_setenv.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
October 21, 2023 10:37AM
I figured out what was going on.
But I don’t understand where the error is.
Original Firmware modifies the mtd1 partition and the fw_setenv command works fine.
But... The UBoot looks for parameters at a completely different address and I don’t understand why.

Start of section mtd1 - 0200000
We read the data at this address and see the data entered from the Original Firmware
Marvell>> nand read 0x2000000 0x200000 0x200000
nand read 0x2000000 0x200000 0x200000

NAND read: device 0 offset 0x200000, size 0x200000
Skipping bad block 0x002c0000
Skipping bad block 0x00400000
 2097152 bytes read: OK
Marvell>> md 2000000
md 2000000
02000000: 191bc957 65767766 6f697372 3d315f6e    W...fwversion_1=
02000010: 322e3556 41412831 332e465a 65720029    V5.21(AAZF.3).re
02000020: 69736976 315f6e6f 3131353d 63003336    vision_1=51163.c
02000030: 5f65726f 63656863 6d75736b 393d315f    ore_checksum_1=9
02000040: 66333535 32316166 64323833 39346635    553ffa12382d5f49
02000050: 33613362 39346438 35646231 00623137    b3a38d491bd571b.
02000060: 5f646c7a 63656863 6d75736b 353d315f    zld_checksum_1=5
02000070: 36653832 38643930 38386362 39303866    28e609d8bc88f809
02000080: 35376562 31386433 33366634 00333432    be753d814f63243.
02000090: 666d6f72 5f656c69 63656863 6d75736b    romfile_checksum
020000a0: 353d315f 00383835 5f676d69 63656863    _1=5588.img_chec
020000b0: 6d75736b 643d315f 34336532 34373034    ksum_1=d2e344074
020000c0: 35656632 31373463 37356261 35366538    2fe5c471ab578e65
020000d0: 31613566 00376335 61687465 3d726464    f5a15c7.ethaddr=
020000e0: 443a3842 36323a35 3a34413a 463a4633    B8:D5:26:A4:3F:F
020000f0: 65730036 6c616972 6d756e5f 3d726562    6.serial_number=
Marvell>> nand read 0x2000000 0x420000 0x200000
nand read 0x2000000 0x420000 0x200000
Now look where the UBoot writes its variables
Marvell>> resetenv
resetenv
Erasing 0x420000 - 0x620000:[Done]
Warning: Default Environment Variables will take effect Only after RESET

We read the data from this address and see:
NAND read: device 0 offset 0x420000, size 0x200000
 2097152 bytes read: OK
Marvell>> md 2000000
md 2000000
02000000: da10344a 544e4f43 545f5952 3d455059    J4..CONTRY_TYPE=
02000010: 46004646 55544145 425f4552 303d5449    FF.FEATURE_BIT=0
02000020: 4f4d0030 5f4c4544 423d4449 00333033    0.MODEL_ID=B303.
02000030: 444f5250 5f544355 454d414e 4754533d    PRODUCT_NAME=STG
02000040: 3832332d 4e455600 5f524f44 454d414e    -328.VENDOR_NAME
02000050: 74694d3d 74536172 54207261 6e686365    =MitraStar Techn
02000060: 676f6c6f 6f432079 002e7072 64756162    ology Corp..baud
02000070: 65746172 3531313d 00303032 746f6f62    rate=115200.boot
02000080: 73677261 6e6f633d 656c6f73 7974743d    args=console=tty
02000090: 312c3053 30323531 62752030 746d2e69    S0,115200 ubi.mt
020000a0: 2c343d64 38343032 6f6f7220 74736674    d=4,2048 rootfst
020000b0: 3d657079 66696275 6f722073 753d746f    ype=ubifs root=u
020000c0: 3a306962 746f6f72 20317366 72207772    bi0:rootfs1 rw r
020000d0: 64746f6f 79616c65 6200323d 64746f6f    ootdelay=2.bootd
020000e0: 79616c65 6300333d 5f727275 746f6f62    elay=3.curr_boot
020000f0: 6d6f7266 6900313d 64646170 30313d72    from=1.ipaddr=10
Marvell>>
At this address are the variables that UBoot uses when booting

This address is inside mtd2 and Original Firmware (Linux) format mtd2 when loading, because it considers that an error has occurred.
The next time you boot, UBoot does not find its data and again formats this piece of memory and writes its variables there, spoiling mtd2 for Original Firmware.
Please see if you have a nand dump, I'll try to reflash UBoot to understand what's wrong



Edited 1 time(s). Last edit at 10/21/2023 10:38AM by RRRrrr.
Re: Zyxel NAS326 Installation Instruction
October 21, 2023 07:39PM
RRRrrr,


> Please see if you have a nand dump, I'll try to
> reflash UBoot to understand what's wrong

I'm not sure I understood why you need the original u-boot dump. You can boot into stock OS to do the flashing, then you can dump mtd0 on your box. It has not changed.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
October 22, 2023 07:18AM
In my NAS326 original firmware (Linux) saves data with the fw_setenv command at 0х200000-.... (mtd1)
But U-Boot read and saves data from/to 0x420000-... (inside mtd2)
And i don't understood why.

I think, that it is a U-Boot mistake.
And and I want to install another version of it

Yesterday I installed this version (see attaching file). But it didn't change anything



Edited 1 time(s). Last edit at 10/22/2023 07:21AM by RRRrrr.
Attachments:
open | download - NAS326.zip (449.2 KB)
Re: Zyxel NAS326 Installation Instruction
October 22, 2023 01:22PM
Don't use resetenv. Try this:

setenv test_1 yes
saveenv
printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
October 23, 2023 01:06AM
I don't use resentv now, but U-Boot read and saves data from/to 0x420000-... (inside mtd2)
And i don't understood why.
Re: Zyxel NAS326 Installation Instruction
October 23, 2023 01:01PM
RRRrrr,

With serial console connected, power up and let it boot into stock OS.

And post the entire serial console log here (or pastebin).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
jaro
Re: Zyxel NAS326 Installation Instruction
November 13, 2023 12:22PM
Hi guys. I have inserted second HDD (8TB), with ext4 fs into my NAS326. Then I tried to backup data from the original HDD (8TB, ext4 ) to the new one. And I was surprised by copy speed. Speed was between 40-60MB/s when copying big files (>1TB). CPU load around 1.9.

Then I have booted to the original zyxel system and copy speed was much higher. Around 140MB/s.

I just want to ask whether you have same speeds, just to be sure that this is maximum I can get from my device.
Re: Zyxel NAS326 Installation Instruction
November 13, 2023 02:21PM
jaro,

The HDD performance with Ext4 file system depends on a lot of factors. Usually stock OS has specific patches that never got to mainline Linux.

So first we would want to check the raw speed of the HDD
hdparm -tT --direct /dev/sda
hdparm -tT --direct /dev/sdb
... and so on. To make sure there is no problem wih the kernel.

And then look (ie. google) for optimization hints that are specific for Ext4.

I only run this box with 1 HDD so never really pay attention to this topic. May be others will chime in to help.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
jaro
Re: Zyxel NAS326 Installation Instruction
November 14, 2023 06:14AM
Hi bodhi,

hdpram info looks fine. There must be an other issue, but I'm not able to find it out. I will try to setup debian from scratch.

root@nas326:/media# hdparm -tT  --direct /dev/sda

/dev/sda:
 Timing O_DIRECT cached reads:   826 MB in  2.00 seconds = 412.81 MB/sec
 Timing O_DIRECT disk reads: 456 MB in  3.00 seconds = 151.79 MB/sec
root@nas326:/media# hdparm -tT  --direct /dev/sdb

/dev/sdb:
 Timing O_DIRECT cached reads:   856 MB in  2.00 seconds = 427.35 MB/sec
 Timing O_DIRECT disk reads: 556 MB in  3.01 seconds = 184.89 MB/sec
jaro
Re: Zyxel NAS326 Installation Instruction
November 20, 2023 02:30AM
I tried 6.0.7 and 5.13.8 kernel but result is still the same. Box is running at 100% and copying is slow (~40-60MB/s; one big file).

Bodhi, it is possible to compile a older kernel from https://github.com/MarvellEmbeddedProcessors/linux-marvell repo? Maybe there are some optimizations for Marvell CPUs. Or maybe you already did it in the past.


top - 08:54:17 up  1:18,  3 users,  load average: 2.03, 2.03, 1.62
Tasks: 125 total,   5 running, 120 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.7 us, 96.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    489.6 total,    104.1 free,     79.6 used,    305.9 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    216.5 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 3248 root      20   0    9008   2392    896 R  71.9   0.5   3:39.03 mc
   48 root      20   0       0      0      0 R  12.7   0.0   3:29.09 kswapd0
  662 root      20   0       0      0      0 I   9.7   0.0   0:57.50 kworker/u2:3-events_unbound
 1766 root      20   0       0      0      0 I   2.7   0.0   0:31.08 kworker/u2:6-ext4-rsv-conversion
  904 root     -51   0       0      0      0 S   0.3   0.0   0:02.96 irq/51-mmc0
 1997 root      20   0  104836   1712    652 S   0.3   0.3   0:01.78 rrdcached
 2498 root      20   0    6084   1152    640 S   0.3   0.2   0:12.42 top
 2646 root      20   0   11900   1764    896 S   0.3   0.4   0:01.86 sshd
 3054 root      20   0       0      0      0 I   0.3   0.0   0:24.35 kworker/u2:2-writeback
 3078 root      20   0       0      0      0 I   0.3   0.0   0:02.92 kworker/0:3-events
 3267 root      20   0    6184   1408    896 R   0.3   0.3   0:01.33 top
    1 root      20   0   30796   4968   2536 S   0.0   1.0   0:10.37 systemd
    2 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kthreadd
    3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp
    4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp
    5 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns
    7 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri
   10 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq
   12 root      20   0       0      0      0 I   0.0   0.0   0:00.00 rcu_tasks_kthread
   13 root      20   0       0      0      0 I   0.0   0.0   0:00.00 rcu_tasks_trace_kthread
   14 root      20   0       0      0      0 S   0.0   0.0   0:01.26 ksoftirqd/0
   15 root      20   0       0      0      0 R   0.0   0.0   0:01.07 rcu_preempt
   16 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0
   17 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0
   18 root      20   0       0      0      0 S   0.0   0.0   0:00.02 kdevtmpfs
   19 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 inet_frag_wq
   20 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kauditd
   21 root      20   0       0      0      0 S   0.0   0.0   0:00.00 khungtaskd
   22 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper
   23 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback
   24 root      20   0       0      0      0 S   0.0   0.0   0:00.13 kcompactd0
   25 root      25   5       0      0      0 S   0.0   0.0   0:00.00 ksmd
   26 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kintegrityd
   27 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kblockd
   28 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 blkcg_punt_bio
   29 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 ata_sff
   30 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 md
   31 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 watchdogd
   32 root       0 -20       0      0      0 I   0.0   0.0   0:00.94 kworker/0:1H-kblockd
   33 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rpciod
   34 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 xprtiod
   50 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 nfsiod
  652 root      20   0       0      0      0 S   0.0   0.0   0:00.02 scsi_eh_0
  653 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 scsi_tmf_0
  657 root      20   0       0      0      0 S   0.0   0.0   0:00.02 scsi_eh_1
  658 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 scsi_tmf_1
  876 root      20   0       0      0      0 S   0.0   0.0   0:00.00 scsi_eh_2
  877 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 scsi_tmf_2
  879 root      20   0       0      0      0 R   0.0   0.0   0:05.58 usb-storage
  882 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 raid5wq
  892 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 dm_bufio_cache
  893 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kmpathd
  894 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kmpath_handlerd

Re: Zyxel NAS326 Installation Instruction
November 20, 2023 01:45PM
jaro,

> Bodhi, it is possible to compile a older kernel
> from
> https://github.com/MarvellEmbeddedProcessors/linux-marvell
> repo? Maybe there are some optimizations for
> Marvell CPUs. Or maybe you already did it in the
> past.

Not likely with current tool chain. That kernel was too old.

I think your research should be on Ext4 file system, see how other people optimized it. Don't waste time trying other older kernels.

Remember that stock FW might have some customization that are not recommended (i.e. unsafe to use). A lot of time, they rely on RAID as remedy of their unsafe performance tweaks.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/20/2023 02:27PM by bodhi.
Re: Zyxel NAS326 Installation Instruction
November 21, 2023 02:12PM
jaro,

If you could, boot back to the stock FW and log in.

Mount the Ext4 HDDs and get mount info.

mount

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
July 23, 2024 08:42PM
Hi, there seem to be here some extremely proficient users so let me ask a question before I try to Debian my after-warranty Zyxel NAS326:

It reverts to defaults on every reboot/power. I attach full dmesg but there are some worrying lines about bad blocks in NAND:
Quote

Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
nand_read_bbt: bad block at 0x000005da0000
7 ofpart partitions found on MTD device armada-nand
Creating 7 MTD partitions on "armada-nand":
0x000000000000-0x000000200000 : "U-Boot"
0x000000200000-0x000000400000 : "U-Boot env"
0x000000400000-0x000000e00000 : "Config"
0x000000e00000-0x000001d00000 : "Kernel-1"
0x000001d00000-0x000008700000 : "RootFS-1"
0x000008700000-0x000009600000 : "Kernel-2"
0x000009600000-0x000010000000 : "RootFS-2"

UBI: attached mtd4 (name "RootFS-1", size 106 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 847, bad PEBs: 1, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 4122008704
UBI: available PEBs: 0, total reserved PEBs: 847, PEBs reserved for bad PEB handling: 39

UBI: attached mtd6 (name "RootFS-2", size 106 MiB) to ubi6
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 840, bad PEBs: 8, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 739781561
UBI: available PEBs: 0, total reserved PEBs: 840, PEBs reserved for bad PEB handling: 32

Is there anything on earth I can do to make it keep the configuration on original firmware?
Attachments:
open | download - dmesg.txt (24.4 KB)
Re: Zyxel NAS326 Installation Instruction
July 23, 2024 11:30PM
achlebek,

> Hi, there seem to be here some extremely
> proficient users so let me ask a question before I
> try to Debian my after-warranty Zyxel NAS326:

Yes, do install Debian. Stock OS should be used only as a fallback/rescue system when you have problem and need to fix Debian rootfs.

>
> It reverts to defaults on every reboot/power. I
> attach full dmesg but there are some worrying
> lines about bad blocks in NAND:

> nand_read_bbt: bad block at 0x000005da0000

0x000001d00000-0x000008700000 : "RootFS-1" 
0x000008700000-0x000009600000 : "Kernel-2" 
0x000009600000-0x000010000000 : "RootFS-2"


> Is there anything on earth I can do to make it
> keep the configuration on original firmware?

The bad block 0x000005da0000 is in your stock rootfs-1. So I think the best thing to do is to force it to boot kernel-2 each time. There are 2 or 3 envs that determine what kernel will be try next time you boot. And if it fails, it will switch to the other kernel and rootfs. So since rootfs-1 is bad, you need to force it to try kernel-2.

Power up, interrupt serial console and,
printenv
and post the entire log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 Installation Instruction
July 24, 2024 05:53AM
Thank you bodhi.
Is there an SSH way to blindly make it boot kernel-2? I never tinkered with serial console, I would need to get an adapter and do some research, hopefully that's not beyond my scope of expertise...
Re: Zyxel NAS326 Installation Instruction
July 24, 2024 05:32PM
achlebek,

> Thank you bodhi.
> Is there an SSH way to blindly make it boot
> kernel-2?

Yes. But it is always riskier when you don't have serial console. Because you cannot see any problem booting up after you've made the change.

Let see if your stock OS has these set up. SSH into stock OS and

cat /etc/fw_env.config
fw_printenv


> I never tinkered with serial console, I
> would need to get an adapter and do some research,
> hopefully that's not beyond my scope of
> expertise...

This NAS326 box has serial console header already populated with pins, so it is quite easy (no soldering needed). Here is relevant posts

https://forum.doozan.com/read.php?3,51739,51919#msg-51919
https://forum.doozan.com/read.php?8,13263

I would get the CP2012 serial module converter (quite cheap on eBay). The Prolific PL3xxx also works fine.

Find one that you can order and post here, I'll check it for you.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: