Living with a TL-WR842ND (sysupgrade bricks router)

So I've had this TL-WR842ND for a while. It's my test device, if I'm going to do something stupid or crazy I try it on this box first.

For the past while now I can't seem to SSH and upgrade the box. If I use TFPD recovery mode it accepts my files just fine. But "mtd whatever-sysupgrade.bin firmware" and "sysupgrade -n -v whatever-sysupgrade.bin" soft brick it.

Also while I haven't been able to confirm it, running QoS also seems to lock it up after a while.

Anyone else running this device? Maybe I've just kicked it around too much over the years...

The TL-WR842ND (unless we'd be talking about h/w revision v3) only has 32 MB RAM, this is a rather tight fit and might blow up (oom) during the upgrade (keep in mind that the to-be-flashed firmware as a whole needs to fit into RAM). This is particularly a problem with 32 MB RAM devices offering 8 MB flash (just because those invite to actually use it and install more demanding packages). You can try to counter this two ways, on the one hand by trimming your firmware of unnecessary packages (don't use the full 8 MB flash, but just 5-6 MB) and by unloading non-essential (wlan, pppoe, ipsec, firewall, etc. - everything that isn't hard-required for the ethernet and flash storage) kernel modules, because other than userspace services, sysupgrade can't unload them for the upgrade.

Personally I'm in a very similar situation with a TL-WR1043ND v1 (also 8 MB flash and 32 MB RAM), but temporarily removing kernel modules from /etc/modules.d/ and rebooting before sysupgrade does help.

I thought about this but looking into it I should be fine. I don't use luci.

$ ssh root@router.lan 'free -t'
             total       used       free     shared    buffers     cached
Mem:         27928      24992       2936         96       2384       6580
-/+ buffers/cache:      16028      11900
Swap:        13308         96      13212
-rw-r--r-- 1 weedy weedy 4.9M Feb 27 16:18 lede-ar71xx-generic-tl-wr842n-v2-squashfs-sysupgrade.bin

I'm only using 16MiB of ram.

I think there might be a bug somewhere. I've just noticed that sys% usage is ridiculous when everything goes to hell.

  >pppoe-wan                    │ 494.90KiB    351 pps     │  12.13KiB    192 pps

Mem: 19620K used, 8308K free, 4K shrd, 864K buff, 1472K cached
CPU:   1% usr  93% sys   0% nic   0% idle   0% io   0% irq   4% sirq
Load average: 6.89 4.88 2.96 5/58 9906
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 1555     1 root     R     1948   7%  16% /usr/sbin/hostapd -s -P /var/run/wifi
   97     2 root     SW       0   0%  12% [kworker/0:1]
  440     1 root     S     1180   4%   7% /sbin/ubusd
 9165  8584 root     R     1196   4%   5% top -d3
  840     1 root     S     1396   5%   5% /usr/sbin/odhcpd
 9886  9883 root     R     1224   4%   4% /bin/sh /etc/netCheck.sh
    3     2 root     SW       0   0%   4% [ksoftirqd/0]
  104     2 root     SW       0   0%   2% [kswapd0]

Mem: 21212K used, 6716K free, 12K shrd, 792K buff, 1584K cached
CPU:   6% usr  88% sys   0% nic   0% idle   0% io   0% irq   5% sirq
Load average: 3.38 2.13 1.16 1/56 9259
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
   97     2 root     RW       0   0%  18% [kworker/0:1]
 1555     1 root     S     1948   7%  12% /usr/sbin/hostapd -s -P /var/run/wifi
 2714  2713 root     R     2484   9%   4% /usr/sbin/bmon -p ppp*
 9240  9239 root     S     1184   4%   4% /bin/ping -W 3 -c 6 -q -I pppoe-wan g
  840     1 root     S     1396   5%   4% /usr/sbin/odhcpd
    3     2 root     SW       0   0%   4% [ksoftirqd/0]
 9241  9239 root     S     1204   4%   3% awk /packets received  {print $4}
 9165  8584 root     R     1188   4%   3% top -d3
 2389     1 dnsmasq  S     1412   5%   2% /usr/sbin/dnsmasq -C /var/etc/dnsmasq

Vs. my WDR4300

 >pppoe-wan                    │ 420.29KiB   1.69K pps    │  78.09KiB 1.10K pps

Mem: 42960K used, 17456K free, 216K shrd, 3084K buff, 9716K cached
CPU:   5% usr   1% sys   0% nic  79% idle   0% io   0% irq  14% sirq
Load average: 0.14 0.13 0.13 1/59 7749
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 2365     1 nobody   R     5260   9%   4% /usr/sbin/darkstat --verbose -i br-la
 2297  2295 root     S     2408   4%   3% /usr/sbin/bmon -p ppp*
    3     2 root     RW       0   0%   1% [ksoftirqd/0]
 2548  2536 root     R     1188   2%   1% top -d3
 2229   995 root     S     1132   2%   0% /usr/sbin/dropbear -F -P /var/run/dro
20388     2 root     SW       0   0%   0% [kworker/0:0]