How I fixed OpenWRT LuCI error /etc/config/luci seems to be corrupt, unable to find section 'main'

Problem:

When you try to open your OpenWRT Web UI, you see an error message like

luci_dispatcher_error.txt
/usr/lib/lua/luci/dispatcher.lua:427: /etc/config/luci seems to be corrupt, unable to find section 'main'

Solution

In my case, the issue was a bad rpcd configuration which I restored from an older OpenWRT version that contained the config line

rpcd_config_old
option socket /var/run/ubus.sock

instead of the correct

rpcd_config_default
option socket /var/run/ubus/ubus.sock

You can replace your rpcd config by the default by running the following command over SSH:

restore_rpcd.sh
cp /rom/etc/config/rpcd /etc/config/rpcd

and then

reboot.sh
reboot

Check out similar posts by category: Networking