OpenWrt‎ > ‎LuCI‎ > ‎

Debugging & Developing

The following are comments from JoW, one of the OpenWrt and LuCI developers

Run HTTP in the foreground

You can run the httpd server in foreground and watch stderr while trying to access your non working models. (Assuming you're running uhttpd and not busybox httpd) : execute:

killall -9 uhttpd
uhttpd -h /www -p 80 -f

Then try to access the broken page.

An Alternate Method 1

create the following script in /www/cgi-bin/luci.dbg and make it executable:


require "nixio"

dbg ="/tmp/luci.req", "w")

for k, v in pairs(nixio.getenv()) do
    dbg:write(string.format("export %s=%q\n", k, v))


Now change the url of the broken page from .../luci/... to .../luci.dbg/... and reload.

The script should create a file "/tmp/luci.req" which you can use to reproduce the same request on the command line:

root@OpenWrt:~# sh /tmp/luci.req

Developing on the device

In order to develop on the device in 10.03+ you will need the lua source to be in text format.
there are 2 compilation settings for LuCI, one is a compile-time setting in make menuconfig under
LuCI -> Libraries -> LuCI core libraries -> Build Target.
There you can decide whether the device should have: full source, stripped source or bytecode in the .lua files on the device.

If you selected to have full source or stripped sourcecode, then there is a run-time option luci.ccache.enable which enables or disables a compile-time
cache. You can disable this cache by doing
uci set luci.ccache.enable=0
uci commit luci
or by changing the value to 0 directly in /etc/config/luci.

This is a permanent configuration. If you only need to delete the cache for a one-off you can delete /tmp/luci-modulecache after each change.

Changes to the menu:

simply remove /tmp/.luci-indexcache.

To permanently disable the menu cache for development purposes, comment out the line

luci.dispatcher.indexcache = "/tmp/luci-indexcache" in /www/cgi-bin/luci .