UCI config migration across OpenWrt releases
Eric
evil.function at proton.me
Fri Apr 17 08:05:33 PDT 2026
On Thursday, April 16th, 2026 at 07:06, Tanjeff Moos <Tanjeff.Moos at westermo.com> wrote:
> On 4/14/26 18:31, Eric wrote:
> >> As I understand it, uci-default scripts run only on first boot (after a
> >> factory reset) and are then deleted. How can they run during/after an
> >> upgrade?
> >>
> >> Regards, Tanjeff
> >>
> > Hi Tanjeff,
> >
> > The post install script fires off some actions that run any new
> > package-specific uci-defaults that were delivered in the package.
> > Scan down to the middle of this function, you'll see where it
> > picks them up, right after it handles any kmods and applies the
> > sysctl settings...
>
> That's true if I upgrade a single package. However, on my device I
> install a new image using sysupgrade, preserving the config. So the
> sequence is:
> 1. install old image (uci-defaults are run and deleted)
> 2. Install new image (preserve config)
> Then, the deleted uci-defaults would still be deleted and thus not be
> run. Except sysupgrade would restore uci-defaults somehow?
>
> Additional info: My image is in FIT format and lives in flash. During
> boot it is extracted to RAM, and my system uses a ramdisk as rootfs. The
> configs (i.e. /etc) are stored in an overlayfs, placing a flash
> partition on top of the ramdisk. This setup might be unusual ...
Every image has all of its /etc/uci-defaults/* files in place, so whenever
you run 'sysupgrade ...' to install an image, you get the new set of uci
default scripts (this is how upgrades actually "upgrade" the defaults).
Your step 2 above has all of the uci-defaults scripts ready to run, which
happens on reboot, and then the "preserve config" restore happens after
that and overwrites some of the files that were just created (for example,
the default wireless config is created from defaults and then overwritten
by the restore).
More information about the openwrt-devel
mailing list