Welcome! Log In Create A New Profile

Advanced

Debian on Zyxel NAS326

Posted by Kirsch 
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
October 31, 2016 03:58PM
musv Wrote:
-------------------------------------------------------
> 2 small things:
> In the boot process I get the error message:
>
Okt 30 23:45:27 nas kernel: m25p80 spi0.0:
> unrecognized JEDEC id bytes: ff, ff, ff
> Maybe there's still something missing in the dts
> file.
>

This is also show with the original firmware, so I just ignored digging into it for now..

> And the 2nd thing:
> If you run systemd, you'll most probably need:
>
CONFIG_SECCOMP=y
> Otherwise journald fails to start.
>
> No there's one thing left for me:
>
Tasks:  57 total,   2 running,  55 sleeping,
>   0 stopped,   0 zombie
> %CPU0  :  0,0 us, 95,0 sy,  0,0 ni,  5,0 id,  0,0
> wa,  0,0 hi,  0,0 si,  0,0 st
> KiB Spch:   511008 total,   445124 free,    15260
> used,    50624 buff/cache
> KiB Swap:  2097148 total,  2097148 free,        0
> used.   484112 avail Spch
> 
>   PID USER      PR  NI    VIRT    RES    SHR S
> %CPU %MEM     ZEIT+ BEFEHL                        
>                                                   
>             
>   233 root      20   0       0      0      0 R
> 95,0  0,0   9:35.55 kworker/0:1
> I have between 60% and 95% cpu last on this worker
> thread.

The above two problems are fixed in the latest patch in this thread.
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
October 31, 2016 05:34PM
Still recompiling the kernel. :)

Did you manage it to boot the kernel from a sata harddrive?

Currently my boot procedure is:
setenv bootargs "console=ttyS0,115200 root=/dev/sda1 init=/usr/lib/systemd/systemd"
mw.l f1018100 20420000
mw.l f1018140 003ca800
usb reset
scsi init
ext4load usb 0:1 0x02000000 /boot/zImage_dtb
bootz 0x02000000
scsi init finds the sata harddisk. But I'm not able to boot from the hdd. "sata" gives me: bad device. I would like to get rid of the USB stick.
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 01, 2016 02:49AM
musv Wrote:
-------------------------------------------------------
>
> Did you manage it to boot the kernel from a sata
> harddrive?
>

Nope, i'm storing my kernel and initrd in NAND and boots from there. I haven't looked into booting from the drive which would be really nice to accomplish thou.. I'm currently running arch linux using my archiso installer build for nas326, however this file contains a readme with information about booting form nand.

archiso-zyxel-nas326.tar.gz
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 01, 2016 02:18PM
Thanks @musv for the info about scsi command, now I'm able to handle a linux kernel dist package for updating kernel, as it should eg. written into a /boot, instead of having it written to nand...

I do not have any problems to load kernel and initrd from disk to mem and boot. See following steps:

Marvell>> scsi reset

Reset SCSI
scanning bus for devices...
  Device 0: (0:0) Vendor: ATA Prod.: WDC WD20EFRX-68E Rev: 82.0
            Type: Hard Disk
            Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
Found 1 device(s).

Marvell>> scsi part

Partition Map for SCSI device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            1951744         dcb760b0-01     83
  2     1953792         19531776        dcb760b0-02     83
  3     21485568        -409423872      dcb760b0-03     8e

Marvell>> ext2ls scsi 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
          153655 config-3.16.0-4-armmp
         3186376 vmlinuz-3.16.0-4-armmp
<SYM>         16 vmlinuz
<SYM>         25 initrd.img
        12528480 vmlinuz-3.10.39+
         2410201 System.map-3.16.0-4-armmp
<SYM>         20 vmlinuz.old
        13629076 initrd.img-3.16.0-4-armmp
         1606946 System.map-3.10.39+
           77013 config-3.10.39+
        12528480 vmlinuz-3.10.39+.old
         1606946 System.map-3.10.39+.old
           77006 config-3.10.39+.old
         3165230 initrd.img-3.10.39+

Marvell>> ext2load scsi 0:1 0x100000 vmlinuz

12528480 bytes read in 252 ms (47.4 MiB/s)
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 01, 2016 02:55PM
hean01, well done! Seems we have 4 firmware options for now - Debian, Ubuntu, Arch and Zyxel original fw.

I've managed to build 4.8.6 kernel using the patch you created (made zImage + ubuntu rootfs + dtb in a single file, wrote it to kernel2 NAND partition).

Everything seems to work just fine. The only bug I found - every time I reboot NAS326, I get a new eth0 MAC address (see ifconfig - HWaddr is different every time). And, respectively, DHCP gives it a new IP address. Could you test it?

My setup is - NAS326, Ubuntu 16.04 (installed to USB 3.0 flash drive, inserted into rear USB 3.0 port), 4.8.6 kernel (built with arm-marvell-linux-gnueabihf- cross toolchain) written into NAND.
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 01, 2016 03:44PM
rr4m Wrote:
-------------------------------------------------------
>
> I've managed to build 4.8.6 kernel using the patch
> you created (made zImage + ubuntu rootfs + dtb in
> a single file, wrote it to kernel2 NAND
> partition).
>

How do you merge initrd with kernel image ?

> Everything seems to work just fine. The only bug I
> found - every time I reboot NAS326, I get a new
> eth0 MAC address (see ifconfig - HWaddr is
> different every time). And, respectively, DHCP
> gives it a new IP address. Could you test it?
>

Yes, I have the same problem, might be a kernel parameter to set a MAC ?
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 01, 2016 06:14PM
Quote
hean01
How do you merge initrd with kernel image ?

This is the trickiest piece, ha?) I prepare initramfs_data.cpio.gz manually, then <kernel_source>/usr/Makefile does the job (but, you need to modify Makefile a bit).
See the guide I wrote for myself - howto_rebuild_kernel_and_initramfs_nas326.txt - it's in my archive below.

Also, I don't use mkimage for merging (tried it, but won't able to boot afterwards - may be I'm doing it wrong).

Quote
hean01
Yes, I have the same problem, might be a kernel parameter to set a MAC ?

Not sure yet, need to see how ZyXEL did it in stock 3.10.39 kernel (but old cmdline doesn't have MAC address in it, and it worked)

Fresh 4.8.6 kernel build + instructions how to install+run Debian/Ubuntu for ARMHF on NAS326 (on your own risk, as usual):

nas326_4.8.6_kernel_20161101.tar.gz
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 12:59AM
rr4m Wrote:
-------------------------------------------------------
> hean01, well done! Seems we have 4 firmware
> options for now - Debian, Ubuntu, Arch and Zyxel
> original fw.

That's not completely correct. I'm running Gentoo. And it's running fine so far.

hean01 Wrote:
-------------------------------------------------------
> How do you merge initrd with kernel image ?

What do you need an initrd / initramfs for? Building all necessary drivers for booting into the kernel, there's no need for a initrd. I dropped the initrd/initramfs support completely out of the kernel config.
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 01:04AM
musv,

> Building all necessary drivers for booting into
> the kernel, there's no need for a initrd. I
> dropped the initrd/initramfs support completely
> out of the kernel config.

You'll need initrd to boot correctly with multiple partitions. Without initrd, you'll will need a work around, no foolproof solution.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 01:09AM
Quote
musv
What do you need an initrd / initramfs for?

I want my rootfs on a lvm volume, and for that, initrd is needed.
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 05:32AM
Quote
musv
What do you need an initrd / initramfs for?

Kernel with integrated initrd allows me to boot kernel and init just from NAND.
Even if I have no HDDs installed, and even if my USB drive (with installed Ubuntu) is inserted into rear USB 3.0 port (which is not visible from uBoot) - my kernel will run, and init will happen.

Quote
musv
I'm running Gentoo. And it's running fine so far.

Cool! :)
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 11:15AM
Regarding random eth0 MAC address on 4.8.6 kernel. Here's what I see:

Original stock 3.10.39 kernel device tree (arch/arm/boot/dts/armada-380.dts):

ethernet@70000 {
  status = "okay";
  phy = <&phy0>;
  phy-mode = "rgmii";
};

Here's what we have in 4.8.6 device tree (hean01 patch, arch/arm/boot/dts/armada-380-zyxel-nas326.dts):
ethernet@70000 {
  status = "okay";
  phy-mode = "rgmii";
  fixed-link {
    speed = <1000>;
    full-duplex;
  };
};

So, we missed phy = <&phy0>; - that must be the case? And why the port speed is hardcoded?
I'll try to recompile when I'm back at home.
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 11:23AM
Thanks for the hint with LVM. I didn't respect the fact, that LVM needs some userspace stuff.

I have got some strange behaviour with ext4ls:

ext4ls scsi 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>        566 bin
<DIR>        738 boot
...
works fine. But
Marvell>> ext4ls scsi 0:1 boot
< ? >          0 PHASES=install prepare test
DEPEND=dev-scheme/gauche virtual/libffi 
Marvell>> ext4ls scsi 0:1 /boot
< ? >          0 PHASES=install prepare test
DEPEND=dev-scheme/gauche virtual/libffi 
Marvell>> ext4ls scsi 0:1 /boot/
< ? >          0 PHASES=install prepare test
DEPEND=dev-scheme/gauche virtual/libffi
It seems ext4ls / ext4load has a problem with subdirectories on scsi devices.
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 12:23PM
Quote
rr4m
So, we missed phy = <&phy0>; - that must be the case?

Nope, removing that line was the fix to get network to work. I do not remeber why exactly, but i recall it had to do with that 4.8.x armada-38x.dtsi had diverted from what's in 3.10.9 and using the phy handle reference was not compatible.

Anyway, what I have found is that MAC address should be set by uboot and written into mac-address entry of ethernet definition in dts. I'm digging more into this issue.

Quote
rr4m
And why the port speed is hardcoded?

I found some reference about a problem with ethernet if not set as fixed, however i do not have source for it now. If you look at any armada dts in 4.8.x kernel it is done exactly as for all the other boards.

@bodhi might have some input on this ?
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 12:49PM
I found where MAC sits. It is hardcoded. See ZyXEL firmware source, 3.10.39 kernel, arch/arm/boot/dts/armada-38x.dtsi

eth0: ethernet@70000 {
  compatible = "marvell,neta";
  reg = <0x70000 0x4000>;
  interrupts-extended = <&mpic 8>;
  clocks = <&gateclk 4>;
  tx-csum-limit = <9800>;
  status = "disabled";
  mac-address = [ 00 nn nn nn nn 01 ];
  eth,port-num    = <0>;
  eth,port-mtu    = <1500>;
};

If I reboot to 3.10.39, my box is visible with this MAC (00 nn nn nn nn 01) on the network. So, it's not passed from u-boot, nor stored in NAND. It was simply hardcoded.
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 01:08PM
Upd: adding mac-address = [ ... ] to 4.8.6 (together with &phy0 + mdio armada-380-zyxel-nas326.dts - like it's done in 3.10.39) didn't help. Kernel loads, but there's no eth0 interface at all (loopback only). Reverted everything back, sittin on random MAC.
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 03:29PM
hean01,

> I found some reference about a problem with
> ethernet if not set as fixed, however i do not
> have source for it now. If you look at any armada
> dts in 4.8.x kernel it is done exactly as for all
> the other boards.
>
> @bodhi might have some input on this ?

Most likely: This is because of the version of stock u-boot on this box (i.e. it has problem, and Synology has to work around it in Linux). The DTS should never contain MAC address. If it does, then it is a kludge to get it working.

Try removing it from the DTS, and harcode the MAC address in /etc/network/interfaces (or some systemd's equivalent network target if running systemd). That way the DTS is more resilient and does not cause problem in different box.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 04:14PM
Quote
bodhi
Try removing it from the DTS, and harcode the MAC address in /etc/network/interfaces (or some systemd's equivalent network target if running systemd). That way the DTS is more resilient and does not cause problem in different box.

For now the mac address in dts is set to all zeros. From what i understand a random mac will be choosen due to all zero is considered as invalid, see of_get_mac_address() in mvneta. However, when i dig around, many references of of_get_mac_address() talks about how uboot overwrites this mac address in device tree before booting kernel from uboot env ethaddr. Does this not work as expected, as you recommend configuring mac at userspace ?
Re: Zyxel NAS326 - Debian / Boot from USB?
November 02, 2016 05:06PM
hean01,

> However, when
> i dig around, many references of
> of_get_mac_address() talks about how uboot
> overwrites this mac address in device tree before
> booting kernel from uboot env ethaddr.

This is usually what happens if u-boot works correctly. So the MAC address in u-boot env is the one kernel uses (kernel does not read u-boot envs, but it reflects what u-boot uses, therefore the kernel got that)..

> Does this
> not work as expected, as you recommend configuring
> mac at userspace ?

This is a work around only. If it works then the DTS can be more general like any other DTS, regarding ethernet. But the real solution is to make u-boot work. That will be my next project, since I got the hardware.

BTW, all I said above is just educated guess. I've not booted up the box.

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



Edited 1 time(s). Last edit at 11/02/2016 05:10PM by bodhi.
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 04, 2016 05:53PM
Next step: Booting from harddisk - U-Boot

setenv bootargs "console=ttyS0,115200 root=/dev/sda2 init=/usr/lib/systemd/systemd"
setenv bootcmd "mw.l f1018100 20420000; mw.l f1018140 003ca800; scsi init; ext2load scsi 0:1 0x02000000 /zImage_dtb; bootz 0x02000000"
saveenv
reset

Next time entering the UBoot console I get:
printenv bootargs
bootargs=console=ttyS0,115200 root=/dev/sda2 init=/usr/lib/systemd/systemd

printenv bootcmd
bootcmd=nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000"

Seems, every environment variable will be stored persistently except bootcmd. For some reason bootcmd will be reset to the default value.

Any idea how to get bootcmd changed in order to survive the next reboot?
Re: Zyxel NAS326 - Debian / Boot from USB?
November 04, 2016 09:13PM
musv Wrote:
-------------------------------------------------------
> Next step: Booting from harddisk - U-Boot
>
>
setenv bootargs "console=ttyS0,115200
> root=/dev/sda2 init=/usr/lib/systemd/systemd"
> setenv bootcmd "mw.l f1018100 20420000; mw.l
> f1018140 003ca800; scsi init; ext2load scsi 0:1
> 0x02000000 /zImage_dtb; bootz 0x02000000"
> saveenv
> reset
>
> Next time entering the UBoot console I get:
>
printenv bootargs
> bootargs=console=ttyS0,115200 root=/dev/sda2
> init=/usr/lib/systemd/systemd
> 
> printenv bootcmd
> bootcmd=nand read 0x2000000 0x08700000 0xF00000 &&
> bootz 0x2000000"
>
> Seems, every environment variable will be stored
> persistently except bootcmd. For some reason
> bootcmd will be reset to the default value.
>
> Any idea how to get bootcmd changed in order to
> survive the next reboot?

use saveenv command to save your setting. if it does not work, post output of

printenv

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



Edited 1 time(s). Last edit at 11/04/2016 09:14PM by bodhi.
hean01
Re: Zyxel NAS326 - Debian / Boot from USB?
November 05, 2016 03:46AM
Quote
musv
Seems, every environment variable will be stored persistently except bootcmd. For some reason bootcmd will be reset to the default value.

Any idea how to get bootcmd changed in order to survive the next reboot?

Just confirming that i also have this problem since day one, saveenv works with anything except bootcmd.
Re: Zyxel NAS326 - Debian / Boot from USB?
November 05, 2016 04:28AM
The stock envs were from octomike in this post. It has no explicit bootcmd manipulation:
http://forum.doozan.com/read.php?2,27108,27322#msg-27322

So Zyxel might have added their customed commands. That could have triggered their code to restore the bootcmd (sometime by missing certain variable). I've requested GPL source, it migh explain this.

In the mean time, someone please list the available commands. At u-boot console:
help

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 05, 2016 04:08PM
? - alias for 'help'
Creset - Creset - Run 'reset' or boot command in a loop, while counting.

SatR - Sample At Reset sub-system
active_units- print active units on board
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
boot_menu- command allows to select boot script from boot device
example: boot_menu
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
bootz - boot Linux zImage image from memory
bubt - bubt - Burn an image on the Boot Nand Flash.

chpart - change active partition
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
date - get/set/reset date & time
ddrPhyRead- ddrPhyRead - Read DDR PHY register

ddrPhyWrite- ddrPhyWrite - Write DDR PHY register

dhcp - boot image via network using DHCP/TFTP protocol
diskboot- diskboot- boot from IDE device

dma - dma - Perform DMA using the XOR engine

echo - echo args to console
editenv - edit environment variable
eeprom - EEPROM sub-system
env - environment handling commands
exit - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls - list files in a directory (default /)
ext4write- create a file in the root directory
false - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fdt - flattened device tree utility commands
fsinfo - print information about filesystems
fsload - load binary file from a filesystem image
go - start application at address 'addr'
help - print command description/usage
i2c - I2C sub-system
ide - ide - IDE sub-system

iminfo - print header information for application image
imxtract- extract a part of a multi-image
ir - ir - reading and changing MV internal register values.

itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loadx - load binary file over serial line (xmodem mode)
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
ls - list files in a directory (default /)
map - map - Display address decode windows

md - memory display
me - me - PCIe master enable

mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - display MMC info
mp - mp - map PCIe BAR

mtdparts- define flash/nand partitions
mtest - simple RAM read/write test
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
pci - list and access PCI Configuration Space
pciePhyRead- phyRead - Read PCI-E Phy register

pciePhyWrite- pciePhyWrite - Write PCI-E Phy register

phyRead - phyRead - Read Phy register

phyWrite- phyWrite - Write Phy register

ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
pxe - commands to get and boot from pxe files
rcvr - rcvr - Start recovery process (with TFTP server)

reset - Perform RESET of the CPU
resetenv- resetenv - Erase environment sector to reset all variables to default.

run - run commands in an environment variable
saveenv - save environment variables to persistent storage
scsi - SCSI sub-system
scsiboot- boot from SCSI device
se - se - PCIe Slave enable

setenv - set environment variables
sf - SPI flash sub-system
sg - sg - scanning the PHYs status

showvar - print local hushshell variables
sleep - delay execution for some time
source - run script from memory
sp - scan and detect all devices on PCI-e interface
sspi - SPI utility command
stage_boot- command to load script/image from different devices
example: stage_boot hd_img pxe
sys_restore- sys_restore - Search for install script on USB DOK and start installation of linux kernel and rootfs.

sysboot - command to get and boot from syslinux files
temp - temp - Display the device temperature.

tempCmd0- tempCmd - This command allocated for monitor extinction

tempCmd1- tempCmd - This command allocated for monitor extinction

tempCmd2- tempCmd - This command allocated for monitor extinction

tempCmd3- tempCmd - This command allocated for monitor extinction

test - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
training- training - prints the results of the DDR3 Training.

trainingStability- training - prints the results of the DDR3 Training.

true - do nothing, successfully
ts_report- ts_report - report touch screen coordinate

ts_test - ts_test - test touch screen

ubi - ubi commands
ubifsload- load file from an UBIFS filesystem
ubifsls - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
usb - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
whoAmI - - reading CPU ID
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 05, 2016 10:41PM
Quote
musv
Seems, every environment variable will be stored persistently except bootcmd. For some reason bootcmd will be reset to the default value.

Same issue. That's also one of the reasons, why I decided to store custom kernel+initramfs into NAND. Then the default bootcmd just works - no need to change it.
Kernel turns on hdd's/usb's. Init script inside initramfs parses bootargs, finds and mounts rootfs - that's all we need.
Re: Zyxel NAS326 - Debian / Boot from USB?
November 06, 2016 04:17PM
All,

This is easy to solve once I can get my hand on the GPL source code from Zyxel, or have some time to boot it up with serial console. I have some ideas now, but it's just guessing so out of precaution I'm hesitate to recommend them.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 11, 2016 01:04PM
Got a strange problem after inserting the second hdd:

Nov 11 19:54:09 nas kernel: NFSD: unable to generate recoverydir name (-2).
Nov 11 19:54:09 nas kernel: NFSD: disabling legacy clientid tracking. Reboot recovery will not function correctly!
Nov 11 19:54:14 nas kernel: ata1: exception Emask 0x10 SAct 0x0 SErr 0x41d0000 action 0xe frozen
Nov 11 19:54:14 nas kernel: ata1: irq_stat 0x80000040, connection status changed
Nov 11 19:54:14 nas kernel: ata1: SError: { PHYRdyChg CommWake 10B8B Dispar DevExch }
Nov 11 19:54:14 nas kernel: ata1: hard resetting link
Nov 11 19:54:15 nas kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Nov 11 19:54:15 nas kernel: ata1.00: configured for UDMA/133
Nov 11 19:54:15 nas kernel: ata1: EH complete
Nov 11 19:54:19 nas systemd-timesyncd[2222]: Synchronized to time server 192.168.109.1:123 (192.168.109.1).
Nov 11 19:54:19 nas systemd[1]: Time has been changed
Nov 11 19:54:36 nas kernel: ata1: exception Emask 0x10 SAct 0x0 SErr 0x41d0000 action 0xe frozen
Nov 11 19:54:36 nas kernel: ata1: irq_stat 0x80000040, connection status changed
Nov 11 19:54:36 nas kernel: ata1: SError: { PHYRdyChg CommWake 10B8B Dispar DevExch }
Nov 11 19:54:36 nas kernel: ata1: hard resetting link
Nov 11 19:54:37 nas kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Nov 11 19:54:37 nas kernel: ata1.00: configured for UDMA/133
Nov 11 19:54:37 nas kernel: ata1: EH complete
Nov 11 19:55:12 nas kernel: ata1: exception Emask 0x10 SAct 0x0 SErr 0x41d0000 action 0xe frozen
Nov 11 19:55:12 nas kernel: ata1: irq_stat 0x80000040, connection status changed
Nov 11 19:55:12 nas kernel: ata1: SError: { PHYRdyChg CommWake 10B8B Dispar DevExch }
Nov 11 19:55:12 nas kernel: ata1: hard resetting link
Nov 11 19:55:13 nas kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Nov 11 19:55:13 nas kernel: ata1.00: configured for UDMA/133
Nov 11 19:55:13 nas kernel: ata1: EH complete
Nov 11 19:55:46 nas systemd[1]: Mounting /usr/portage Squash-Portage...
Nov 11 19:55:46 nas systemd[1]: Mounted /usr/portage Squash-Portage.
Nov 11 19:55:46 nas systemd[1]: Starting Squash Portage...
Nov 11 19:55:46 nas systemd[1]: Started Squash Portage.
Nov 11 19:56:00 nas kernel: ata1: limiting SATA link speed to 3.0 Gbps
Nov 11 19:56:00 nas kernel: ata1: exception Emask 0x10 SAct 0x0 SErr 0x41c0000 action 0xe frozen
Nov 11 19:56:00 nas kernel: ata1: irq_stat 0x80000040, connection status changed
Nov 11 19:56:00 nas kernel: ata1: SError: { CommWake 10B8B Dispar DevExch }
Nov 11 19:56:00 nas kernel: ata1: hard resetting link
Nov 11 19:56:01 nas kernel: ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
Nov 11 19:56:01 nas kernel: ata1.00: configured for UDMA/133
Nov 11 19:56:01 nas kernel: ata1: EH complete

To eliminate the harddisk as a source of failure, I tried a 2nd one, which gives me the same error.

Any ideas?
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
November 12, 2016 03:21PM
Well, found the solution.

I installed powertop to lower the power consumption even a little more. Powertop put
echo 'min_power' > /sys/class/scsi_host/host[01]/link_power_management_policy
Seems, the SATA controller doesn't like a power save modus. After changing it back to max_perfomance the errors disappeared.

Some more suggestions:
CONFIG_SECCOMP=y  # needed by systemd
CONFIG_TASKSTATS=y          # needed by iotop
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y           # /proc/config.gz
CONFIG_IKCONFIG_PROC=y      
CONFIG_SLUB=y
CONFIG_SLUB_CPU_PARTIAL=n
CONFIG_CC_STACKPROTECTOR_STRONG=y
CONFIG_EFI_PARTITION=y      # GPT-Support
CONFIG_MACH_ARMADA_370=n    # no need as we have a 380.
CONFIG_MACH_ARMADA_375=n
CONFIG_MACH_ARMADA_39X=n
CONFIG_MACH_ARMADA_XP=n
CONFIG_MACH_DOVE=n
CONFIG_BLK_DEV_LOOP=y       # Loopback-Device
CONFIG_IP_MULTICAST=y          # Multicast-Support (Minidlna)
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_WLAN=n                         # no wifi
CONFIG_WIRELESS=n
CONFIG_TRIM_UNUSED_KSYMS=y  # Trim Modules

Also I dropped:
  • all network-drivers except mvneta
  • input devices except evdev (Power Button)
  • HID devices

-> config file


Some things I didn't figure out:
Dynticks:
General Setup -> Timers subsystem:
    Timer tick handling:    
        HZ_PERIODIC, NO_HZ_IDLE, NO_HZ_FULL
I didn't find anything about this. Does ARM / Armada support dynticks? Currently we use HZ_PERIODIC.

Frequency scaling:
According to this patch the Armada chip supports frequency scaling. But neither I found anything related in the sys/proc filesystem nor did powertop show any scaling rates.

Things, that aren't working yet:
  • shutdown and reboot: The device stops, but the LEDs remain shining.
  • set the bootcmd value persistent in u-boot.
  • Nand / UBIFS access

Some almost Offtopic information::
Installed software:
The box is running Gentoo. I got installed so far: Pdnsd (Zone definition + Adblock), DHCP-server, Minidlna, Pyload, NZBGet, Nginx (Mediawiki, Kanboard) with php-fpm and Mariadb, Sane-Server, Git-Server.

Hardware:
The NSA326 was the successor of my old NSA325. But the case of the NSA325 is smaller and I don't have any use for the harddisk cage (I use 2 2.5" drives). So I put the motherboard into the NSA325 case. The dimensions and the position of the switches are identical. Additionally I removed the fan (which points only to the hdds) and put headsinks on the chips instead.

A huge thank you to all the guys, who helped to get this box running. So I got my 24/7 mini server back.
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 13, 2016 08:33AM
Thanks for the tips, musv!

I found, that Marvell closed the access to ARMADA370-FunctionalSpec-datasheet.pdf - I still have the local copy, but found no info on 'cpu scaling', 'timer tick', etc. Armada 370 had several power options (page 44, Power Management):

Quote
armada 370 datasheet, page 44

The key power save options provided by the devices include:
  •  CPU Idle (dynamic clock gating)
  •  L2 Idle (dynamic clock gating)
  •  CPU Deep Idle (CPU and L2 are powered down, context is stored in the DRAM and coherent I/O transactions are routed directly to the DRAM)
  •  DRAM self refresh and power down modes
  •  EEE (Energy Efficient Ethernet) and LPI (Low Power Idle) support
  •  SERDES power down options
  •  USB interface placed in suspend mode
  •  Shutdown or clock gating of non-used units and interfaces
  •  PCIe power save states
The device also provides many wake-up options from the power save modes. These include:
  •  An extended Wake On LAN (WOL) definition
  •  Wake on USB
  •  Wake by a System Timer / RTC Alarm
  •  Wake on GPIO interrupt

For further information about the Power Management capabilities, see Section 28, Power Management, on page 383.

Also, there's a webform for accessing Armada 380 datasheet (see 'Documentation' section on the right). Haven't requested yet, may be some useful bits can be found there. In case anyone wants to have a look.

Quote
musv
Things, that aren't working yet:
shutdown and reboot: The device stops, but the LEDs remain shining.
'sudo reboot' works for me - as I said, my kernel+initramfs flashed to NAND, so default bootcmd just works - system boots/reboots itself without requiring any manual action.

shutdown doesn't work - neither 'shutdown -h now' nor Power Button on the front (doesn't work for me at all, I need to apply your config may be) - kernel says 'system halted', but cannot turn the power off completely, LEDs remain on, fan is spinning.
rr4m
Re: Zyxel NAS326 - Debian / Boot from USB?
November 13, 2016 08:40AM
Also, my power saving tip. Having 2 HDDs inserted (7200rpm Hitachi 1TB + 5940rpm (on the box it says 5700rpm) Toshiba PA4293E-1HN0 3TB), I simply installed hdparm for setting hdd power modes. My /etc/hdpart.conf
/dev/sda {
  apm = 126
  spindown_time = 240
}

/dev/sdb {
  apm = 126
  spindown_time = 240
}
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: