Zyxel WAP6806 initramfs out of memory

I know it's unsupported, but I have a bunch of these old Armor X1s lying around and thought I'd give OpenWRT a try on them with the equally unsupported WAP6805 build. Flashing the 23.05.0-rc3 initramfs image worked well and the device boots fine. Unfortunately upload of the sysupgrade image fails at varying stages, I assume because the device runs out of RAM quickly. Stopping unneeded services (dnsmasq, firewall, cron, odhcp, ...) doesn't free up much, so "free" mostly shows "0" available RAM. Any ideas of the options I have now? Re-flashing a potentially smaller 22.03 version also needs a way to upload, running out of memory, too. I don't know how to go back to OEM firmware, but I'm adventurous and ordered a USB - serial adapter to dive down deeper.

It looks supported: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=c1794d653c89b33f85b68aaa655a736202925155

Please post the complete output of free -t and df -h when booting from initramfs.

Thanks for coming back. That's what I reckoned - if there's an image, something must work :wink: Here are the free/df results with all default services running:

              total        used        free      shared  buff/cache   available
Mem:          55704       27336       11372       15212       16996           0
Swap:             0           0           0

Filesystem                Size      Used Available Use% Mounted on
tmpfs                    27.2M     14.8M     12.4M  54% /
tmpfs                    27.2M     68.0K     27.1M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev

This should all work properly: You've got 27MB free space in /tmp to transfer the sysupgrade image to and roughly 11MB of free RAM - that should also be sufficient.

Now what error messages do you get / what's the exact problem?

Nearly all the time the device stops responding during upload of the sysupgrade image, sometimes right away, sometimes in the middle, sometimes towards the end. I'm using scp -O <image> root@192.168.1.1:/tmp. One time the upload succeeded, but as soon as I was trying to log in again the log filled with "out of memory" messages that I unfortunately didn't capture. Will try to reproduce.

I was finally able to capture the device's log when the upload fails. Looks like an oom problem.

<30>Aug 19 14:10:39 logread[2793]: Logread connected to 192.168.1.222:5557 via tcp
<86>Aug 19 14:11:02 dropbear[2806]: Child connection from 192.168.1.222:57000
<85>Aug 19 14:11:02 dropbear[2806]: Auth succeeded with blank password for 'root' from 192.168.1.222:57000
<4>Aug 19 14:11:05 kernel: [  609.479882] dropbear invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0
<4>Aug 19 14:11:05 kernel: [  609.500253] CPU: 1 PID: 2806 Comm: dropbear Not tainted 5.15.127 #0
<4>Aug 19 14:11:05 kernel: [  609.512741] Stack : 8089b888 808123d8 00000840 80083bc8 00000000 00000000 00000000 00000000
<4>Aug 19 14:11:05 kernel: [  609.529446]         00000000 00000000 00000000 00000000 00000000 00000001 81c4fb78 81441260
<4>Aug 19 14:11:05 kernel: [  609.546142]         81c4fc10 00000000 00000000 81c4fa20 00000038 8039e4c4 ffffffea 00000000
<4>Aug 19 14:11:05 kernel: [  609.562835]         81c4fa2c 000000d6 8081aa78 ffffffff 80738d00 81c4fb58 8253e200 0000079c
<4>Aug 19 14:11:05 kernel: [  609.579534]         00000000 00500cc2 8089b888 808123d8 00000018 80410730 00000004 80c90004
<4>Aug 19 14:11:05 kernel: [  609.596227]         ...
<4>Aug 19 14:11:05 kernel: [  609.601101] Call Trace:
<4>Aug 19 14:11:05 kernel: [  609.601116] [<80083bc8>] 0x80083bc8
<4>Aug 19 14:11:05 kernel: [  609.612949] [<8039e4c4>] 0x8039e4c4
<4>Aug 19 14:11:05 kernel: [  609.619908] [<80410730>] 0x80410730
<4>Aug 19 14:11:05 kernel: [  609.626860] [<80007908>] 0x80007908
<4>Aug 19 14:11:05 kernel: [  609.633808] [<80007910>] 0x80007910
<4>Aug 19 14:11:05 kernel: [  609.640753] [<803825bc>] 0x803825bc
<4>Aug 19 14:11:05 kernel: [  609.647702] [<801417a8>] 0x801417a8
<4>Aug 19 14:11:05 kernel: [  609.654665] [<80142000>] 0x80142000
<4>Aug 19 14:11:05 kernel: [  609.661618] [<801429f0>] 0x801429f0
<4>Aug 19 14:11:05 kernel: [  609.668563] [<80194a40>] 0x80194a40
<4>Aug 19 14:11:05 kernel: [  609.675509] [<80501328>] 0x80501328
<4>Aug 19 14:11:05 kernel: [  609.682497] [<801cb53c>] 0x801cb53c
<4>Aug 19 14:11:05 kernel: [  609.689466] [<801bd6cc>] 0x801bd6cc
<4>Aug 19 14:11:05 kernel: [  609.696427] [<801beba8>] 0x801beba8
<4>Aug 19 14:11:05 kernel: [  609.703373] [<80327ef8>] 0x80327ef8
<4>Aug 19 14:11:05 kernel: [  609.710321] [<800639c8>] 0x800639c8
<4>Aug 19 14:11:05 kernel: [  609.717271] [<801bee2c>] 0x801bee2c
<4>Aug 19 14:11:05 kernel: [  609.724251] [<8071a458>] 0x8071a458
<4>Aug 19 14:11:05 kernel: [  609.731195] [<801e7d34>] 0x801e7d34
<4>Aug 19 14:11:05 kernel: [  609.738144] [<801bf0b8>] 0x801bf0b8
<4>Aug 19 14:11:06 kernel: [  609.745093] [<8071a834>] 0x8071a834
<4>Aug 19 14:11:06 kernel: [  609.752040] [<80014550>] 0x80014550
<4>Aug 19 14:11:06 kernel: [  609.759010]
<4>Aug 19 14:11:06 kernel: [  609.762254] Mem-Info:
<4>Aug 19 14:11:06 kernel: [  609.766811] active_anon:633 inactive_anon:4898 isolated_anon:0
<4>Aug 19 14:11:06 kernel: [  609.766811]  active_file:0 inactive_file:0 isolated_file:0
<4>Aug 19 14:11:06 kernel: [  609.766811]  unevictable:0 dirty:0 writeback:0
<4>Aug 19 14:11:06 kernel: [  609.766811]  slab_reclaimable:446 slab_unreclaimable:2821
<4>Aug 19 14:11:06 kernel: [  609.766811]  mapped:1124 shmem:4882 pagetables:108 bounce:0
<4>Aug 19 14:11:06 kernel: [  609.766811]  kernel_misc_reclaimable:0
<4>Aug 19 14:11:06 kernel: [  609.766811]  free:1948 free_pcp:1149 free_cma:0
<4>Aug 19 14:11:06 kernel: [  609.836412] Node 0 active_anon:2532kB inactive_anon:19592kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:4496kB dirty:0kB writeback:0kB shmem:19528kB writeback_tmp:0kB kernel_stack:552kB pagetables:432kB all_unreclaimable? no
<4>Aug 19 14:11:06 kernel: [  609.884899] Normal free:7792kB min:8192kB low:10240kB high:12288kB reserved_highatomic:0KB active_anon:2532kB inactive_anon:19600kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:65536kB managed:55704kB mlocked:0kB bounce:0kB free_pcp:4596kB local_pcp:60kB free_cma:0kB
<4>Aug 19 14:11:06 kernel: [  609.937258] lowmem_reserve[]: 0 0
<4>Aug 19 14:11:06 kernel: [  609.943900] Normal: 32*4kB (UM) 22*8kB (UM) 6*16kB (U) 1*32kB (U) 1*64kB (M) 5*128kB (U) 4*256kB (U) 7*512kB (U) 2*1024kB (U) 0*2048kB 0*4096kB = 7792kB
<4>Aug 19 14:11:06 kernel: [  609.971315] 4882 total pagecache pages
<4>Aug 19 14:11:06 kernel: [  609.978796] 0 pages in swap cache
<4>Aug 19 14:11:06 kernel: [  609.985413] Swap cache stats: add 0, delete 0, find 0/0
<4>Aug 19 14:11:06 kernel: [  609.995836] Free swap  = 0kB
<4>Aug 19 14:11:06 kernel: [  610.001562] Total swap = 0kB
<4>Aug 19 14:11:06 kernel: [  610.007312] 16384 pages RAM
<4>Aug 19 14:11:06 kernel: [  610.012865] 0 pages HighMem/MovableOnly
<4>Aug 19 14:11:06 kernel: [  610.020509] 2458 pages reserved
<6>Aug 19 14:11:06 kernel: [  610.026808] Tasks state (memory values in pages):
<6>Aug 19 14:11:06 kernel: [  610.036193] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
<6>Aug 19 14:11:06 kernel: [  610.053385] [    490]    81   490      375      262    12288        0             0 ubusd
<6>Aug 19 14:11:06 kernel: [  610.069701] [    491]     0   491      265      148    20480        0             0 askfirst
<6>Aug 19 14:11:06 kernel: [  610.086535] [    526]     0   526      301      203    20480        0             0 urngd
<6>Aug 19 14:11:06 kernel: [  610.102855] [    730]     0   730      709      455    24576        0             0 uhttpd
<6>Aug 19 14:11:06 kernel: [  610.119355] [    998]   514   998      371      230    20480        0             0 logd
<6>Aug 19 14:11:06 kernel: [  610.135498] [   1052]     0  1052      892      566    20480        0             0 rpcd
<6>Aug 19 14:11:06 kernel: [  610.151638] [   1262]     0  1262      319      246    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  610.168472] [   1366]     0  1366      728      249    20480        0             0 hostapd
<6>Aug 19 14:11:06 kernel: [  610.185147] [   1367]     0  1367      728      249    20480        0             0 wpa_supplicant
<6>Aug 19 14:11:06 kernel: [  610.203014] [   1370]   101  1370      754      377    20480        0             0 hostapd
<6>Aug 19 14:11:06 kernel: [  610.219678] [   1371]   101  1371      754      393    16384        0             0 wpa_supplicant
<6>Aug 19 14:11:06 kernel: [  610.237550] [   1431]     0  1431      516      330    16384        0             0 netifd
<6>Aug 19 14:11:06 kernel: [  610.254051] [   1644]     0  1644      431      281    20480        0             0 odhcpd
<6>Aug 19 14:11:06 kernel: [  610.270538] [   2265]     0  2265      728      319    16384        0             0 ntpd
<6>Aug 19 14:11:06 kernel: [  610.286680] [   2271]   123  2271      344      163    20480        0             0 ntpd
<6>Aug 19 14:11:06 kernel: [  610.302823] [   2654]     0  2654      728      311    16384        0             0 dnsmasq
<6>Aug 19 14:11:06 kernel: [  610.319499] [   2658]   453  2658      431      307    20480        0             0 dnsmasq
<6>Aug 19 14:11:06 kernel: [  610.336164] [   2779]     0  2779      324      250    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  610.353001] [   2780]     0  2780      345      270    16384        0             0 ash
<6>Aug 19 14:11:06 kernel: [  610.368970] [   2793]     0  2793      421      276    20480        0             0 logread
<6>Aug 19 14:11:06 kernel: [  610.385643] [   2806]     0  2806      331      246    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  610.402479] [   2807]     0  2807      323      164    16384        0             0 scp
<6>Aug 19 14:11:06 kernel: [  610.418448] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=rpcd,pid=1052,uid=0
<3>Aug 19 14:11:06 kernel: [  610.443017] Out of memory: Killed process 1052 (rpcd) total-vm:3568kB, anon-rss:384kB, file-rss:4kB, shmem-rss:1876kB, UID:0 pgtables:20kB oom_score_adj:0
<4>Aug 19 14:11:06 kernel: [  610.489489] logd invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0
<4>Aug 19 14:11:06 kernel: [  610.509267] CPU: 1 PID: 998 Comm: logd Not tainted 5.15.127 #0
<4>Aug 19 14:11:06 kernel: [  610.520893] Stack : 00000000 808123d8 00000840 80083bc8 00000000 00000000 00000000 00000000
<4>Aug 19 14:11:06 kernel: [  610.537598]         00000000 00000000 00000000 00000000 00000000 00000001 81f43c08 81441260
<4>Aug 19 14:11:06 kernel: [  610.554294]         81f43ca0 00000000 00000000 81f43ab0 00000038 8039e4c4 ffffffea 00000000
<4>Aug 19 14:11:06 kernel: [  610.570992]         81f43abc 0000011e 8081aa78 ffffffff 80738d00 81f43be8 8253d5c0 00000000
<4>Aug 19 14:11:06 kernel: [  610.587689]         8089b380 00500cc2 00000000 808123d8 00000018 80410730 00000004 80c90004
<4>Aug 19 14:11:06 kernel: [  610.604388]         ...
<4>Aug 19 14:11:06 kernel: [  610.609262] Call Trace:
<4>Aug 19 14:11:06 kernel: [  610.609277] [<80083bc8>] 0x80083bc8
<4>Aug 19 14:11:06 kernel: [  610.621113] [<8039e4c4>] 0x8039e4c4
<4>Aug 19 14:11:06 kernel: [  610.628070] [<80410730>] 0x80410730
<4>Aug 19 14:11:06 kernel: [  610.635024] [<80007908>] 0x80007908
<4>Aug 19 14:11:06 kernel: [  610.641971] [<80007910>] 0x80007910
<4>Aug 19 14:11:06 kernel: [  610.648912] [<803825bc>] 0x803825bc
<4>Aug 19 14:11:06 kernel: [  610.655868] [<801417a8>] 0x801417a8
<4>Aug 19 14:11:06 kernel: [  610.662829] [<80142000>] 0x80142000
<4>Aug 19 14:11:06 kernel: [  610.669778] [<801429f0>] 0x801429f0
<4>Aug 19 14:11:06 kernel: [  610.676729] [<80194a40>] 0x80194a40
<4>Aug 19 14:11:06 kernel: [  610.683719] [<801cb53c>] 0x801cb53c
<4>Aug 19 14:11:06 kernel: [  610.690682] [<801bfd34>] 0x801bfd34
<4>Aug 19 14:11:06 kernel: [  610.697649] [<801c0234>] 0x801c0234
<4>Aug 19 14:11:06 kernel: [  610.704601] [<80014550>] 0x80014550
<4>Aug 19 14:11:06 kernel: [  610.711579]
<4>Aug 19 14:11:06 kernel: [  610.714598] Mem-Info:
<4>Aug 19 14:11:06 kernel: [  610.719120] active_anon:538 inactive_anon:4898 isolated_anon:0
<4>Aug 19 14:11:06 kernel: [  610.719120]  active_file:0 inactive_file:0 isolated_file:0
<4>Aug 19 14:11:06 kernel: [  610.719120]  unevictable:0 dirty:0 writeback:0
<4>Aug 19 14:11:06 kernel: [  610.719120]  slab_reclaimable:446 slab_unreclaimable:2821
<4>Aug 19 14:11:06 kernel: [  610.719120]  mapped:939 shmem:4882 pagetables:103 bounce:0
<4>Aug 19 14:11:06 kernel: [  610.719120]  kernel_misc_reclaimable:0
<4>Aug 19 14:11:06 kernel: [  610.719120]  free:1948 free_pcp:1143 free_cma:0
<4>Aug 19 14:11:06 kernel: [  610.788548] Node 0 active_anon:2152kB inactive_anon:19592kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:3756kB dirty:0kB writeback:0kB shmem:19528kB writeback_tmp:0kB kernel_stack:552kB pagetables:412kB all_unreclaimable? no
<4>Aug 19 14:11:06 kernel: [  610.837063] Normal free:7792kB min:8192kB low:10240kB high:12288kB reserved_highatomic:0KB active_anon:2532kB inactive_anon:19600kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:65536kB managed:55704kB mlocked:0kB bounce:0kB free_pcp:4572kB local_pcp:36kB free_cma:0kB
<4>Aug 19 14:11:06 kernel: [  610.889379] lowmem_reserve[]: 0 0
<4>Aug 19 14:11:06 kernel: [  610.896016] Normal: 79*4kB (UM) 28*8kB (UM) 7*16kB (UM) 1*32kB (M) 4*64kB (UM) 5*128kB (U) 4*256kB (U) 7*512kB (U) 2*1024kB (U) 0*2048kB 0*4096kB = 8236kB
<4>Aug 19 14:11:06 kernel: [  610.923773] 4882 total pagecache pages
<4>Aug 19 14:11:06 kernel: [  610.931229] 0 pages in swap cache
<4>Aug 19 14:11:06 kernel: [  610.937837] Swap cache stats: add 0, delete 0, find 0/0
<4>Aug 19 14:11:06 kernel: [  610.948259] Free swap  = 0kB
<4>Aug 19 14:11:06 kernel: [  610.954021] Total swap = 0kB
<4>Aug 19 14:11:06 kernel: [  610.959748] 16384 pages RAM
<4>Aug 19 14:11:06 kernel: [  610.965323] 0 pages HighMem/MovableOnly
<4>Aug 19 14:11:06 kernel: [  610.972950] 2458 pages reserved
<6>Aug 19 14:11:06 kernel: [  610.979215] Tasks state (memory values in pages):
<6>Aug 19 14:11:06 kernel: [  610.988594] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
<6>Aug 19 14:11:06 kernel: [  611.005769] [    490]    81   490      375      262    12288        0             0 ubusd
<6>Aug 19 14:11:06 kernel: [  611.022105] [    491]     0   491      265      148    20480        0             0 askfirst
<6>Aug 19 14:11:06 kernel: [  611.038940] [    526]     0   526      301      203    20480        0             0 urngd
<6>Aug 19 14:11:06 kernel: [  611.055285] [    730]     0   730      709      455    24576        0             0 uhttpd
<6>Aug 19 14:11:06 kernel: [  611.071773] [    998]   514   998      371      230    20480        0             0 logd
<6>Aug 19 14:11:06 kernel: [  611.087930] [   1262]     0  1262      319      246    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  611.104766] [   1366]     0  1366      728      249    20480        0             0 hostapd
<6>Aug 19 14:11:06 kernel: [  611.121430] [   1367]     0  1367      728      249    20480        0             0 wpa_supplicant
<6>Aug 19 14:11:06 kernel: [  611.139303] [   1370]   101  1370      754      377    20480        0             0 hostapd
<6>Aug 19 14:11:06 kernel: [  611.155981] [   1371]   101  1371      754      393    16384        0             0 wpa_supplicant
<6>Aug 19 14:11:06 kernel: [  611.173854] [   1431]     0  1431      516      330    16384        0             0 netifd
<6>Aug 19 14:11:06 kernel: [  611.190369] [   1644]     0  1644      431      281    20480        0             0 odhcpd
<6>Aug 19 14:11:06 kernel: [  611.206862] [   2265]     0  2265      728      319    16384        0             0 ntpd
<6>Aug 19 14:11:06 kernel: [  611.223017] [   2271]   123  2271      344      163    20480        0             0 ntpd
<6>Aug 19 14:11:06 kernel: [  611.239163] [   2654]     0  2654      728      311    16384        0             0 dnsmasq
<6>Aug 19 14:11:06 kernel: [  611.255824] [   2658]   453  2658      431      307    20480        0             0 dnsmasq
<6>Aug 19 14:11:06 kernel: [  611.272486] [   2779]     0  2779      324      250    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  611.289340] [   2780]     0  2780      345      270    16384        0             0 ash
<6>Aug 19 14:11:06 kernel: [  611.305313] [   2793]     0  2793      421      276    20480        0             0 logread
<6>Aug 19 14:11:06 kernel: [  611.322002] [   2806]     0  2806      331      246    20480        0             0 dropbear
<6>Aug 19 14:11:06 kernel: [  611.338837] [   2807]     0  2807      323      164    16384        0             0 scp
<6>Aug 19 14:11:06 kernel: [  611.354826] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=uhttpd,pid=730,uid=0

Yeah, it killed dropbear because it was out of memory. Hm....

Tried with wget from a local web server, same result, OOM'd after a few MB downloaded. Did echo 3 > /proc/sys/vm/drop_caches without luck. Thinking about trying mtd write with netcat shenanigans to not have to write the image locally, but I'm sure this is high bricking risk. Here's the MTD layout - where would I write the sysupgrade image to?

dev:    size   erasesize  name
mtd0: 00100000 00020000 "Bootloader"
mtd1: 00100000 00020000 "MRD"
mtd2: 00100000 00020000 "Factory"
mtd3: 00100000 00020000 "Config"
mtd4: 02000000 00020000 "Kernel"
mtd5: 01c00000 00020000 "ubi"
mtd6: 02000000 00020000 "Kernel2"
mtd7: 00100000 00020000 "Private"
mtd8: 01000000 00020000 "Log"
mtd9: 02b00000 00020000 "App"

OK, progress. I was able to get back into OEM firmware by erasing the Kernel mtd. Then flashed 22.03 as there was enough free memory to sysupgrade. Unfortunately, only the 2.4G radio is supported, not the 5G one. Well - it was worth a try, thanks for helping out!

That's stated in the commit message I linked to: it's a very unusual design with a second Linux kernel image loaded via TFTP to the 5GHz WiFi.
I'm pretty sure that @bmork can chime in regarding the current support state of this device given that he's the author of the original commit.

It's possible to get the 5GHz radio running, but getting it semi-integrated into OpenWrt uci/ubus/netifd is too much work to be worthwile.

I did start out with the intention to make something "good enough" but lost interest way before it was finished. The Work-in-Progress branches I have aren't really in a state I want to publish....

But I'll make it public anyway in case someone is interested:

FWIW, I got rid of both my WAP6805 APs so I have no hardware to test this out on anymore. There is no guarantee it works at all. Or rather - I'm pretty sure it doesn't.

But it does document where to get the module firmware and how to boot it from OpeWrt

Thanks so much and I agree, it's probably not worth it taking the age and rareness of these devices into account. I'll have a look at your prior work, it was a fun trip so far into my old WAP6806s. I have four of them lying around, having them all replaced with WSM20s, all on OpenWrt, all running great.