luci: /etc/config/luci seems to be corrupt, unable to find section 'main'

  • OpenWrt 18.06.1 on a WRT3200ACM
  • Sometimes, when I try to access the main page on the router, I get this error:
/usr/lib/lua/luci/dispatcher.lua:230: /etc/config/luci seems to be corrupt, unable to find section 'main'
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:230: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:127: in function </usr/lib/lua/luci/dispatcher.lua:126>

  • However, “/etc/config/luci” looks fine, and just rebooting the device fixes the issue.
  • When this happens, all other functionality on the router works fine., but f I log into the router and execute “logread -l 100”, all I can see is this single line:
Thu Jan  1 01:00:00 1970 kern.emerg kernel: 
  • A couple of minutes later, the logs fill again with normal messages, but luci never recovers.
  • Restarting “uhttpd” does not fix the issue.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

service rpcd restart works for me

at some version /var/run/ubus.sock was moved to /var/run/ubus/ubus.sock

so edit /etc/config/rpcd

Another way to solve: https://forum.openwrt.org/t/luci-webgui-crash-after-updating-to-ver-18-6-8-on-tp-link-tl-wa801n-v2/57620/9 <<Adding in the beginning of /etc/config/rpcd

config rpcd
	option socket /var/run/ubus.sock
	option timeout 30

and then rebooting. >>

I had the same error, after an upgrade from some LEDE version (from 2017 IIRC) to OpenWRT 18.06.08. I choosen to keep settings while upgrading, that was apparently a mistake.

To fix it, I did :

  • run by hand (SSH console) : rcpd (/etc/init.d/rcpd did not work anymore)
  • restore factory defaults

No need to restore factory defaults (although it might be a good idea, specially if you don’t have that many settings). You can add rpcd & to /etc/rc.local before the exit 0 line and everytime you boot rpcd will start and LuCi will work just fine.

This can also happen when the rpcd service is not running / crashing