OpenWrt installation on a ZyXEL GS1900-8

This is a f'up thread from Which 8-port switch?

So my conclustion from these quotes is, there are 2 ways

I use the OEM-webinterface and flash https://downloads.openwrt.org/snapshots/targets/realtek/generic/openwrt-realtek-generic-zyxel_gs1900-8-initramfs-kernel.bin

Afterwards i have to create a VLAN and flash again. So my question is, if I can't get the VLAN working und do a reboot, the ZyXEL GS1900-8 is the same as before loading the bin-file and I could not do anything wrong?

I have a Linux notebook and have no idea how I can setup a VLAN with it. But I have a
TP-Link TL-WR1043ND running v21-rc, which could be used.

If I can't get it work with this VLAN-configuration, I could use tftp and a serial cable. Is there somewhere a detailed explanation? I know only:

rtk network on

I never used a serial cable. I can open with my Linux PC a terminal-window, but then I have no idea how to go on.

Depends on your definition of "wrong" :slight_smile:

Nothing is broken. But the switch will be set to boot from the OpenWrt initramfs image after the initial flash from OEM. You can only change back to OEM by using either booloader (using console) or OpenWrt (ssh to 192.168.1.1 over vlan 100 on port 1).

There are very (maybe too?) detailed instructions in the wiki docs

What you need to do is simply:

  1. connect TX, RX and GND according to the pinout documented on the device page. Do not connect 3.3V (VCC)
  2. open the USB tty device with a terminal emulator like minicom or picocom and set the speed as specified in the device page
  3. power on the switch and watch it boot. if there is no output, then switch the TX and RX and try again (it's hard to get thos right since you connect TX on one side to RX on the other and vice versa)
  4. press either Escape (on Netgear etc) or Space (on ZyXEL etc) to stop at the bootloader prompt

Now you can either switch back to OEM (if you flashed OEM to the second firmare partition and OpenWrt to the first) by doing

boota 1

or more complicated stuff like tftpboot from memory by doing

rtk network on
tftpboot 0x84f00000 openwrt-initframfs.bin
bootm

assuming you have a tftp server running on 192.168.1.111, serving openwrt-initframfs.bin and connected to one of the switch ports. No VLANs involved.

Or you can also just let the switch boot to the OpenWrt prompt and configure it from there.

This is getting much too long and complicated now.... Basically: You cannot do anything WRONG. There are a multitude of options and possible solutions. Describing them all just makes this look more complicated than necessary.

2 Likes

Thanks, good to know, so not a simple trial and error.

It looks at least for me, that no solution is very simple. Everything is easy, if you have done it once with success.

First, change the VLAN from 2 to 100 for the wan port on the TL-WR1043ND. Next, change the lan IP of the TL-WR1043ND from 192.168.1.1 to 192.168.2.1 .Then you can talk to the ZyXEL GS1900-8 at 192.168.1.1 on vlan100.

2 Likes

I am angry, that I am doing something wrong.

I assume that my notebook has a static IP 192.168.1.3

The TL-WR1043ND has 192.168.1.1, so I can connect from the notebook. WAN is not connected at the TL-WR1043ND. Therefore the TL-WR1043ND has no internet connection.

I change VLAN from 2 to 100 for the wan port on the TL-WR1043ND

Then I change the IP of the TL-WR1043ND from 192.168.1.1 to 192.168.2.1

This means the TL-WR1043ND has to reboot and the static IP of the notebook has to be changed from 192.168.1.3 to 192.168.2.3 and I can connect to the TL-WR1043ND again.

Unclear is, when I connect the GS1900 to TL-WR1043ND? The default IP of the GS 1900 is 192.168.1.1. So I cannot connect to the GS1900 for the "bin"-install, since my notebook use now network "2".

When do I have to flash https://downloads.openwrt.org/snapshots/targets/realtek/generic/openwrt-realtek-generic-zyxel_gs1900-8-initramfs-kernel.bin via OEM?

and when do I have to do the sysupgrade with 21.02.0-rc1 (r16046-59980f7aaf)?

What I understand until now, the sysupgrade has to be done immediately with no restart.

  1. flash initramfs from OEM,
  2. reboot to OpenWrt
  3. sysupgrade

Wrt networking: You are right that you have to access 192.168.1.1 over vlan 100 on port 1 from an address in 192.168.1.0/24.

The device will auto reboot and start the initramfs image, if manually rebooted the initramfs is lost ... ?

The magic word here is flash the initramfs image (and I would add, to the first partition set), something one would usually never do - in order to then boot into this flashed initramfs image, before sysupgrading to the proper OpenWrt sysupgrade image.

This slightly uncommon two-step procedure is done to coax the OEM upgrader into accepting the OpenWrt image (as it is also done on selected other devices, e.g. map-ac2200 or rt-58u).

No, not if you flash the initramfs from OEM.

Ahh! the magic word is indeed flash :wink:

good point, thnx for the explanation, both of you.

Perhaps the name of the 1st flash file should be something else than initramfs .... ?

The more straight forward approach would be to hook up the serial console, interrupt u-boot, enable the network, select booting from the first partition and tftpboot/ bootm the initramfs image and to then flash the sysupgrade image from the RAM-booted initramfs image, but users often have reservations against using the serial console (although the gs1900 family makes it easy, three standard head philips PH1 screws, pre-populated and marked 2.54mm pitch/ 3.3V header and a cooperative u-boot).

About the naming, this really is the normal initramfs image, which is abused to defeat the OEM upgrader.

Yes, using the first partition for OpenWrt is good advice.

The initramfs will work from any of the partitions, but the sysupgrade will always use and overwrite the first one. I'm not sure it will adjust the bootpartition variable, though? So you may end up booting the initramfs again if you installed it in the second partition.

In any case, you can save the second partition for OEM firmware by making sure the initramfs is flashed to the first one. You'll obviously have to install the OEM firmware in the second partition if you want this. Doing that before installing OpenWrt is easiest. The OEM firmware GUIs I've used (ZyXEL and Netgear) allow direct partition selection both for flashing and boot default. So there are no tricks involved. Just select the second one for your OEM image and the first one for the OpenWrt initramfs, and then set OpenWrt to be booted by default.

This is what has happened to me.
I flashed the initramfs in the Zyxel webui without making sure the first partition was selected. Once Openwrt booted I tried flashing squashfs without any errors.
Any changes made are discarded on reboot so I assume initramfs is on partition 2.
I have tried listing/switching partitions with /usr/sbin/fw_printenv -n boot_part with no luck. The error reads something like boot_part not classified.

So how do I get myself out of this situation?
How do I get openwrt squashfs on partition 1 and ideally zyxel fw on partition 2?

Any pointers are greatly appreciated.
Many thanks.

This is not a big problem. Worst case is that you have unnecessarily overwritten the OEM firmware in the second partition. But that can easily be restored later, so no big deal.

We can't make that assumption based on this fact. Changes done while running the initramfs will always be discarded. They are only written to a ramfs.

I'm not sure if the "printsys" changes have been merged - probably not?

What you always can do, is create a new config file for fw_printenv and use that:

echo "/dev/mtd2 0x0 0x1000 0x10000" >/tmp/fw_sys.config
fw_printenv -c /tmp/fw_sys.config

This should output something similar to

resetdefault=0
mac_start=BC:CF:4F:76:54:32
mac_end=BC:CF:4F:76:54:3C
sn=S202L28001234
dualfname1=2.60(AAZI.2)C0.bix
dualfname0=x.bin
bootpartition=0

Don't worry if some of those variables are missing. The important part is to see if you have bootpartition set to 0 or 1. If it's not there, then that's the equivalent to 0.

If it is set to 1, then you could try to change it to 0 using

fw_setenv -c /tmp/fw_sys.config bootpartition 0

But this will probably fail due to /dev/mtd2 being read-only (unless your initramfs i a recent image built from master). If so, then you have to try again after installing kmod-mtd-rw (hoping you do have an initramfs where this is an option...):

opkg install kmod-mtd-rw
insmod mtd-rw.ko i_want_a_brick=1
fw_setenv -c /tmp/fw_sys.config bootpartition 0

DO NOTE the name of that parameter! It's not a joke. Be really careful and think twice after loading that module. It makes all your partitions writable, including the bootloader. There is no safety net when this is module is loaded. But it is a really useful tool for these situations.

Thanks bmork for your speedy, calming, extensive and helpful response!
It is very much appreciated.

I'm happily running Openwrt 19.07 on two other devices on my network and the GS1900-8 is the most recent addition. Backups before and after making any changes has saved me many times unfortunately I got complacent and didnt do the required research before flashing the GS1900-8. The comupter gods showed mercy... this time...

Any how The image used was rc3 and

did the trick.

If its not to much to ask and not considered post-jacking how would one go about flashing the ZYXEL firmware to partition 2?

Thanks again,
Detour

I have never tried this, so please sanity check my instructions before using...

  1. download and unzip the wanted version from ZyXEL
  2. scp the *.bix image to /tmp on the GS1900-8
  3. flash it to partition 2 using
    mtd write /tmp/*.bix runtime2

Optionally configure the switch to boot from partition 2 using
fw_setsys bootpartition 1
Possibly with the same config file trick as before if you don't have /etc/fw_sys.config configured

Note that the switch will boot frompartition 2 until you change it back after this. But you can do that in the OEM web GUI without installing any new image.

Hi all,

I'm unable to flash the snapshot version of initramfs on the GS1900-8HP. Anyone have any tips on what I could be doing wrong?

I used this initramfs snapshot though I tried the v21.02.0-rc3 initramfs as well
https://downloads.openwrt.org/snapshots/targets/realtek/generic/openwrt-realtek-generic-zyxel_gs1900-8hp-v2-initramfs-kernel.bin

First I attempted to use the zyxel web UI to flash the snapshot initramfs to the first partition ("Active" in the zyxel web UI)

The attempt was unsuccessful and the the following message appears:

Device only can support firmware from V2.10(AAHI.0) and later version

I tried to flash the initramfs from both http and tftp in the zyxel web UI and received the same message.

Next I tried to connect via serial connecting only TX and RX. I used the screen /dev/tty.usbserial-1450 115200 command but the output I get is garbled and unreadable.

I was able to ssh into the switch as the admin user (default). I'm unable to run other commands suggested in this thread (such as fw_printenv) but was able to get the following info:

GS1900# show running-config
! System Description: ZyXEL GS1900-8HP Switch
! Revision: B1
! Boot Version: V2.0.0.0 | 07/17/2015
! Firmware Version: V2.60(AAHI.4) | 05/24/2021

Any help is greatly appreciated

Yes, that is the result of an unfortunate bug in our current (both 21.02 and master) image code. The ZyXEL switches won't accept the initramfs images we are currently creating.

I sent a patch recently, but it is not applied yet:https://patchwork.ozlabs.org/project/openwrt/patch/20210624210408.19248-1-bjorn@mork.no/

If you build your own images, then you can apply that locally. And/or push on some developer with commit rights to include it.

2 Likes

Thank you so much for your advice and patch. I was able to successfully upload the image through the zyxel web UI after building w/ your patch applied.

1 Like