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


#24

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

#25

Fixed in git-17.080.69173-773734e27-6.


#26

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 !


#27

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 ?


#28

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.


#29

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.


#30

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.


#31

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.


#32

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


#33

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

#34

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.


#35

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.


#36

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 !


#37

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.


#38

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:


#39

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


#40

That's better :slight_smile:

Any chance that it will be embeed in LEDE repo ?


#41

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.


#42

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


#43

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