R6220, sysupgrade won't update, jffs2reset fails

Hi,

I just can't seem to sysupgrade my R6220, even when I used the previous version v18.06.3 to try and upgrade to v18.06.4 I hit the same wall.. I then tried to use the mtd method only to 'soft-brick' the router requiring the use of nmrpflash tool to re-flash original firmware and then flashing the new firmware, and succeeding doing it...

While I have seen other 'solutions' where you use already available snapshots to resolve the issue, there's a problem if you cannot get your firmware to upgrade, it could be there's an extra step to maybe build a .bin file from the .tar file... since the .tar file seems to cause the issue...

Tried the official .tar file from http://downloads.openwrt.org/releases/18.06.5/targets/ramips/mt7621/

 sysupgrade /tmp/openwrt-18.06.5-ramips-mt7621-r6220-squashfs-sysupgrade.t
ar
Saving config files...
Commencing upgrade. Closing all shell sessions.
client_loop: send disconnect: Broken pipe

Router restarts and no success.
Running sysupgrade with a custom ImageBuilder build, this time with verbose output:

sysupgrade -v /tmp/openwrt-ramips-mt7621-r6220-squashfs-sysupgrade.tar 
Saving config files...
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/network
etc/config/system
etc/config/wireless
etc/dropbear/dropbear_rsa_host_key
etc/group
etc/hosts
etc/inittab
etc/opkg/keys/1035ac73cc4e59e3
etc/opkg/keys/5151f69420c3f508
etc/opkg/keys/72a57f2191b211e0
etc/opkg/keys/792d9d9b39f180dc
etc/opkg/keys/9ef4694208102c43
etc/opkg/keys/b26f36ae0f4106d
etc/opkg/keys/b5043e70f9a75cde
etc/opkg/keys/c10b9afab19ee428
etc/opkg/keys/d40651ed57ae87d1
etc/opkg/keys/dace9d4df16896bf
etc/opkg/keys/dd6de0d06bbd3d85
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
Commencing upgrade. Closing all shell sessions.
client_loop: send disconnect: Broken pipe

Router restarts and I'm back to square one...

Does anyone know how to make this work without resorting to 'flash-ready' snapshots? since this does cause confusion, especially for anyone who uses the official documentation.

Tried to hard-reset umount /overlay && jffs2reset && reboot now, and then use sysupgrade... same result as the above, I even tried the snapshot from the official sources and sysupgrade -v failed with:

sysupgrade -v /tmp/openwrt-ramips-mt7621-netgear_r6220-squashfs-sysupgrade.
bin 
Invalid sysupgrade file.
Image check 'platform_check_image' failed.

So it seems that the only way to actually sysupgrade is to use *mtd to brick your device, *use nmrpflash to flash the original firmware and then use the OEM upgrade method in the Documentation..
at least in my experience...

If you are not faint hearted, you can try
sysupgrade -F ....
You might also consider to file a bug. Because "Image check ... failed" I have seen myself on other device type (ZBT-WE826), because of "silently" changing the device name/type between different releases of openwrt.

1 Like

I waited for the next release, and now tried to flash 19.07.1 (One image I built, the second straight from the source) and failed (both the same way).

Source:
http://downloads.openwrt.org/releases/19.07.1/targets/ramips/mt7621/openwrt-19.07.1-ramips-mt7621-r6220-squashfs-sysupgrade.bin

Background:

  • I flashed custom images in the past (they worked via sysupgrade unti v18.06.4)
  • Custom images had IPv6(iptables as well), okpg removed and zram was added, according to Saving Firmware Space including 'make menuconfig' and 'make kernel_menuconfig' options in that article
  • Version v18.06.5, tried to upgrade to it but since sysupgrade didn't work I tried the mtd method and bricked my device
  • I revived it using nmrpflash with the stock firmware from netgear version 1.1.0.86 and used Telnet Installation Method to reflash the new image - Success! but from here on out, this is the only way I managed to upgrade my device

Process for provided image:

  • Use scp to copy the .bin file to the /tmp directory
  • Using SSH, run the command sysupgrade -v /tmp/openwrt-19.07.1-ramips-mt7621-r6220-squashfs-sysupgrade.bin

Output:

Saving config files...
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/fstab
etc/config/network
etc/config/system
etc/config/wireless
etc/dropbear/dropbear_rsa_host_key
etc/group
etc/hosts
etc/inittab
etc/opkg/keys/1035ac73cc4e59e3
etc/opkg/keys/5151f69420c3f508
etc/opkg/keys/6d4ebe47931e7c67
etc/opkg/keys/72a57f2191b211e0
etc/opkg/keys/792d9d9b39f180dc
etc/opkg/keys/9ef4694208102c43
etc/opkg/keys/b26f36ae0f4106d
etc/opkg/keys/b5043e70f9a75cde
etc/opkg/keys/c10b9afab19ee428
etc/opkg/keys/dace9d4df16896bf
etc/opkg/keys/dd6de0d06bbd3d85
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
Commencing upgrade. Closing all shell sessions.
client_loop: send disconnect: Broken pipe

Aftermath:

  • sysupgrade failed
  • Device retains the settings from before so I can still login without any changes
  • Version is the same as before the sysupgrade

I don't want to file a bug for no reason unless I'm really sure this isn't my fault, any suggestions?

Sorry, no idea.
You might consider to get in touch with another user of R6220, to ask for confirmation of your problem.

I think this problem is on my end, and it seems to be partition table related.. something during the first time I flashed OpenWRT..

I tried jffs2reset:

umount /overlay && jffs2reset && reboot now
This will erase all settings and remove any installed packages. Are you sure? [N/y]
Y

No reboot... something went wrong, I tried each command separately:

jffs2reset 
This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
/dev/ubi0_1 is not mounted
/dev/ubi0_1 will be erased on next mount
writing /dev/ubi0_1 failed: Bad file descriptor

I tried to see what's mounted:

/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

So I tried to unmount the overlay by using "umount /" and tried jffs2reset again:

jffs2reset 
This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
/dev/ubi0_1 is not mounted
/dev/ubi0_1 will be erased on next mount
writing /dev/ubi0_1 failed: Bad file descriptor

There's something very wrong here.. and it could be the reason why I can't sysupgrade, I include further information that could be helpul:

MTD partitions:

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00100000 00020000 "SC PID"
mtd2: 00400000 00020000 "kernel"
mtd3: 01c00000 00020000 "ubi"
mtd4: 00100000 00020000 "factory"
mtd5: 03c00000 00020000 "reserved"

Available devices:

ls -l /dev
drwxr-xr-x    3 root     root            60 Jan  1  1970 bus
crw-------    1 root     root        5,   1 Jan  1  1970 console
crw-------    1 root     root       10,  63 Jan  1  1970 cpu_dma_latency
crw-rw-rw-    1 root     root        1,   7 Jan  1  1970 full
crw-------    1 root     root      254,   0 Jan  1  1970 gpiochip0
crw-------    1 root     root      254,   1 Jan  1  1970 gpiochip1
crw-------    1 root     root      254,   2 Jan  1  1970 gpiochip2
srw-rw-rw-    1 root     root             0 Mar  4 16:16 log
crw-------    1 root     root       10,  60 Jan  1  1970 memory_bandwidth
crw-------    1 root     root       90,   0 Jan  1  1970 mtd0
crw-------    1 root     root       90,   1 Jan  1  1970 mtd0ro
crw-------    1 root     root       90,   2 Jan  1  1970 mtd1
crw-------    1 root     root       90,   3 Jan  1  1970 mtd1ro
crw-------    1 root     root       90,   4 Jan  1  1970 mtd2
crw-------    1 root     root       90,   5 Jan  1  1970 mtd2ro
crw-------    1 root     root       90,   6 Jan  1  1970 mtd3
crw-------    1 root     root       90,   7 Jan  1  1970 mtd3ro
crw-------    1 root     root       90,   8 Jan  1  1970 mtd4
crw-------    1 root     root       90,   9 Jan  1  1970 mtd4ro
crw-------    1 root     root       90,  10 Jan  1  1970 mtd5
crw-------    1 root     root       90,  11 Jan  1  1970 mtd5ro
brw-------    1 root     root       31,   0 Jan  1  1970 mtdblock0
brw-------    1 root     root       31,   1 Jan  1  1970 mtdblock1
brw-------    1 root     root       31,   2 Jan  1  1970 mtdblock2
brw-------    1 root     root       31,   3 Jan  1  1970 mtdblock3
brw-------    1 root     root       31,   4 Jan  1  1970 mtdblock4
brw-------    1 root     root       31,   5 Jan  1  1970 mtdblock5
crw-------    1 root     root       10,  62 Jan  1  1970 network_latency
crw-------    1 root     root       10,  61 Jan  1  1970 network_throughput
crw-rw-rw-    1 root     root        1,   3 Jan  1  1970 null
crw-------    1 root     root        1,   4 Jan  1  1970 port
crw-------    1 root     root      108,   0 Mar  4 16:16 ppp
crw-rw-rw-    1 root     root        5,   2 Mar  6 13:55 ptmx
drwxr-xr-x    2 root     root             0 Jan  1  1970 pts
crw-rw-rw-    1 root     root        1,   8 Jan  1  1970 random
lrwxrwxrwx    1 root     root             8 Jan  1  1970 shm -> /tmp/shm
crw-rw-rw-    1 root     root        5,   0 Jan  1  1970 tty
crw-------    1 root     root      251,   0 Jan  1  1970 ubi0
crw-------    1 root     root      251,   1 Jan  1  1970 ubi0_0
crw-------    1 root     root      251,   2 Jan  1  1970 ubi0_1
crw-------    1 root     root       10,  59 Jan  1  1970 ubi_ctrl
brw-------    1 root     root      254,   0 Jan  1  1970 ubiblock0_0
crw-rw-rw-    1 root     root        1,   9 Jan  1  1970 urandom
crw-------    1 root     root       10, 130 Jan  1  1970 watchdog
crw-------    1 root     root      252,   0 Jan  1  1970 watchdog0
crw-rw-rw-    1 root     root        1,   5 Jan  1  1970 zero
brw-------    1 root     root      253,   0 Mar  4 16:16 zram0

For anyone seeing this while I'm not sure why, for some reason, this is a problem with custom builds on my end.. the reason I couldn't see it before was because I could sysupgrade before with no problems until v18.06.3.

If you follow the build options I used to save space with both make menuconfig and make kernel_menuconfig for some reason using all these options and other things like my environment (arch linux) may have caused those issues..

I found it by flashing back to stock and from stock to stable ready-made image from OpenWrt and LuCi sysupgrade worked like a charm to my custom image, after that I couldn't use sysupgrade to flash back the original firmware (I even installed LuCi and it didn't help).... so there's a problem with my build, although that didn't cause problems with other devices, ONLY with my R6220, so it's open to discussion whether it's the build options or my build environment.

If anyone knows of a way to debug such things (didn't see much about it in documentation) I'll be happy to know about them...

Hi FreezeHeat

I saw your issue in this thread
and also saw that you edited the R6220 device page in regards to nmrpflash to not working. I have worked with the author of nmrpflash for the same issue and got a proposed fix to nmrpflash that will allow to load firmware to router even is router gives no acknowledge feedbacks packets. It seems that we have the same issue in regards to bad memory blocks making the booting of device impossible. have a look at this post and follow the trail to the documented issue on nmppflash git site.
I also am looking for an explanation why my router is not running only then can we find a good fix for this issue.
https://forum.openwrt.org/t/i-have-a-r6350-need-help/57993?u=martinrousselle

regards
martin

1 Like