NSA310S Installation issue: ## Error: "setenv" not defined

I followed the instruction in https://openwrt.org/toh/zyxel/nsa310b to install my NSA310S with openwrt. All goes fine, no errors.

After booting, I get these errors:


SoC:   Kirkwood 88F6281_A1
DRAM:  256 MiB
NAND:  128 MiB
Loading Environment from NAND... OK
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
IDE:   ide_preinit failed
Hit any key to stop autoboot:  0
## Error: "setenv" not defined
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
UBI error: cannot attach mtd3
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
Error, no UBI device selected!
Wrong Image Format for bootm command
ERROR: can't get kernel image!

I assume the issue is in the ## Error: "setenv" not defined, but I cannot find out how to fix this? There seems to b soe error in the environment variables.

printenv:

nsa310s => printenv
baudrate=115200
bootargs=console=ttyS0,115200 mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc0000(uboot_env),-@0x140000(ubi)
bootcmd=run setenv bootargs; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ethaddr=5C:F4:AB:2F:FD:C7
ipaddr=192.168.1.1
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial

Environment size: 479/131068 bytes

I think it's just a minor issue (typo/copy paste issue), but I cannot seem to find it. Anyone got openwrt running on NSA310S who can provide the correct environement variables?

should probably remove run setenv from the line above.

1 Like

Hi Frolic, thanks for your effort to get me going. I now end up with Ubi error.

ubi0: attaching mtd3
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
UBI error: cannot attach mtd3
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)

I'll go back and start from scratch, something must have gone wrong. I am able to start the software from USB for the time being.. If someone has experience with the instruction for NSA310S, please let me know and share your environment variables.

based on info from https://forum.doozan.com/, it could be setenv bootargs, no run.

try that 1st.

1 Like

Thanks Frollic,

No luck. Went through the installation again (removed the run), but still the same error.Also played with the ubi partition size, because it might be too big to fit 128MiB. Reduced to 0x07800000, same issue.

Complete installation below, including the environment and mtsparts.

nsa310s => usb reset
resetting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... EHCI timed out on TD - token=0x80008c                                                                                                                                                             80
1 Storage Device(s) found
nsa310s => fatload usb 0 0x1000000 u-boot.kwb
576376 bytes read in 50 ms (11 MiB/s)
nsa310s => nand erase 0x0 0x100000

NAND erase: device 0 offset 0x0, size 0x100000
Erasing at 0xe0000 -- 100% complete.
OK
nsa310s => nand write 0x1000000 0x00000 $filesize

NAND write: device 0 offset 0x0, size 0x8cb78
 576376 bytes written: OK
nsa310s => reset
resetting ...


U-Boot 2020.04 (Oct 24 2021 - 09:01:35 +0000)

SoC:   Kirkwood 88F6281_A1
DRAM:  256 MiB
NAND:  128 MiB
Loading Environment from NAND... *** Warning - bad CRC, using default environmen                                                                                                                                                             t

In:    serial
Out:   serial
Err:   serial
Net:   egiga0
Error: egiga0 address not set.

IDE:   ide_preinit failed
Hit any key to stop autoboot:  0
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
UBI error: cannot attach mtd3
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
UBIFS error (pid: 1): cannot open "ubi:rootfs", error -19
Error reading superblock on volume 'ubi:rootfs' errno=-19!
ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume
Error, no UBI device selected!
Wrong Image Format for bootm command
ERROR: can't get kernel image!
nsa310s => printenv
baudrate=115200
bootargs=console=ttyS0,115200 mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc                                                                                                                                                             0000(uboot_env),-@0x140000(ubi)
bootcmd=setenv bootargs ${console} ${mtdparts} ${bootargs_root}; ubi part ubi; u                                                                                                                                                             bifsmount ubi:rootfs; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ipaddr=192.168.1.1
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc0000(uboot_env),-@0x1                                                                                                                                                             40000(ubi)
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial

Environment size: 523/131068 bytes
nsa310s => setenv ethaddr 5C:F4:AB:2F:FD:C7
nsa310s => saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0xc0000 -- 100% complete.
Writing to NAND... OK
OK
nsa310s => setenv mtdparts 'mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_e                                                                                                                                                             nv),0x7ec0000(ubi)'
nsa310s => setenv bootcmd 'setenv bootargs; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000'
nsa310s => saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0xc0000 -- 100% complete.
Writing to NAND... OK
OK
nsa310s => reset
resetting ...


U-Boot 2020.04 (Oct 24 2021 - 09:01:35 +0000)

SoC:   Kirkwood 88F6281_A1
DRAM:  256 MiB
NAND:  128 MiB
Loading Environment from NAND... OK
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
IDE:   ide_preinit failed
Hit any key to stop autoboot:  0
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
UBI error: cannot attach mtd3
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
Error, no UBI device selected!
Wrong Image Format for bootm command
ERROR: can't get kernel image!
nsa310s => printenv
baudrate=115200
bootcmd=setenv bootargs; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ethaddr=5C:F4:AB:2F:FD:C7
ipaddr=192.168.1.1
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial

Environment size: 363/131068 bytes
nsa310s => mtdparts

device nand0 <orion_nand>, # parts = 3
 #: name                size            offset          mask_flags
 0: uboot               0x000c0000      0x00000000      0
 1: uboot_env           0x00080000      0x000c0000      0
 2: ubi                 0x07ec0000      0x00140000      0

active partition: nand0,0 - (uboot) 0x000c0000 @ 0x00000000

defaults:
mtdids  :
mtdparts: mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc0000(uboot_env),-@0x140000(ubi)

Check the doozan forum, it's a gold mine for Kirkwood lovers.
They might also have a more recent uboot for you.

1 Like

Will do. Every problem should be solvable :slight_smile: Thanks, appreciate your help. Will report back when I solved it.

From this log file it appears that you loaded the new u-boot, but failed to load OpenWrt. The correct loading instructions are in the Git commit message and copied below.

1. Prepare usb fat32 drive with u-boot.kwb and initramfs image.
   Stick it to USB 2.0 port.
2. Run serial console and go to u-boot.
3. Copy u-boot from usb and write to NAND:
=> mw 0x0800000 0xffff 0x100000
=> nand erase 0x0 100000
=> usb start
=> fatload usb 0 0x0800000 u-boot.kwb
=> nand write 0x0800000 0x0 0x100000
=> reset
4. Run new u-Boot, repair bootcmd and restore MAC address from sticker
=> setenv ethaddr AA:BB:CC:DD:EE:FF
=> saveenv
5. Copy and run initramfs image:
=> usb start
=> fatload usb 0 0x0800000 initramfs-uImage
=> bootm 0x800000
6. Download sysupgrade image and perform sysupgrade.
1 Like

@RaylynnKnight : This instruction did the trick. So first get Openwrt running and then the upgrade script does the magic. Yesterday I even had to unbrick via kwboot after installing an alternate u-boot and now I am finally running openwrt from NAND.

@frollic , @RaylynnKnight Thanks a lot for your efforts.

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