How to test sysupgrade

Is there a virtual machine variant one can run to do sysupgrade testing (while working on new scripts for a package to manage its data during sysupgrade)? Ideally I'd use a virtual machine, install an OpenWrt image on it, then use a sysupgrade.bin build to run sysupgrade and check results. Then revert to a virtual-machine snapshot to try my next attempt.

The distributions that can work on VirtualBox or VMware fusion (Intel or ARM) [x86, x86-64, or armvirt/armsr] don't have sysupgrade builds available in the downloads library (22.03, 23.05, snapshot). Is there a way to build sysupgrade packaging for one of these?

1 Like

Emulating the x86_64 (ARMv8/ armsr maybe) images of OpenWrt is easy (on pretty much any hypervisor environment, but you need to master its preferred ways of setting up network interfaces). However this doesn't help you in the slightest to confirm functionality for more traditional OpenWrt targets using mips/ ARM SOCs, you can only test those on the real hardware.

2 Likes

What I'm specifically looking to do right now is generic handling of saving files/running scripts before and after sysupgrade and startup/shutdown. For that particular work, any OpenWrt architecture will do, so I'm looking for suggestions on how to do sysupgrade experiments using virtual machines.

Any guidance?

I run OpenWrt x86_64 in a VM and sysupgrade works as usual.
Specifically, you can test its backup and restore functions like this:
https://openwrt.org/docs/guide-user/troubleshooting/backup_restore

1 Like

Beyond just doing it?

Your question is rather generic (it's not at all clear what you want to test, on what (virtual-) hardware), either way, 90% of the questions I can image from here on are more about the configuration of the host OS and hypervisor environment, rather than about OpenWrt itself.

As far as OpenWrt is concerned, import the disk image, give it >160 MB RAM and two (supported-) network interfaces hooked up in a 'meaningful way' that accommodate your intended tests, /done.

Where do you get a sysupgrade image file for x86_64 to give sysupgrade:
Usage: /sbin/sysupgrade [<upgrade-option>...] <image file or URL>

For embedded device routers using flash storage, the releases include squashfs-factory.bin and squashfs-sysupgrade.bin distributions.
What's the x86_64 equivalent? Perhaps the generic-squashfs-combined image is suitable for both initial install and for sysupgrade?

And for anybody following along at home, there's an OpenWrt-in-VirtualBox guide at https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm, but it doesn't cover sysupgrade.

Correct, also you can freely switch between squashfs and ext4 images.

1 Like

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