Welcome! Log In Create A New Profile

Advanced

ZyXEL nas326 installation problem

Posted by rkachowski 
ZyXEL nas326 installation problem
November 12, 2017 08:54AM
I'm trying this with the ZyXEL nas326 (method B - usb installation without serial) and encountering similar errors as were mentioned here before by @nastynas, notably

* the firmware is reset every time it reboots - ssh access is disabled until initial account setup + configuration
* occasionally locks up on boot (unresponsive, all leds deactivated)

The dmesg boot is here - https://pastebin.com/XqBD2dnP

The steps I followed were

1. ssh access to nas, run fw_printenv (output available https://pastebin.com/8ErKPCtm)
2. run fw_setenv commands, printenv output again ( https://pastebin.com/neMfh8TT )
3. setup usb with Debian-4.12.4-mvebu-tld-1-rootfs-bodhi.tar.bz2 - single partition ext3 with label 'rootfs'
4. sync, unmount usb and insert into nas device
5. sync nas via ssh, and reboot via /sbin/reboot

after step 5 the nas will boot backup into the stock firmware and all the settings will be lost (admin user resets to factory version, ssh disabled + config lost). I've also tried with a cold boot and many (many) reformats of the usb. Where can I go from here?

Thanks for your help



Edited 1 time(s). Last edit at 11/12/2017 04:32PM by bodhi.
Re: ZyXEL nas326 installation problem
November 12, 2017 04:33PM
rkachowski ,

I will take a look later today.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 13, 2017 12:50AM
rkachowski,

1. So I guess you don't have serial console? if you do then it'll be much easier to see what was wrong.

Quote

> 3. setup usb with
> Debian-4.12.4-mvebu-tld-1-rootfs-bodhi.tar.bz2 -
> single partition ext3 with label 'rootfs'

2. Were you root user while you created rootfs like described above?

Boot into stock OS, insert and mount the USB rootfs and (assuming it is mounted at /media/sdb1)

mount
ls -lart /media/sdb1
ls -lart /media/sdb1/boot
e2label /dev/sdb1
cat /proc/mtd
fw_printenv
And please post the log of the above commands here.

---

nastynas mentioned that "Firmware 5.21 breaks this... to get it back to 5.11 for another try at booting into Debian". Do you know which FW version you have?

I wonder if Zyxel has discovered this forum, and so they updated the FW to prevent us from hacking it like I did in the installation.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 13, 2017 09:03AM
Hey,

Thanks for getting back to me. I have firmware V5.20 which came installed with the device. I don't have a serial terminal - I was hoping to follow your usb instructions - but I'll ask around and see if i can acquire one.

The output is below, the disk is /dev/sdb and it automounts to some /e-data/ dir

~ # mount
/proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
ubi6:ubi_rootfs2 on /firmware/mnt/nand type ubifs (ro)
/dev/md0 on /firmware/mnt/sysdisk type ext4 (ro)
/firmware/mnt/sysdisk/sysdisk.img on /ram_bin type ext2 (ro)
/ram_bin/usr on /usr type none (ro,bind)
/ram_bin/lib/security on /lib/security type none (ro,bind)
/ram_bin/lib/modules on /lib/modules type none (ro,bind)
/ram_bin/lib/locale on /lib/locale type none (ro,bind)
/dev/ram0 on /tmp/tmpfs type tmpfs (rw,size=5m)
/tmp/tmpfs/usr_etc on /usr/local/etc type none (rw,bind)
/dev/mapper/vg_b87c0247-lv_42f2cfb2 on /i-data/42f2cfb2 type ext4 (rw,noatime,usrquota,data=ordered,barrier=1)
/dev/mapper/vg_b87c0247-vg_info_area on /mnt/vg_info_area/vg_b87c0247 type ext4 (rw)
/i-data/42f2cfb2/.system/zy-pkgs/pkggui on /usr/local/apache/htdocs/desktop,/pkg type none (rw,bind)
configfs on /sys/kernel/config type configfs (rw)
/dev/sdb on /e-data/9e4bf589de0d92133fb0a12b965e135f type ext3 (rw,errors=continue)
~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
ubi6:ubi_rootfs2         90256     49820     40436  55% /firmware/mnt/nand
/dev/md0               1933584    155504   1661808   9% /firmware/mnt/sysdisk
/dev/loop0              147756    131690     16066  89% /ram_bin
/dev/loop0              147756    131690     16066  89% /usr
/dev/loop0              147756    131690     16066  89% /lib/security
/dev/loop0              147756    131690     16066  89% /lib/modules
/dev/loop0              147756    131690     16066  89% /lib/locale
/dev/ram0                 5120         4      5116   0% /tmp/tmpfs
/dev/ram0                 5120         4      5116   0% /usr/local/etc
/dev/mapper/vg_b87c0247-lv_42f2cfb2
                     2879986144   5390736 2874579024   0% /i-data/42f2cfb2
/dev/mapper/vg_b87c0247-vg_info_area
                         95088        56     92984   0% /mnt/vg_info_area/vg_b87c0247
/dev/mapper/vg_b87c0247-lv_42f2cfb2
                     2879986144   5390736 2874579024   0% /usr/local/apache/htdocs/desktop,/pkg
/dev/sdb              14943600    635480  13545680   4% /e-data/9e4bf589de0d92133fb0a12b965e135f
~ # e2label
-sh: e2label: not found
~ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00200000 00020000 "env"
mtd2: 00200000 00020000 "config"
mtd3: 00f00000 00020000 "kernel1"
mtd4: 06e00000 00020000 "rootfs1"
mtd5: 00f00000 00020000 "kernel2"
mtd6: 06e00000 00020000 "rootfs2"
~ # ls -lart /e-data/9e4bf589de0d92133fb0a12b965e135f
drwxr-xr-x    2 root     root          4096 Apr  7 03:11 sys
drwxr-xr-x    3 root     root             0 Jul 13 14:40 ..
drwxr-xr-x    2 root     root          4096 Sep 12  2016 proc
drwxr-xr-x    2 root     root          4096 Sep 12  2016 home
drwxr-xr-x    2 root     root          4096 Jan  2  2017 srv
drwxr-xr-x    2 root     root          4096 Jan  2  2017 opt
drwxr-xr-x    2 root     root          4096 Jan  2  2017 mnt
drwxr-xr-x   11 root     root          4096 Jan  2  2017 var
drwxr-xr-x   10 root     root          4096 Jan  2  2017 usr
drwxr-xr-x    4 root     root          4096 Jan  2  2017 dev
drwxr-xr-x    7 root     root          4096 Jan  2  2017 run
drwx------    2 root     root         16384 Jan  9  2017 lost+found
drwxrwxrwx   21 root     root          4096 Jan 20  2017 .
drwxr-xr-x    2 root     root          4096 Jan 21  2017 media
drwxr-xr-x   14 root     root          4096 Aug 22  2017 lib
drwxr-xr-x    2 root     root          4096 Aug 22  2017 sbin
drwxr-xr-x    2 root     root          4096 Aug 22  2017 bin
drwxr-xr-x    3 root     root          4096 Aug 22  2017 boot
drwxrwxrwt    2 root     root          4096 Aug 23  2017 tmp
drwxr-xr-x   71 root     root          4096 Aug 23  2017 etc
drwx------    5 root     root          4096 Aug 23  2017 root
~ # ls -lart /e-data/9e4bf589de0d92133fb0a12b965e135f/boot
drwxrwxrwx   21 root     root          4096 Jan 20  2017 ..
-rw-r--r--    1 root     root        155806 Jul 30  2017 config-4.12.4-mvebu-tld-1
-rwxr-xr-x    1 root     root       4021296 Jul 30  2017 zImage-4.12.4-mvebu-tld-1
-rwxr-xr-x    1 root     root       4021296 Jul 30  2017 zImage
-rw-------    1 root     root       4021296 Jul 30  2017 vmlinuz-4.12.4-mvebu-tld-1
-rw-------    1 root     root       2615209 Jul 30  2017 System.map-4.12.4-mvebu-tld-1
-rw-r--r--    1 root     root       8525990 Jul 30  2017 linux-headers-4.12.4-mvebu-tld-1_1.0_armhf.deb
drwxr-xr-x    2 root     root          4096 Jul 30  2017 dts
-rw-r--r--    1 root     root       7070172 Aug 22  2017 initrd.img-4.12.4-mvebu-tld-1
-rw-r--r--    1 root     root       4021360 Aug 22  2017 uImage
-rw-r--r--    1 root     root       7070236 Aug 22  2017 uInitrd
drwxr-xr-x    3 root     root          4096 Aug 22  2017 .

e2label isn't available from the stock firmware, but on another machine it returns the correct label
root@kali:/media/root# e2label /dev/sdb
rootfs
kekeke
Re: ZyXEL nas326 installation problem
November 13, 2017 09:38AM
Same issue here. Now I have V5.20(AAZF.1), but I remember that I did an upgrade to the latest V5.21(AAZF.1).
Re: ZyXEL nas326 installation problem
November 13, 2017 04:01PM
rkachowski,

I need to see how the envs got reset to in stock OS:
fw_printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 13, 2017 04:10PM
sure, the env is

~ # fw_printenv
CASset=max
CONTRY_TYPE=FF
FEATURE_BIT=00
MALLOC_len=5
MODEL_ID=B303
MPmode=SMP
PRODUCT_NAME=STG-328
VENDOR_NAME=MitraStar Technology Corp.
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
bootcmd_auto=stage_boot $boot_order
bootcmd_custom=if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000;
bootcmd_stock_1=run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000
bootcmd_stock_2=run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
bootdelay=3
cacheShare=no
console=console=ttyS0,115200
core_checksum_1=868590f39fdf3fe14e07e5824a550dd7
core_checksum_2=868590f39fdf3fe14e07e5824a550dd7
curr_bootfrom=2
device_partition=0:1
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:50:43:38:32:25
eth1mtu=1500
eth2addr=00:50:43:38:a6:25
eth2mtu=1500
eth3addr=00:50:43:32:a6:38
eth3mtu=1500
ethact=egiga0
ethaddr=5C:6A:80:15:E3:74
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=yes
fdtaddr=0x1000000
fdtfile=armada-38x-modular.dtb
fwversion_1=V5.20(AAZF.1)
fwversion_2=V5.20(AAZF.1)
ide_path=/
image_name=uImage
img_checksum_1=596153a55a196698e2f816f42d2dae47
img_checksum_2=596153a55a196698e2f816f42d2dae47
initrd_name=uInitrd
ipaddr=10.4.50.170
kernel_addr=${kernel_addr_1}
kernel_addr_1=0x00000000; run bootcmd_custom;
kernel_addr_2=0x08700000
kernel_addr_r=2080000
kernel_mtd_1=3
kernel_mtd_2=5
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
load_dtb_addr=0x1000000
load_image_addr=0x02000000
load_initrd_addr=0x2900000
loadaddr=0x02000000
loads_echo=0
modelid_1=B303
modelid_2=B303
mtdids=nand0=armada-nand
mtdparts=mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:25:a6:38
nandEcc=nfcConfig=4bitecc
netbsd_en=no
netmask=255.255.255.0
netretry=no
next_bootfrom=2
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
revision_1=50729
revision_2=50729
romfile_checksum_1=9D0A
romfile_checksum_2=9D0A
rootpath=/srv/nfs/
sata_delay_reset=0
sata_dma_mode=yes
script_addr_r=3000000
script_name=boot.scr
serial_number=S170Y17032377
serverip=10.4.50.38
set_bootargs_stock=setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
sysimg_mtd_1=4
sysimg_mtd_2=6
usb0Mode=host
usbActive=0
usbType=2
usb_bootcmd=echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr
usb_init=mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start
usb_set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81
zld_checksum_1=845ace22f5de7ac51fbd2ed1338bd28d
zld_checksum_2=845ace22f5de7ac51fbd2ed1338bd28d
change_boot_part=0
Re: ZyXEL nas326 installation problem
November 13, 2017 10:41PM
Ok. Looks like they have not changed the FW in anyway to prevent my env hack. I can confirm this by the look of the u-boot envs listed.


Something has prevented you to boot from USB, and the fall back menchanism in the envs has caused it to reset to boot kernel 2 from NAND.

Let's reset these to boot from kernel 1 address, so it will boot from USB rootfs.

fw_setenv curr_bootfrom 1
fw_setenv next_bootfrom 1
fw_setenv change_boot_part 1


Plug in the new Debian USB rootfs to the front port. Sync and reboot

sync
shutdown -r now

If you still can not boot USB rootfs with the above change, then log in to stock OS, and then post the output of fw_printenv again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
kekeke
Re: ZyXEL nas326 installation problem
November 14, 2017 12:06AM
After putting USB stick from rear to the front port and doing what you said above, I was able to boot to Debian.
Re: ZyXEL nas326 installation problem
November 14, 2017 12:09AM
kekeke Wrote:
-------------------------------------------------------
> After putting USB stick from rear to the front
> port and doing what you said above, I was able to
> boot to Debian.

Cool! thanks for reporting this kekeke.

The rear ports are USB 3.0. So the rootfs need to be attached to the front port.

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



Edited 1 time(s). Last edit at 11/14/2017 12:13AM by bodhi.
kekeke
Re: ZyXEL nas326 installation problem
November 14, 2017 07:00AM
@bodhi at first, I want to say thank you for your amazing job.

Now I'm stuck with booting from internal HDD (i have only one installed in the first bay).
After rebooting nas is becoming unresponsible and can be turned off only using power plug (power button doesn't react).

My initial printenv output: https://pastebin.com/DpKnA6Em
Before reboot: https://pastebin.com/j7YWMKDi
After removing HDD and booting to stock os: https://pastebin.com/BX57SCPh
After applying your recommendations above: https://pastebin.com/KMmHM114

HDD is prepared the same way as usb stick (using 4.12.4 rootfs).
kekeke
Re: ZyXEL nas326 installation problem
November 14, 2017 09:01AM
I tried to debug using netconsole (https://forum.doozan.com/read.php?3,14), but no luck either. Just empty output on nc.
Re: ZyXEL nas326 installation problem
November 14, 2017 12:12PM
So I've run the setenv commands, put the usb into the front port, synced and restarted. Unfortunately the nas booted up again into the stock os, the fw_printenv output after reboot is available here https://pastebin.com/EbLuwbRy

One small note is that the busybox install doesn't have `shutdown`, only `reboot` and `poweroff`. The fact that @kekeke has it running gives me hope though!
Re: ZyXEL nas326 installation problem
November 14, 2017 04:25PM
rkachowski & kekeke,

pastebin is quite hard to read. Next time please post here in code tags. Except for the boot log, everything else is easier to troubleshoot if in code tags.

Here is rkachowski's output of fw_printenv

CASset=max
CONTRY_TYPE=FF
FEATURE_BIT=00
MALLOC_len=5
MODEL_ID=B303
MPmode=SMP
PRODUCT_NAME=STG-328
VENDOR_NAME=MitraStar Technology Corp.
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
bootcmd_auto=stage_boot $boot_order
bootcmd_custom=if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000;
bootcmd_stock_1=run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000
bootcmd_stock_2=run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
bootdelay=3
cacheShare=no
console=console=ttyS0,115200
core_checksum_1=868590f39fdf3fe14e07e5824a550dd7
core_checksum_2=868590f39fdf3fe14e07e5824a550dd7
device_partition=0:1
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no
enaWrAllo=no
eth1addr=xxxxxxx
eth1mtu=1500
eth2addr=xxxxxxx
eth2mtu=1500
eth3addr=xxxxxxx
eth3mtu=1500
ethact=egiga0
ethaddr=xxxxxxxx
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=yes
fdtaddr=0x1000000
fdtfile=armada-38x-modular.dtb
fwversion_1=V5.20(AAZF.1)
fwversion_2=V5.20(AAZF.1)
ide_path=/
image_name=uImage
img_checksum_1=596153a55a196698e2f816f42d2dae47
img_checksum_2=596153a55a196698e2f816f42d2dae47
initrd_name=uInitrd
ipaddr=10.4.50.170
kernel_addr=${kernel_addr_1}
kernel_addr_1=0x00000000; run bootcmd_custom;
kernel_addr_2=0x08700000
kernel_addr_r=2080000
kernel_mtd_1=3
kernel_mtd_2=5
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
load_dtb_addr=0x1000000
load_image_addr=0x02000000
load_initrd_addr=0x2900000
loadaddr=0x02000000
loads_echo=0
modelid_1=B303
modelid_2=B303
mtdids=nand0=armada-nand
mtdparts=mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:25:a6:38
nandEcc=nfcConfig=4bitecc
netbsd_en=no
netmask=255.255.255.0
netretry=no
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
revision_1=50729
revision_2=50729
romfile_checksum_1=9D0A
romfile_checksum_2=9D0A
rootpath=/srv/nfs/
sata_delay_reset=0
sata_dma_mode=yes
script_addr_r=3000000
script_name=boot.scr
serial_number=xxxxxxxxxxxx
serverip=10.4.50.38
set_bootargs_stock=setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
sysimg_mtd_1=4
sysimg_mtd_2=6
usb0Mode=host
usbActive=0
usbType=2
usb_bootcmd=echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr
usb_init=mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start
usb_set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"
vxworks_en=no
yuk_ethaddr=xxxxxxxxxxxxx
zld_checksum_1=845ace22f5de7ac51fbd2ed1338bd28d
zld_checksum_2=845ace22f5de7ac51fbd2ed1338bd28d
curr_bootfrom=1
next_bootfrom=1
change_boot_part=0

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 14, 2017 04:38PM
rkachowski,

Try one more time.

After logging int the stock OS

fw_setenv change_boot_part 1

Sync, and reboot.

-----

Note:

Your envs look fine. Nothing wrong with them. change_boot_part is reset to 0 each time the stock OS booted successfully, so it is no surprise that it is 0.

It could be that this problem has something to do with the USB rootfs itself. But we cannot see that problem without serial console to watch the kernel mounting process.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 14, 2017 04:50PM
@kekeke,

> I tried to debug using netconsole
> (https://forum.doozan.com/read.php?3,14), but no
> luck either. Just empty output on nc.

Stock u-boot does not have netconsole.

@all,

Serial console is absolutely necessary when you start hacking these embedded Linux boxes. Serial console is not just for trouble shooting purpose, it's also a tool for learning Linux, because you can see how Linux boots, info that you cannot see without it.

If you plan to change your configuration often (or later adding RAID ...), I'd suggest getting a serial convert. It's the best tool for under 5 USD. This NAS326 serial header is already installed by the manufacturer, you will only need to plug in the correct pins.

See the Wiki thread:
https://forum.doozan.com/read.php?2,23630

Quote

Serial Console & JTAG console

Repair Pogo E02 with Raspberry PI (JTAG) and OpenOCD
Serial Port connector - what are people using to make it work
Serial Console hookup - GoFlex Net (external link)
Serial Console hookup - Pogoplug E02 and Pogoplug Pro V3 (external link)
OSX Serial/Net Console
Use Phone Jack - Phone Jack Serial Console Pics
Adding serial connector to Pogoplug Mobile (external link)
WD Mycloud EX2100/4100 Serial Console pic1, also pic2, pic3
Dreamplug Serial Console

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 14, 2017 05:17PM
sorry about the paste bin, I was just concerned about noise in the thread. I've retried the commands as above with no success. I'll also find a new usb drive to see if that works, but the next step will be a serial console setup.

(it turns out I have an ftdi TTL 232r v5 cable lying around, is this suitable? I considered it before but I'm not sure about the voltages / which pins to connect.)
Re: ZyXEL nas326 installation problem
November 14, 2017 05:57PM
NAS326 serial console

Connect only GND, RX, TX (dont connect 3.3V power).


          +----+----+           
          |    |    |
+----+----+----+----+----+
|3.3V| TX | RX |    | GND|
+----+----+----+    +----+

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 14, 2017 06:02PM
kekeke,

HDD post above:
https://forum.doozan.com/read.php?2,41874,42084#msg-42084

> My initial printenv output:
> https://pastebin.com/DpKnA6Em
> Before reboot: https://pastebin.com/j7YWMKDi
> After removing HDD and booting to stock os:
> https://pastebin.com/BX57SCPh
> After applying your recommendations above:
> https://pastebin.com/KMmHM114

At this point your envs did not have:
change_boot_part=1

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



Edited 2 time(s). Last edit at 11/14/2017 06:06PM by bodhi.
kekeke
Re: ZyXEL nas326 installation problem
November 15, 2017 06:37AM
I've got usb-to-ttl (https://ru.aliexpress.com/store/product/CP2102-USB-2-0-to-UART-TTL-5PIN-Connector-Module-Serial-Converter-New/343255_32695520129.html), attached it like GND-GND, RX-TX, TX-RX and didn't see any output. I tried to change to rx-rx, tx-tx and got same results. I tried on mac,win,linux (using kwboot, putty, picocom, screen), tried different laptop, but everything is useless.

P.S. When I'm removing jumper that stated as tx on your schema systems continues to boot normally.

I have no ideas what else should I try...

P.P.S Thank you for your help!
Re: ZyXEL nas326 installation problem
November 15, 2017 07:01AM
kekeke.

Quote

> see any output. I tried to change to rx-rx, tx-tx
> and got same results. I tried on mac,win,linux
> (using kwboot, putty, picocom, screen), tried
> different laptop, but everything is useless.
>
> P.S. When I'm removing jumper that stated as tx on
> your schema systems continues to boot normally.
>

It is expected. NAS326 box behaves this way. This quirk about serial console is not typical for all boxes, just this one.


Look back to the installation instruction:


Quote

Zyxel NAS326 Installation

Updated 25 Mar 2017 (added Section C - Installation for SATA rootfs, no serial console)
Updated 18 Feb 2017 (added Section B - Installation for USB rootfs, no serial console)
Updated 05 Feb 2017 (Section A - Installation for USB rootfs, with serial console)


Installation for NAS326 box can be done with serial console connected (section A), or inside stock OS and without serial console (section B for USB rootfs, section C for SATA rootfs). Note: for section A and B, the USB rootfs must be inserted to the front USB port (USB 2.0).

.....
.....


A3. Normal Operation

The USB rootfs should be plugged in permanently, and the serial console module should be removed.

1. Whenever the NAS326 is rebooted or cold started, to boot without manual intervention, the serial console module must be unplugged from the NAS326. If the serial console module is plugged in, then step 1 in the installation instruction A2 must be executed (so that the NAS326 will continue booting when it detected the serial console present).


Quote

A2. Installation

Warning: Step 4 in the instruction in this section uses a "env/code injection" to replace the Zyxel NAS326 stock u-boot bootcmd with a different command during boot. It's a simple trick that change u-boot env bootcmd (it does not touch u-boot binary in NAND). However, this hack should not be used on a different MVEBU box (any box other than the NAS326). Doing this without examining your box's stock u-boot source code could likely messing up your u-boot envs and prevent booting, or in the worse case bricking it. Please post questions regarding installation for other MVEBU boxes, it might be possible to do this.

1. Start kwboot on the serial console host

For ARM32 kwboot:
./kwboot -t -B 115200 /dev/ttyUSB0 -d

For x86-64 kwboot:
./kwboot -t -B 115200 /dev/ttyUSB0


So the short explanation: NAS326 senses the presence of a serial console being attached, and will not boot wihout proper trigger. The kwboot command above sends a debug message to "trigger" that (a long technical explanation obmitted here).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
kekeke
Re: ZyXEL nas326 installation problem
November 15, 2017 09:35AM
Finally, I got it to work. I read it (instructions), but it was unclear without context (especially in part about the platform. I thought that it's about the host, not the target).

This comment helped me a lot (https://forum.doozan.com/read.php?2,27108,31735#msg-31735).

Maybe it worth to mention this issue in instructions? Just everyone could be prepared that this is a typical situation (if I'm not alone who stuck with this).

So what I studied during my experiments:
1. It's better to reboot and not a cold start. (End even when rebooting I often needed to replug Tx on a board).
2. I have cp2102, but Rx should be connected to Tx (I saw posts on here that for this chip it should be connected Tx-Tx, Rx-Rx).
3. It's necessary to use kwboot with '-d' key (I thought that this is one of the options).

Anyway, huge thanks @bodhi
kekeke
Re: ZyXEL nas326 installation problem
November 15, 2017 09:53AM
Returning to the initial issue with booting from HDD. Now I have a boot log:

�}�M���KKKK�--OKKK�����DDR3 Training Sequence - Switching XBAR Window to FastPath Window
DDR3 Training Sequence - Ended Successfully
Not detected suspend to RAM indication
 0

NAND read: device 0 whole chip
Attempt to read outside the flash area
 0 bytes read: ERROR
Booting from SATA ...
AHCI init for unit0
Target spinup took 0 ms.
SATA link 1 timeout.

Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found
scanning bus for devices...

And printenv:

CASset=max
CONTRY_TYPE=FF
FEATURE_BIT=00
MALLOC_len=5
MODEL_ID=B303
MPmode=SMP
PRODUCT_NAME=STG-328
VENDOR_NAME=MitraStar Technology Corp.
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=nand read 0x2000000 0x00000000; run bootcmd_custom;  0xF00000 && bootz 0x2000000
bootcmd_auto=stage_boot $boot_order
bootcmd_custom=run bootcmd_custom_sata
bootcmd_custom_sata=if run sata_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000;
bootcmd_stock_1=run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000
bootcmd_stock_2=run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
bootdelay=20
cacheShare=no
change_boot_part=1
console=console=ttyS0,115200
core_checksum_1=868590f39fdf3fe14e07e5824a550dd7
core_checksum_2=2773b03df8b32c243f8b84dcefa79efb
curr_bootfrom=1
device_partition=0:1
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:50:43:38:32:25
eth1mtu=1500
eth2addr=00:50:43:38:a6:25
eth2mtu=1500
eth3addr=00:50:43:32:a6:38
eth3mtu=1500
ethact=egiga0
ethaddr=B8:EC:A3:7F:D9:46
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=yes
fdtaddr=0x1000000
fdtfile=armada-38x-modular.dtb
fwversion_1=V5.20(AAZF.1)
fwversion_2=V5.21(AAZF.1)
ide_path=/
image_name=uImage
img_checksum_1=596153a55a196698e2f816f42d2dae47
img_checksum_2=5356a1c083dfd6bc8c74bfd231aa15a6
initrd_name=uInitrd
ipaddr=10.4.50.170
kernel_addr=${kernel_addr_1}
kernel_addr_1=0x00000000; run bootcmd_custom; 
kernel_addr_2=0x08700000
kernel_addr_r=2080000
kernel_mtd_1=3
kernel_mtd_2=5
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
load_dtb_addr=0x1000000
load_image_addr=0x02000000
load_initrd_addr=0x2900000
loadaddr=0x02000000
loads_echo=0
modelid_1=B303
modelid_2=B303
mtdids=nand0=armada-nand
mtdparts=mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:25:a6:38
nandEcc=nfcConfig=4bitecc
netbsd_en=no
netmask=255.255.255.0
netretry=no
next_bootfrom=1
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
revision_1=50729
revision_2=50984
romfile_checksum_1=9D0A
romfile_checksum_2=A762
rootpath=/srv/nfs/
sata_bootcmd=echo Booting from SATA ...; setenv fdt_skip_update yes; run sata_init; ext2load scsi 0:1 $load_image_addr /boot/zImage; ext2load scsi 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load scsi 0:1 $load_initrd_addr /boot/uInitrd; run sata_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr
sata_delay_reset=0
sata_dma_mode=yes
sata_init=mw.l f1018100 20420000; mw.l f1018140 003ca800; sleep 3; scsi init
sata_set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"
script_addr_r=3000000
script_name=boot.scr
serial_number=
serverip=10.4.50.38
set_bootargs_stock=setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
sysimg_mtd_1=4
sysimg_mtd_2=6
usb0Mode=host
usbActive=0
usbType=2
usb_bootcmd=echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr
usb_init=mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start
usb_set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81
zld_checksum_1=845ace22f5de7ac51fbd2ed1338bd28d
zld_checksum_2=102d2dc16f397df0dddc4f1ad6380e52

Environment size: 5763/524284 bytes
Re: ZyXEL nas326 installation problem
November 15, 2017 04:19PM
kekeke,

> Booting from SATA ...
> AHCI init for unit0
> Target spinup took 0 ms.
> SATA link 1 timeout.
>
> Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not
> found
> scanning bus for devices...
> [/code]
>

Did it hang here?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
kekeke
Re: ZyXEL nas326 installation problem
November 15, 2017 10:06PM
Yes, I waited for around 2 minutes.
Re: ZyXEL nas326 installation problem
November 15, 2017 10:22PM
kekeke,

Please post the entire bootlog, from u-boot banner until it stopped (a snippet of log is never helpful!).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 16, 2017 03:02PM
so amazon came through and provided a uart - usb connection, and eventually I managed to get the serial console working. what i've found is that when all the leds turn on dim and wait there, the TX connector needs to be removed and immediately reattached to continue the boot process. from there i can interrupt the autoboot and get into the console.

*** Booting kernel from kernel 1 @0x00000000; run bootcmd_custom;  ***
USB2.0 0: Host Mode
USB3.0 0: Host Mode
USB3.0 1: Host Mode
Board configuration detected:
Net:   
|  port  | Interface | PHY address  |
|--------|-----------|--------------|
| egiga0 |   RGMII   |     0x01     |
egiga0 [PRIME]
Hit any key to stop autoboot:  0 

NAND read: device 0 whole chip
Attempt to read outside the flash area
 0 bytes read: ERROR
Booting from USB ...
(Re)start USB...
USB0:   Port (usbActive) : 0	Interface (usbType = 2) : USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found
** No partition table - usb 0 **
** No partition table - usb 0 **
** No partition table - usb 0 **
*  kernel: cmdline image address = 0x02000000
Bad Linux ARM zImage magic!
Booting from NAND kernel 1 ...

NAND read: device 0 offset 0xe00000, size 0xf00000
 15728640 bytes read: OK
*  kernel: cmdline image address = 0x02000000

Starting kernel ...

Power on HDD1 ...
Power on HDD2 ...
Power on USB ...

Uncompressing Linux... done, booting the kernel.

from what i understand this implies the contents of the usb aren't setup correctly - Bad Linux ARM zImage magic. I'm not sure how to address this though.
Re: ZyXEL nas326 installation problem
November 16, 2017 04:06PM
rkachowski,

1. Regarding serial console

> what i've found is that
> when all the leds turn on dim and wait there, the
> TX connector needs to be removed and immediately
> reattached to continue the boot process. from
> there i can interrupt the autoboot and get into
> the console.

Or run kwboot as instructed in the installation post:

https://forum.doozan.com/read.php?2,41874,42189#msg-42189

Running kwboot at any time before or after power up, i.e. you don't have to time the action.

2. Most of the time, that bad image magic error is not what it seems to be.

Interrupt serial console at countdown, and

printenv

Please post the entire serial console log until this point here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 16, 2017 05:17PM
rkachowski,

This indicated that your USB rootfs partition is bad.
** No partition table - usb 0 **
** No partition table - usb 0 **
** No partition table - usb 0 **

Redo this USB rootfs. But use fdisk to wipe out partition table first, and create a brand new partition.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: ZyXEL nas326 installation problem
November 18, 2017 08:58AM
Thanks a lot for your help. Everything seems to work awesomely now - turns out it was just my bad partitioning.

FWIW: even following the instructions I still have to unplug / replug the TX pin, otherwise kwboot is stuck on "Sending debug message. Please reboot the target...".
Author:

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: