running custom commands during sysupgrade -
Sven Roederer
devel-sven at geroedel.de
Mon Nov 23 19:33:37 EST 2020
Am Sonntag, 22. November 2020, 18:07:05 CET schrieb Hannu Nyman:
> Adrian Schmutzler wrote at Fri Oct 16 19:15:38 EDT 2020:
> > Fortunately, and I don't fully understand why, we were able to drive this
>
> to effectively zero by simply running
>
> > echo 3 > /proc/sys/vm/drop_caches
> > directly before sysupgrade. Out of a few hundred upgrades since then, I
>
> haven't had a single soft-brick. I do occasionally have the situation that
> the device reboots into the old firmware again (i.e. upgrade failed in an
> early stage), but for some reason the soft-bricks were completely gone.
>
I've seen this also only rarely, but when it was only happening in remote
localtions where no traces left :-/
> I have stumbled into similar "boot to the old firmware" symptom with my old
> WNDR3700v2 with 64 MB RAM.
> I have not been able to reproduce the problem in WNDR3800 that has 128 MB
> RAM but it otherwise identical, (and has serial cable connected).
>
> Sysupgrade in WNDR3700v2 used to regularly
> * fail, if sysupgrade was run after the router had been running a few days
> * succeed with the same image, when sysupgrade was re-run right after the
> first failure (and automatic reboot)
>
> To avoid failure I have patched the sysupgrade script components itself, and
> I have not seen the problem any more. Patched files are
> /lib/upgrade/common.sh and /lib/upgrade/stage2
>
> I am not sure if those insertion locations are quite optimal, but so far the
> approach has worked
>
>
Hannu,
When you have the patches in place, why not sending as patch officially? The
location in the code is quite the same I would choose. In addition it solves
problems on low-ressource devices and should not cause problems on more
powerfull boards.
Sven
> --- a/package/base-files/files/lib/upgrade/common.sh
> +++ b/package/base-files/files/lib/upgrade/common.sh
> @@ -297,6 +297,7 @@ indicate_upgrade() {
> # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
> default_do_upgrade() {
> sync
> + echo 3 > /proc/sys/vm/drop_caches
> if [ -n "$UPGRADE_BACKUP" ]; then
> get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j
> "$UPGRADE_BACKUP" write - "${PART_NAME:-image}"
> else
> --- a/package/base-files/files/lib/upgrade/stage2
> +++ b/package/base-files/files/lib/upgrade/stage2
> @@ -123,6 +123,7 @@ kill_remaining KILL 1
>
> sleep 1
>
> +echo 3 > /proc/sys/vm/drop_caches
>
> if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null;
> then platform_pre_upgrade "$IMAGE"
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list