[RESOLVED] Need help with sysupgrade failed by crontab on Linksys ea6350v3

Dear all

I build my cloud ap firmware.
I need to auto update my router with sysupgrade.
I set crontab to get data from my cloud, download file and upgrade by sysupgrade.
but sysupgrade is not work by crontab.
if I ssh to router and download file and upgrade manual by sysupgrade -n -v /tmp/myfirmware.bin , it works.

I use command mtd -r write /tmp/myfirmware.bin firmware on crontab.
it works for some router model
but my router linksys_ea6350v3.
it shows error .

root@EasyZone:/tmp# mtd -r write easyzone_cloud_ap_linksys_ea6350v3_v2_9_3.bin firmware
Could not open mtd device: firmware
Can't open device for writing!

Please advice me how to resolve this.
Thank you all.

What release are your images based on?

If this works;

sysupgrade -n -v /tmp/myfirmware.bin

Why aren't you using that in cron?

dmesg | grep -A9 flash
1 Like

Thank you for your advice.

I use snapshot http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/openwrt-ipq40xx-linksys_ea6350v3-squashfs-sysupgrade.bin

I will check on dmesg and reply soon.

Will not work for ea6350v3.

Using plain "mtd" is a historical practice that worked with the old simple small NOR flash devices.
With the current devices with NAND and also dual-boot (for some/most new Linksys devices), plain mtd is simply wrong.

For your specific device, the normal "sysupgrade" needs these device-specific steps in addition to the generic sysupgrade functions.

Note that usually/often kernel and the rootfs are written to different partitions, so the old style of monolithic mtd write is simply wrong.

you might also read the device-specific thread about your device in order to find relevant pointers to the sysupgrade process, if you want to avoid the normal (and working) sysupgrade command.

Unless you are lucky, an automatic timed sysupgrade done frequently sounds risky, especially if you continue to use the untested development snapshots from buildbot. Sooner or later you may brick the device.


Thank you so much for your advice.

My auto update is use my customize snapshot images builder.
I didn't use a direct daily snapshot from openwrt.

I will test the script and update to you soon.

Dear wulfy23

I use crontab run my script.
my script download and check valid firmware.
if all sha256sum is correct then
run sysupgrade -n -v /tmp/myfirmware.bin

I can not use command

dmesg | grep -A9 flash

because after sysupgrade run my router is rebooted.

What I missing on the way?

It's ok, you do not need to run that command now.

hnyman added that information about your device....

( type of flash .... etc. )

You need to read the through the thread hnyman posted.... and you need to read and test the scripts posted...

There are added levels of complexity here that you should understand before going further.

If you gain full confidence there.... I believe you can work something out. At least..... proceed in a safe manner with reasonable reliability.

I try to read the script. I 'm not a developer level but I try to get it.

But my main target to find is :
Why I can update my firmware use sysupgrade on my manual ssh shell?
Why I can not update my firmware by auto crontab script?

What is the permission on crontab which not allow to update firmware?

My wild guess: During sysupgrade, automatically various processes are killed.
May be, the cron process, being parent of sysupgrade, is killed, and the child (i.g. sysupgrade) killed, too, as a consequence. Try to run "sysupgrade -n -v /tmp/firmware.bin &" as detached process from cron.

I get the answer.

crontab is work ok
sysupgrade is work ok
but uboot-envtools is not ok.

I don't know how to call it in full name
So I resolve by add this command to my script

/bin/rm /etc/config/ubootenv
/sbin/sysupgrade -n -v /tmp/myfirmware.bin

/etc/config/ubootenv is a file which created by /etc/config/uboot.sh
You need to delete this file before run script

I find sh script in /etc/config/uboot.sh on link https://raw.githubusercontent.com/openwrt/openwrt/master/package/boot/uboot-envtools/files/ipq40xx

I 'm google and found info from https://superuser.com/questions/1291944/failing-to-sysupgrade-openwrt-on-a-linksys-wrt1900acs-router

It works with Linksys ea6350v3.

Thank you all for advice me.

Big thanks to hnyman
And I 'm sorry that I didn't test and use a script you advice to me.

1 Like

Glad you got something working.....

If I were you i'd still want to test alot more tho!!!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.