I'm searching for a method to install OpenWRT on the Ubiquiti AirCube via the original web interface instead of via a serial console.
Note: They are using a fork of OpenWRT (see  below for more details).
I did some analysis and I think I found a way to inject a script via uploading a new config. See my notes on github if you are interested in lot's of details.
What I didn't manage was to convince their version of
sysupgrade to accept a OpenWRT image. But I found that the tools for U-Boot environment management are installed (
fw_setenv) and with some effort they can be used too.
Now my problem:
If I call
fw_setenv from the injected script I receive the following error:
+ fw_setenv -s /tmp/ubootenv_add Can't open /dev/mtd1: Operation not permitted Error: can't write fw_env to flash
If I use the same script (or only
fw_setenv after preparation with the script from web-if) from the console, everything works and the environment is modified.
Any idea, why
fw_setenv has a different behaviour depending on from where I call it?
Thanks in advance for any hints.
 Some background info: Ubiquiti is running an old version of OpenWRT. Some weeks after the airCube support has been added to OpenWRT, they published their sources (the ones where their support told me that they have no ETA when I asked a few months before adding the support). The source archive that can be downloaded from their home page seems to be based on a commit somewhere around 8fe8360981acd7e65 (from Sun Jan 31 00:55:05 2016 - "musl: fix an alignment issue that was breaking ldso on ARMv5"). At least that's the version with the least differences.