Welcome! Log In Create A New Profile

Advanced

[project cancelled] Automated Debian Installer for Zyxel nsa310, 320 and 325

Posted by bobafetthotmail 
PROJECT CANCELLED because the firmware and stock uboot are not reliable enough, the entire point of this was avoiding the need to install a new uboot and using a serial connection, but if it fails so often as reported (here and elsewhere) it's a waste of time and a danger for newbies.
Links have been removed.
Preserving the below post for posterity.

I made an automated installer to install Debian easily on nsa310, 320 and 325 (and probably 310s and 320s too).

It did take some minor ideas from the Arch install script, but is safer, smarter, heavily commented, and sets the stock bootloader to multiboot even if stock bootloader lacks scripting capability.

Tries to boot from USB 0
Tries to boot from USB 1
Tries to boot from USB 2
Boots its original firmware

If it finds a Debian kernel it loads and boots it, this stops the sequence.

My NSA310 can boot from USB so I guess a NSA320 can too.

You can find it here https://www.dropbox.com/sh/5xodlvxb9u41smt/AACFlcpl14vRQeurbPPnJ5Vza?dl=0

I made this installer to allow less-experienced users to install Openmediavault in their NAS, so the tar packages in my dropbox are from the latest Debian Wheezy by Bodhi with Openmediavault 1.9 preinstalled.

You can change the boot-nsaXXX.tar to a tar containing the contents of the boot partition of any rootfs from bodhi, if you open it you will find also a readme with instructions on how to package the dtb into the zimage (from bodhi).
This is needed for stock uboot to boot such kernels.

You can change the debian-something.tar to another tar containing the rest of the rootfs from bodhi, as long as it is called debianXXXXXXX.tar (XXXXX can be whatever)

the NAS firmwares have bzip2 program too so you can also easily modify the script to have the NAS unzip bodhi's rootfs directly.

If you want to run this on nsa310s or 320s you need to look at the initial model check and add the model name of your NAS, you need to boot the original firmware and write in console
cat /zyxel/mnt/info/modelid
to get the model you can add to the script checks.

If you modify the script feel free to post the modifications below (or a link), so I can include them or make more versions.



Edited 2 time(s). Last edit at 03/03/2016 02:58AM by bobafetthotmail.
Dear,
Thanks for the effort!
Would it please be possible to post the -keys version for the nsa320? (nsa320-v4.70-keys)
Thank you!
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 06, 2015 04:10AM
I uploaded keys that *should* theoretically work.
If they don't, you will have to make them with instructions in "create salted checksums.txt"

Due to OpenMediaVault limitations on disk partitioning (cannot change partitions on its own system drive), I modified the installer so you can only install Debian on a USB drive (so you can repartition/format the Sata data drives from OMV).



Edited 1 time(s). Last edit at 08/06/2015 04:18AM by bobafetthotmail.
osa
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 06, 2015 05:47AM
Hi bobafetthotmail
Please review my scripts (based on arch's)
It supports GPT, raids and nand installer

https://www.dropbox.com/sh/w5zpp0utb88a1jt/AACkxs_PqH2IZdzvW4MSxt83a?dl=0&s=so
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 07, 2015 08:58AM
Cool script, thanks.

I thought GPT support was an issue of stock bootloader. Can stock bootloader boot from GPT disks now?
(they disabled the watchdog in their u-boot a few firmwares ago, they enabled GPT booting now? What's next, dtb boot? )

NAND install is boss, but is a bit useless to me because there isn't enough space to store Debian + OpenMediaVault, and I'd rather keep the firmware on it as a backup/recovery system.

The RAID creation part is interesting, I but can do that only on USB drives due to Openmediavault limitations as said above.
osa
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 07, 2015 09:39AM
I skipped GPT limit by putting kernel and initram into NAND if disk is > 2TB

I remember i was able to create lvm by hand and was able to use it in OMV
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 08, 2015 06:17AM
>I skipped GPT limit by putting kernel and initram into NAND if disk is > 2TB

Does that erase stock firmware? I don't want to do that as my script is aimed at less-savyy users, I want it to work as recovery.

> I remember i was able to create lvm by hand and
> was able to use it in OMV

I was talking of using the webinterface. OMV can raid/partition only data drives.

Doing it over SSH is of course doable (being Debian...) but again, this stuff is supposed to be used by less-savyy users.
osa
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 08, 2015 07:04AM
bobafetthotmail Wrote:
-------------------------------------------------------
> Does that erase stock firmware?
We have 2 copies of kernel/rootfs so it detects which was used to boot and overwrite second copy

This is limitation of OMV. Did somebody filled such bug or feature request?
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 09, 2015 02:34PM
osa Wrote:
-------------------------------------------------------
> bobafetthotmail Wrote:
> --------------------------------------------------
> -----
> > Does that erase stock firmware?
> We have 2 copies of kernel/rootfs so it detects
> which was used to boot and overwrite second copy

Cool. Will definitely need to look into this.
Why there are two copies?

> This is limitation of OMV. Did somebody filled
> such bug or feature request?

No reason to. It's a choice of the lead developer, he isn't targeting low-end ARM devices.

Heck, they don't even officially support installing on USB drives, I had to do some debugging to see what was getting written and then write a plugin with smart tmpfs folder usage to relocate most of that stuff to ram.

OMV is writing something like 1 GB or so per day to the OS drive, the average flash thumdrive does have some kind of wear leveling nowadays, but will usually die within a year. The developer's answer was "get a SSD", the community was clueless as to the cause of this and was blaming the thumbdrives and SD cards for being "unreliable".

Will probably have to write a plugin for advanced partitioning too... :/

Besides, OMV (the core) is a one-man project, so yeah, probably he is focusing on more important stuff.
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 11, 2015 01:32PM
yes two copies und one of them is a little bit hosed (NSA320s, NSA325v2)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 28, 2015 03:30AM
Hi,
I tried to install your package with new U-Boot as descibed here!, but no success - see attached log.

Kind regards,
Dieter
Attachments:
open | download - screenlog_install.txt (12.1 KB)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
August 30, 2015 06:23AM
After repairing the envs for the new u-boot as proposed here I installed your package manually in one ext3-partition and can boot it.
Great! Now I can experiment with OMV. Thanks for your work!
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 09, 2015 10:56AM
I have tried this on my NSA325 with Stock FW 4.80. Never flashed uboot or anythign else before.
Unfortunately now the device is in a reboot loop with all LEDs flashing after a few seconds and then reboot.
How to fix this?
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 10, 2015 02:05AM
sebr Wrote:
-------------------------------------------------------
> I have tried this on my NSA325 with Stock FW 4.80.
> Never flashed uboot or anythign else before.
> Unfortunately now the device is in a reboot loop
> with all LEDs flashing after a few seconds and
> then reboot.
> How to fix this?

Do you have serial consle or netconsole?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 11, 2015 07:15PM
Yeah, it stated bad magic number. In u-boot I did a resetenv. Now the device is at least booting the stock firmware again. But it seems as it does not pick up anything from usb anymore to boot from :-(
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 12, 2015 12:27AM
sebr,

> In u-boot I did a resetenv.

Bad move! It has reset your u-boot envs to the internal u-boot values. So it will always boot stock. To boot with USB again, you need to repeat the envs settings to enable it.

What is your goal? do you just want to boot the latest Debian kernel? or do you want to install new u-boot?

Latest kernel/rootfs:
http://forum.doozan.com/read.php?2,12096

Latest u-boot:
http://forum.doozan.com/read.php?3,12381

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 12, 2015 04:25AM
if you wrote resetenv you need to run the installation again to get the u-boot to boot usb drive.

Can you post the text when you write "printenv" after the install in u-boot console?
Will tell me if the settings are correctly set, as with the settings I have if I pull the USB drive my NAS boots the stock firmware.

Also the boot log from console and any text in a text file called ERROR LOG or somesuch in the installer USB drive (if any such file is created).
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 12, 2015 07:41AM
Well thanks for your quick reply. I already read through tons of posts here but still I might have been missing something.
What this automated installation does is exactly what I want: boot to debian if there is a usb key attached, else boot to stock. So that for testing purposes I can easily switch. There is no need for a new u-boot if I am not mistaken.
I really have no clue what went wrong. Just one guess: maybe the keys are different for NSA325v2 and NSA325v1 ?

So would you recommend running the automated installer again?
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 13, 2015 01:23PM
Just checking in here since I was commenting on the script over om OMV forum. Where I left off there was that after installing the script, my NSA320 simply would not boot off of the USB using the stock uBoot. Boot log is here. Looks like a timeout issue with the stock uBoot USB subsystem. At this point, I gave up on booting off USB and loaded Bohdi's 3.17 rootfs on the hard drive (OMV didn't add much to what I needed).

Reading through various threads here, I could not tell if there was any other work-arounds to this USB timeout issue other than flashing a newer uBoot. I have a working system right now (and successfully migrated from Arch to Debian, which was my original goal), so not in a rush to try anything yet. Though my curiosity may eventually get the better of me...
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 13, 2015 01:36PM
mtganzer,

> 219]here[/url]. Looks like a timeout issue with
> the stock uBoot USB subsystem. At this point, I
> gave up on booting off USB and loaded Bohdi's 3.17
> rootfs on the hard drive (OMV didn't add much to
> what I needed).

Probably the USB power poke is needed (I can't recall exactly if the NS320 needs it like the NSA325). After you've poke the USB device in u-boot env, you should be able to boot with it. Somewhere in the forum I have instruction for pengu to do this.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 13, 2015 02:22PM
sebr Wrote:
-------------------------------------------------------
> Well thanks for your quick reply. I already read
> through tons of posts here but still I might have
> been missing something.
> What this automated installation does is exactly
> what I want: boot to debian if there is a usb key
> attached, else boot to stock. So that for testing
> purposes I can easily switch. There is no need for
> a new u-boot if I am not mistaken.
> I really have no clue what went wrong. Just one
> guess: maybe the keys are different for NSA325v2
> and NSA325v1 ?
>
> So would you recommend running the automated
> installer again?

If you don't post any log I don't have any clue either, so if you want to try again please post all terminal output and the commands I told above so I can see too what is happening. :)

NSA325 have the same motherboard, the difference is only the plastic case.
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 13, 2015 09:56PM
bodhi Wrote:
-------------------------------------------------------
>
> Probably the USB power poke is needed (I can't
> recall exactly if the NS320 needs it like the
> NSA325). After you've poke the USB device in
> u-boot env, you should be able to boot with it.
> Somewhere in the forum I have instruction for
> pengu to do this.

Thanks. I will look for that as I read through the forum to get up to speed. Not in any rush, and thinking since I have gotten this far, it may be just as easy to flash a newer uBoot as it would be to spend much more time mucking with the current one. I don't care about having to go back to "stock". I just need to read the instructions a dozen more times to make sure I understand what I am doing :-)

-Mark
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 14, 2015 12:47AM
mtganzer Wrote:
-------------------------------------------------------
> Thanks. I will look for that as I read through the
> forum to get up to speed. Not in any rush, and
> thinking since I have gotten this far, it may be
> just as easy to flash a newer uBoot as it would be
> to spend much more time mucking with the current
> one. I don't care about having to go back to
> "stock". I just need to read the instructions a
> dozen more times to make sure I understand what I
> am doing :-)
>
> -Mark

Hi Mark,

The most important thing is serial console, and being able to boot with UART booting method. If you do have the UART booting capability, then the rest is easy, because you have a rescue method should anything goes wrong during flashing u-boot.

Ask questions in the u-boot thread if you're not sure about something. Experienced Linux desktop users never have to mess with boot loader, so it's natural that it takes some learning :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 16, 2015 10:07AM
Done and done and now booting from the USB flash. Though I did "break the rules" and keep separate boot & rootfs partitions since I wanted to copy over the already-working setup from SATA to USB. You are right...haven't had to dig this deep into boot loaders since LILO days and compiling custom kernels to test early IPv6 implementations.
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 16, 2015 11:55AM
mtganzer,

> Done and done and now booting from the USB flash.
> Though I did "break the rules" and keep separate
> boot & rootfs partitions since I wanted to copy
> over the already-working setup from SATA to USB.

It's fine whatever partition scheme you like to use. The single partition was emphasized for installation purpose only.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 17, 2015 01:51AM
Thanks for your work. It is running now on my dockstar!

1. I installed Jeff's uboot from here.
2. I unpacked your package in a single ext3 partition on my dockstar.
3. I took bodhi's 4.2 kernel from here , extracted the kernel files manually and used method 4.b.

Works like a charm :).
eternalerection
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 25, 2015 04:55AM
Dear thread,

I'm planning on doing this epic installation to my NSA325v1 and I have a few fairly basic questions that I would like to have cleared out before attempting this myself.

1. Currently I'm runnin 4.8 stock firmware and have 2x2tb HDD's in RAID 0. When doing the debian installation, do I need to detach the HDD's from the NAS? I other words, does the "detach all external drives" include these drives also?

2. Can I use the mentioned RAID0 setup as it was before the installation and with all files untouched or does the openmediavault require me to start the array from scratch?

3. Investigating on the topic of Debian+nsa325 I'm constantly confronted with messages saying that this operation requires a serialcable. There's nothing mentioned about that in this thread. Do I need one or have you made the cable unnecessary?

4. Are there any other prequiseties before I can start to follow the instructions provided? Do I for example need to do something uboot-related before attempting this or does the script handle everything?

Sorry about the fairly lengthy post and thank you in advance to whomever finds the time to answer my questions!
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 25, 2015 12:10PM
1. yes. only drives in the NAS must be USB drive installer and USB drive where you are installing OMV in. No sata drives.

2. theoretically, it should work as it's standard linux software raid, but I can't give any real guarantee on that, so backup the data.

3. serial cable is best. Allows you to talk to the bootloader (the "BIOS" kinda) of this device, which means you can reconfigure it in case it screws up or change config easily. This script should make the serial unnecessary, BUT as you see above, there are some cases where it did not work correctly and I have no clue why, and the stock u-boot has dumb limitations (it does not recognize all usb drives). Being a very cheap dongle, you can leave it connected even after you close the box again, just in case.

3a. there are serial (actually UART is the port) thingies that bridge that to bluetooth connection (so you can use a smartphone/tablet to serial the NAS) and serial-ethernet thingies that bridge that to ethernet. Never tried my self.

3b. The serial I recommend (use myself) is this http://www.ebay.co.uk/itm/USB-2-0-to-TTL-UART-5PIN-CP2102-Module-Converter-Connector-Adaptor-Cable-UK-/171272467395?hash=item27e0a273c3
It's a simple and cheap chinese one, but has lights that tell you serial activity. It's very useful to know if you connected the cables the right way. If the TX (transmit) led lights up and you aren't doing anything... you need to reverse TX and RX (receive). :)
Also has chip name in plain view, which is needed if you want Windows drivers for it.

4. the script should handle all. But having a serial is sadly recommended due to unforseen issues.
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 25, 2015 12:40PM
You will want a console cable in case anything goes wrong. Tthe Adafruit console cable for the Raspberry Pi http://www.adafruit.com/product/954 also works with the Zyxel's
eternalerection
Re: Automated Debian Installer for Zyxel nsa310, 320 and 325
September 25, 2015 12:45PM
Thank you! I'll be sure to order the mentioned cable as a fail-safe before attempting this. What a great community you have here.
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: