Luci fs.exec not work in firmware upgrade page

Hello, I want to execute some command before doing sysupgrade, so I add some command before fs.exec('/sbin/sysupgrade', opts); to test, the function like

		function handleSysupgradeConfirm(btn, keep, force, ev) {
			// = _('Flashing…');
			btn.value = _('Flashing…');

			L.require('ui').then(function(ui) {
				ui.showModal(_('Flashing…'), [
					E('p', { 'class': 'spinning' }, _('The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.'))

			var opts = [];

			if (!keep.checked)

			if (force.checked)


			L.require('fs').then(function(fs) {
				/* Currently the sysupgrade rpc call will not return, hence no promise handling */
				fs.exec('/bin/echo', [ 'abc', '>', '/tmp/upgrade_status' ]);
				//fs.exec('/sbin/sysupgrade', opts);

			L.require('ui').then(function(ui) {
				if (keep.checked)
					ui.awaitReconnect('', 'openwrt.lan');

I tried echo to file
fs.exec('/bin/echo', [ 'abc', '>', '/tmp/upgrade_status' ]);

but the command doesn't execute, and GUI not display any errors. Any ideas or what can I do to verify this issue? Sorry I am not familiar with js/luci...

In /usr/share/rpcd/acl.d/*.json you grant your app to access/execute certain files/programs. In OpenWRT's ubus docs you can learn how that file works (or just check the LuCI repo for more examples). Please always consider to apply the principle of least privilege.

These type of errors (permission denied) are always visible in the browser console.

1 Like

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