Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3304 - MVEBU - sysupgrade may not correctly detect device from bootcmd #8171

Open
openwrt-bot opened this issue Aug 24, 2020 · 2 comments
Labels

Comments

@openwrt-bot
Copy link

erdoukki:

forum topic : https://forum.openwrt.org/t/solved-19-07-xx-own-build-unflashable/72297
Solution : https://forum.openwrt.org/t/solved-19-07-xx-own-build-unflashable/72297/8

Sysupgrade do not correctly detect the device from some bootcmd uboot command line ...

I suppose, rootfs is not correctly detected ?

/proc/cmdline okay : console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 root=/dev/mmcblk0p2 rw rootwait net.ifnames=0 biosdevname=0
/proc/cmdline which make an error : console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 root=/dev/mmcblk0p2 rw ip=0.0.0.0:0.0.0.0:10.4.50.254:255.255.255.0:marvell:eth0:none nfsroot=0.0.0.0:/dev/mmcblk0p2

when error happend, the message is :
root@NAS:# sysupgrade -v -T openwrt-19.07.3-mvebu-cortexa53-globalscale_espressobin-v7-emmc-ext4-sdcard.img.gz
Image not in /tmp, copying...
Unable to determine upgrade device
Image check failed.
root@NAS:
#

@openwrt-bot
Copy link
Author

erdoukki:

also from 19.07.3 and 19.07-master

@openwrt-bot
Copy link
Author

M95D:

I found this error too. The sysupgrade overwrote the current booted kernel (and failed trying to overwrite the rest of the partition) instead of the alternate partition.

Device partitions as reported by kernel:
Creating 10 MTD partitions on "pxa3xx_nand-0":
0x000000000000-0x000000100000 : "u-boot"
0x000000100000-0x000000140000 : "u_env"
0x000000140000-0x000000180000 : "s_env"
0x000000900000-0x000000a00000 : "devinfo"
0x000000a00000-0x000003200000 : "kernel1"
0x000000e00000-0x000003200000 : "ubi"
0x000003200000-0x000005a00000 : "kernel2"
0x000003600000-0x000005a00000 : "rootfs2"
0x000005a00000-0x000008000000 : "syscfg"
0x000000180000-0x000000900000 : "unused_area"

The bug can be reproduced like this:

  1. Connect to serial console.
  2. Boot from the first partition (working firmware - you want to keep this).
  3. Use sysupgrade to write a test image to the alternate partition (the second one). OpenWrt automatically restarts and Uboot will boot that partition. Let's assume it's a failed test - you prepare another test image.
  4. Reboot to first partition (working) to write the new test firmware. To skip the somewhat complicated "fw_setenv boot_part 1" and "reboot" (maybe the router won't even boot), simply reset and "run nandboot" from the bootloader to boot from the fist partition.
  5. Try to sysupgrade another test image. Sysupgrade will overwrite the fist partition kernel (the working kernel) and fail trying to overwrite the squashfs, instead of writing to the second partition.
    At this point no partition is working. Device is bricked.

root@GRAPHRT:~# sysupgrade -n -v openwrt-snapshot-r17857-269bdf6eef-mvebu-cortex
a9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin
Sat Oct 23 20:59:22 EEST 2021 upgrade: Image not in /tmp, copying...
Sat Oct 23 20:59:23 EEST 2021 upgrade: Commencing upgrade. Closing all shell sessions.
Watchdog handover: fd=3

  • watchdog -
    killall: telnetd: no process killed
    Sat Oct 23 20:59:24 EEST 2021 upgrade: Sending TERM to remaining processes ... ubusd urngd logd rpcd hostapd wpa_supplicant netifd crond pptpd upsd blockd mosquitto upsmon upsmon uhttpd dnsmasq ntpd
    Sat Oct 23 20:59:27 EEST 2021 upgrade: Sending KILL to remaining processes ...
    Sat Oct 23 20:59:29 EEST 2021 upgrade: Switching to ramdisk...
    Sat Oct 23 17:59:31 UTC 2021 upgrade: Performing system upgrade...
    Unlocking kernel1 ...

Writing from to kernel1 ...
cannot find ubi mtd partition rootfs1
libubi: error!: "/dev/" is not a character device
ubiupdatevol: error!: error w[ 93.985373] UBIFS (ubi1:0): un-mount UBI device 1
hile probing "/d[ 93.991263] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" stops
ev/"
error 22 (Invalid argument)
tar: write error: Broken pipe
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't [ 94.011251] reboot: Restarting system

(Text above contains kernel messages written over console messages. That's how it appears on serial console.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant