Web UI to reboot to another partition (for Linksys/ZyXEL dual-partition routers) and to power off/power down

Using the standard reboot feature and upon effective reboot, got that error in Luci:

/usr/lib/lua/luci/ccache.lua:70: error loading module 'luci.controller.admin.system' from file '/usr/lib/lua/luci/controller/admin/system.lua':
	/usr/lib/lua/luci/controller/admin/system.lua:402: '<eof>' expected near 'end'
stack traceback:
	[C]: in function 'loader'
	/usr/lib/lua/luci/ccache.lua:70: in function </usr/lib/lua/luci/ccache.lua:61>
	[C]: in function 'require'
	/usr/lib/lua/luci/dispatcher.lua:517: in function 'createindex'
	/usr/lib/lua/luci/dispatcher.lua:544: in function 'createtree'
	/usr/lib/lua/luci/dispatcher.lua:220: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>

Cut and paste error :wink::

function action_poweroff()
	luci.sys.call("/sbin/poweroff") end
end
1 Like

Fixed in git-17.080.69173-773734e27-6.

1 Like

Great mod ! I've tried it, very usefull !

But, for me, on my WRT3200ACM, as I test many LEDE releases (snapshot, RC, stable, david...), I don't know if it's my install process (sysupgrade -n F -v lede-mvebu-linksys-wrt3200acm-squashfs-factory.img) but I only have "LEDE" on both partitions:

This device (Linksys WRT3200ACM) has following partitions:

Partition 1: LEDE

Partition 2: LEDE <-- active

Would it be possible to add for example, the kernel version or a "uname -a" ?

Thanks !

Everything is working great, Reboot, Partition Reboot and Poweroff. Great work @stangri !

To answer @aqwserf 's request, maybe to display in parentheses the carved system name when it's LEDE only ?

I think that this would only be possible for the "active" partition. The inactive partition would require a carved name from the appropriate mtdxx and little cleanup to remove invalid chars.

Kernel version information is added in luci-mod-alt-reboot_git-17.080.69173-773734e27-7_all.ipk. If anyone has ideas on how can I fetch the proper OpenWrt/LEDE version/revision number from the non-mounted partition, please let me know. I've looked into the proper way to obtain this information on the running system a while back and the only suggestion back then was to screen scrape /etc/banner file, which will probably take a lot of upkeep in the long run.

I think that it would be good if you could put in that readme the uninstall instructions to revert to the standard Luci interface also.

Jean-Pierre -- the only way to uninstall is to re-flash LEDE. I think it would be quite cynical to add that to README. :wink:

As per Hannu's suggestion I'll convert it to the standalone (luci-mod-advanced-reboot) shortly which will not overwrite default Reboot page.

Indeed :joy:. No need to reflash, firstboot command is your friend. Very happy about the new upcoming package also!

Ah, right, there's another way:

cp /rom/usr/lib/lua/luci/controller/admin/system.lua /usr/lib/lua/luci/controller/admin/system.lua
cp /rom/usr/lib/lua/luci/view/admin_system/reboot.htm /usr/lib/lua/luci/view/admin_system/reboot.htm
1 Like

A mod which doesn't overwrite default reboot page is called luci-mod-advanced-reboot and is available from the same location (my repo).

I've beautified it a little bit, next step would be to implement confirmations for the alternative partition reboot and power down.

1 Like

Oops! Huge defect (copy-paste again)! If you've installed version lower than git-17.080.69173-773734e27-4, please don't use it and upgrade to latest version: opkg update; opkg upgrade luci-mod-advanced-reboot.

PS. Given that I can't test these builds while I'm away from home, I'm torn between suspending development for a few months or publishing untested builds.

1 Like

Nice update !

And thanks for the informations :wink:

I have no technicals knowledge on WRT but I don't know how to do this, but I wish !

1 Like

Please try upgrading to luci-mod-advanced-reboot_git-17.080.69173-773734e27-5_all.ipk. I've fixed the issue with displaying incorrect information for kernel version of the stock firmware.

Right, I'm now with

root@LEDE:~# opkg list | grep advanced
luci-mod-advanced-reboot - git-17.080.69173-773734e27-6

and it seems that nothing change:

Uhm, might have to do rm -rf /var/luci-modulecache/; rm -f /var/luci-indexcache; and refresh.

That's better :slight_smile:

Any chance that it will be embeed in LEDE repo ?

I'll send a pull request to the official repo when I'm done. Unless there're bugs, the only outstanding issue is tweaking UI to prompt user for confirmation when rebooting to alternative partition and shutting down. It might seem as a trivial fix, but would require some research -- first time coding in Lua or doing anything significant with Luci.

I'm not sure when 17.02 would fork, I hope not before I send the PR, but you won't see this package in 17.01.x repo anyways.

We could merge it into the 17.01 branch for packages if there is enough interest or are there unmet dependencies?

No dependencies whatsoever. Good to know about this option, we'll cross that bridge when we get there.