Welcome! Log In Create A New Profile

Advanced

Debian on Zyxel NAS326

Posted by Kirsch 
Re: Debian on Zyxel NAS326
January 22, 2020 04:40AM
Proceeded with linux-4.9.0-mvebu-tld-12-bodhi.tar.bz2
Update successfull.
root@debian:~# uname -a
Linux debian 4.9.0-mvebu-tld-12 #2 SMP PREEMPT Wed Feb 1 02:31:29 PST 2017 armv7l GNU/Linux

Still no network.
ping 192.168.1.25
PING 192.168.1.25 (192.168.1.25) 56(84) bytes of data.
64 bytes from 192.168.1.25: icmp_seq=1 ttl=64 time=0.042 ms

root@debian:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.25 icmp_seq=1 Destination Host Unreachable
Re: Debian on Zyxel NAS326
January 22, 2020 04:44AM
bodhi Wrote:
-------------------------------------------------------
> vadim,
>
> To summarize: at home network works OK, but at
> work with this TP-Link router it does not?
>
> Could it be a IP address block restriction in the
> router setting?
>
> I guess we should try the latest kernel to see if
> any difference. I will come back and post the env
> change to boot
> linux-5.3.5-mvebu-tld-1-bodhi.tar.bz2

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
January 22, 2020 04:47AM
To summarize: at home network works OK, but at work with this TP-Link router it does not?
Yes.

Could it be a IP address block restriction in the router setting?
No, stockOs loads ok and receives IP by DHCP. I can navigate by browser http://stockdhcpip

I can use IP by cross cable between my PC and NAS. Bodhi debian works like intended.
I can switch my PC from wi-fi to wired and TP-Link works alright.

I think TCP/IP stack is fine. Something wrong on lower levels of OSI with router and usb-debian.

And still I had not heard of any problem from my colleagues and guest wi-fi users.



Edited 1 time(s). Last edit at 01/22/2020 04:54AM by vadim.
Re: Debian on Zyxel NAS326
January 22, 2020 12:48PM
vadim,

Please take look at the kernel upgrade instruction here and let me know if you have any question:

https://forum.doozan.com/read.php?2,88619,94989#msg-94989

My box u-boot envs have changed quite a bit, so I can't test this exact instruction on top of the original installation steps.

You are the tester :)

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 01/22/2020 02:36PM by bodhi.
Re: Debian on Zyxel NAS326
January 23, 2020 12:46AM
Followed your instructions literally.

root@debian:~# uname -a
Linux debian 5.3.5-mvebu-tld-1 #1.0 SMP PREEMPT Tue Oct 8 21:03:08 PDT 2019 armv7l GNU/Linux

root@debian:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.364 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.277 ms

Long live bodhi!!!

Thanks a lot for making me study. I got a strong interest in arm devices now.
Re: Debian on Zyxel NAS326
January 23, 2020 03:31AM
vadim,

Cool :) I'm glad that solved the problem. Thanks for testing the upgrade instruction!

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
January 23, 2020 03:45AM
I upgraded debian, installed mdadm, mounted raid1.
The box already installed to rack.
Already copying backups with scp under sshpass.

Sorry to fail boot log. screen -L -Logfile file left no file.
Then I was overwhelmed and proceeded with hard disks and
my fellow admin assembled the box and carried it away.
Can post dmesg here if it's useful.

Download speed is ok. Perfect poor man's solution.
Thanks Zyxel but no thanks.
The box might be more friendly and ready for tweaks.
Thanks go to bodhi and all forum's members for sharing knowledge.

"And in the end, the love you take is equal to the love you make."
Re: Debian on Zyxel NAS326
January 23, 2020 08:52PM
vadim,


> I upgraded debian, installed mdadm, mounted
> raid1.
> The box already installed to rack.
> Already copying backups with scp under sshpass.
>
> Sorry to fail boot log. screen -L -Logfile file
> left no file.
> Then I was overwhelmed and proceeded with hard
> disks and
> my fellow admin assembled the box and carried it
> away.
> Can post dmesg here if it's useful.
>
> Download speed is ok. Perfect poor man's
> solution.
> Thanks Zyxel but no thanks.
> The box might be more friendly and ready for
> tweaks.
> Thanks go to bodhi and all forum's members for
> sharing knowledge.
>
> "And in the end, the love you take is equal to the
> love you make."

Proud to hear my works being used in productive environment :) awesome!

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
February 25, 2020 04:56AM
vadim Wrote:
-------------------------------------------------------
> I upgraded debian, installed mdadm, mounted
> raid1.

I'm really having a hard time to setup the raid with debian. Every time the whole /dev/sdb device gets lost after touching anything with /dev/sdb (lsblk).
For example: even if I'll try to mount the Zyxel array it takes pretty long and afterwards the /dev/sdb is lost until reboot.
Operations on /dev/sda is not a problem.
I've switched the disks already and on the stock firmware it runs without a problem.

Any help on that would be appreciated.
Re: Debian on Zyxel NAS326
February 25, 2020 07:50AM
The discs /dev/sda and /dev/sdb are only physical devices. While they are connected and operational lsblk must show them no matter what. Troubles may begin when you would try to mount them for example.
I would look at full dmesg log for starters.

>>dmesg > /dmesg.txt
>>poweroff

Move the file from usb-stick to your computer and attach to the post.
Re: Debian on Zyxel NAS326
August 08, 2020 09:25AM
Hi guys,

I have had a power outage so I was thinking if it is possible to add the "always power on" mode like the original ZyxelOS does. I found in this topic the following command:

/usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w


Am I right if I add this to rc.local the device will automatically turn on when power comes back? Currently I only added the WOL command (/usr/sbin/i2cset -y 0x0 0xa 0xa 0x0006 w), it is working but it would much easier like this and I also don't want to test a power outage if not neccessary :)
Re: Debian on Zyxel NAS326
August 08, 2020 10:09AM
You probably want to add something to disable it for a shutdown/halt (unless this wouldn’t affect that)

I’m doing something very similar for a different device:
https://github.com/1000001101000/Debian_on_Buffalo/blob/master/Tools/rtc_restart.sh

For systemd the script is placed in /lib/systemd/system-shutdown/ and then systemd passes restart/shutdown/halt/kexec to it as needed. I assume you can do something similar is the appropriate rc* script.
Re: Debian on Zyxel NAS326
August 08, 2020 05:14PM
cyraxxx,

> the original ZyxelOS does. I found in this topic
> the following command:
>
> /usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w
>

Very nice! I forgot about this, could you post the link.


> Am I right if I add this to rc.local the device
> will automatically turn on when power comes back?

Yes. This probably disabled the Power button mechanism.

> I also don't want to test a power outage if not
> neccessary :)

I think it is safe to test this. i2c is a standard mechanism for these Zyxel boxes to control things like this. But you should remove all the disk drives (USB and HDD). And then create another USB with the basic rootfs. Boot with this test USB.

This capability is something everybody who has the box running in a remote location wants to have. So it is very worthwhile to spend time testing it for yourself. If you have your box running 24/7 and cannot take it off-line, then let me know I will find sometime to test it! My NAS326 box is at a remote location, but I don't want open port to tunnel in at that place.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 08/08/2020 05:16PM by bodhi.
Re: Debian on Zyxel NAS326
August 09, 2020 05:41AM
Hi,

It is running 7/24 but I can access, so I will try. I just wanted to avoid the mentioned things (take off hdds, etc) as I am lazy and if someone already tried, it is easier :D

In this case I will do the tests of power outage and report back.

The commands can be found in the WOL post which is linked in the first post :) ( https://forum.doozan.com/read.php?2,27108,91509#msg-91509 )

@1000001101000 thanks for the tip, really useful, I will try to implement if the above command is working. But TBH in my case a simple workaround can be enough as I never shut it down ( if I want to normally shutdown, delete the command from rc.local reboot then shutdown ) -> but I will create the complete solution maybe others will benefit.
Re: Debian on Zyxel NAS326
August 09, 2020 03:54PM
cyraxxx,

> The commands can be found in the WOL post which is
> linked in the first post :) (
> https://forum.doozan.com/read.php?2,27108,91509#msg-91509
> )

Ah :) I overlooked that part.

> I will
> create the complete solution maybe others will
> benefit.

That would be nice! you could create a script (that runs in rc.local ) that exports an alias command to set an env or create an empty file somewhere. That env or file would be an indicator that you want to keep the Power always on. You can also run it at command line. Something simliar to the set_persistent_mac_address script that I included in the latest rootfs Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
August 09, 2020 05:07PM
@cyraxxx
In the case of the Buffalo NAS devices most won’t reboot without sending a code to the RTC, on-board microcontroller or triggering the WOL interrupt. Since they would otherwise poweroff I had a strong motivation to figure out how to manage the shutdown/restart scripts. For devices that reboot by default this is less important, though a clean shutdown is nice when moving a device or replacing disks/etc.
Re: Debian on Zyxel NAS326
August 18, 2020 05:40PM
I have had a couple hours to run some tests, so here are the results. As 030theo found out, there are 4 I2C commands which manages the WOL and the power-loss events.
As I don't know almost nothing about I2C buses, I tried to figure out some logic based on testing the commands. The tests were running on a fresh 5.2.9 rootfs without any modification/installation. First I typed the commands then added to rc.local, then started with a poweroff (then test plug out/plug in and WOL), then again (to see if reboot affects), then after two "sync" commands a simple plug out/plug in, then the same without sync. And after all these, one last poweroff test.

Maybe I could create a script, but that would be unnecessary as they are very easy to add simply to rc.local and they are only for NAS326, not a universal solution. Also if you poweroff the device with "poweroff" command, it won't power itself up again even if you plug out/plug in after poweroff so don't need to use @1000001101000 method.

[WOL ONLY]
So, in case you want only WOL, add to rc.local :
/usr/sbin/i2cset -y 0x0 0xa 0xa 0x0006 w (ENABLE WOL)
/usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0007 w (DISABLE AUTO-RESUME)

[WOL + AUTO RESUME]
If you want WOL + auto turn on after power loss:
/usr/sbin/i2cset -y 0x0 0xa 0xa 0x0006 w (ENABLE WOL)
/usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w (ENABLE AUTO RESUME)

[ONLY AUTO RESUME]
If you don't want WOL, just auto turn on after power loss:
/usr/sbin/i2cset -y 0x0 0xa 0xa 0x0306 w (DISABLE WOL)
/usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w (ENABLE AUTO RESUME)

The strange part for me is both commands instructs the same I2C address, so I needed some time to figure out the way of working. If somebody could also run some tests to verify these results, that would be great.
Re: Debian on Zyxel NAS326
August 18, 2020 06:44PM
cyraxxx,

Cool! Thanks for the tests.

> Maybe I could create a script, but that would be
> unnecessary as they are very easy to add simply to
> rc.local and they are only for NAS326, not a
> universal solution.

Sure. Most of the time they are something we would activate once and forget, until we want to change them again which is rare.

> Also if you poweroff the
> device with "poweroff" command, it won't power
> itself up again even if you plug out/plug in after
> poweroff so don't need to use @1000001101000
> method.

This is good to know. So shutdown will activate the Power button default behavior again.

> The strange part for me is both commands instructs
> the same I2C address

That indicates the value is a 32-bit bitmask. Setting the value at that location would turn on or off some bits in the bitmask.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
October 11, 2020 03:18AM
030theo,

Sorry I forgot about this, but I've added this finding to the Wiki

Quote

Sensors & Fan & WOL

OWFSPlug : 1-Wire File System + Motion Detection Software in a NAND Package
OWFS & Motion Detection (external link)
How to control GPIO in Linux userspace for GPIO-enable fan
Zyxel NSA 310S/320S/325/326 CPU Temperature and Fan Speed reading
Zyxel NAS326 WOL
Zyxel NAS326 Auto-Power Up

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 10/11/2020 03:29AM by bodhi.
Re: Debian on Zyxel NAS326
October 11, 2020 03:27AM
cyraxxx,

> I have had a couple hours to run some tests, so
> here are the results. As 030theo found out, there
> are 4 I2C commands which manages the WOL and the
> power-loss events.
> As I don't know almost nothing about I2C buses, I
> tried to figure out some logic based on testing
> the commands. The tests were running on a fresh
> 5.2.9 rootfs without any
> modification/installation. First I typed the
> commands then added to rc.local, then started with
> a poweroff (then test plug out/plug in and WOL),
> then again (to see if reboot affects), then after
> two "sync" commands a simple plug out/plug in,
> then the same without sync. And after all these,
> one last poweroff test.
>
> Maybe I could create a script, but that would be
> unnecessary as they are very easy to add simply to
> rc.local and they are only for NAS326, not a
> universal solution. Also if you poweroff the
> device with "poweroff" command, it won't power
> itself up again even if you plug out/plug in after
> poweroff so don't need to use @1000001101000
> method.
>
> [WOL ONLY]
> So, in case you want only WOL, add to rc.local :
> /usr/sbin/i2cset -y 0x0 0xa 0xa 0x0006 w (ENABLE
> WOL)
> /usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0007 w
> (DISABLE AUTO-RESUME)
>
> [WOL + AUTO RESUME]
> If you want WOL + auto turn on after power loss:
> /usr/sbin/i2cset -y 0x0 0xa 0xa 0x0006 w (ENABLE
> WOL)
> /usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w (ENABLE
> AUTO RESUME)
>
> [ONLY AUTO RESUME]
> If you don't want WOL, just auto turn on after
> power loss:
> /usr/sbin/i2cset -y 0x0 0xa 0xa 0x0306 w (DISABLE
> WOL)
> /usr/sbin/i2cset -y 0x0 0x0a 0x0a 0x0107 w (ENABLE
> AUTO RESUME)
>
> The strange part for me is both commands instructs
> the same I2C address, so I needed some time to
> figure out the way of working. If somebody could
> also run some tests to verify these results, that
> would be great.

Up in the Wiki (better late than never :)

Quote

Sensors & Fan & WOL

OWFSPlug : 1-Wire File System + Motion Detection Software in a NAND Package
OWFS & Motion Detection (external link)
How to control GPIO in Linux userspace for GPIO-enable fan
Zyxel NSA 310S/320S/325/326 CPU Temperature and Fan Speed reading
Zyxel NAS326 WOL
Zyxel NAS326 Auto-Power Up
Zyxel NAS326 WOL and Auto-Power Up I2C commands

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Zyxel NAS326
October 11, 2020 10:25AM
Quote

(better late than never :)

Haha, exactly :D
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: