I'm working on upgrading a fleet of devices which unfortunately are running OpenWRT backfire (there are many different OpenWRT versions used, but the majority of the devices is running Backfire).
For this task I'm using OpenWISP Firmware Upgrader, which I built.
The automated procedures won't work on Backfire, initially I thought it was a python issue, but this shell command yields the same result:
ssh root@<ip> -T "/sbin/sysupgrade -v -n /tmp/*.bin"
The result I get is the following:
/sbin/sysupgrade: line 145: pivot_root: not found
umount: can't umount /tmp/root: Device or resource busy
umount: can't umount /tmp/root: Device or resource busy
Switching to ramdisk...
Failed to switch over to ramfs. Please reboot.
However, if I log in via SSH and then run: /sbin/sysupgrade -v -n /tmp/*.bin
, it works:
/sbin/sysupgrade -v -n /tmp/*.bin
Switching to ramdisk...
Performing system upgrade...
Unlocking firmware ...
Writing from <stdin> to firmware ... [w]
I can't understand why sysupgrade doesn't work when called from a script while it does when called from an interactive shell session, before giving up and update all the devices manually I'd like to know if I can trick it to believe it's an interactive shell session or something like that.