How I fixed my luci.ucodebridge error

After fiddling around in LuCI (OpenWrt 23.05.0-rc3) I managed to get myself to the point where I would see the login screen but immediately after logging in, received this error:

Error
Unhandled exception during request dispatching
module 'luci.ucodebridge' not found:
	no field package.preload['luci.ucodebridge']
	no file './luci/ucodebridge.lua'
	no file '/usr/share/lua/luci/ucodebridge.lua'
	no file '/usr/share/lua/luci/ucodebridge/init.lua'
	no file '/usr/lib/lua/luci/ucodebridge.lua'
	no file '/usr/lib/lua/luci/ucodebridge/init.lua'
	no file './luci/ucodebridge.so'
	no file '/usr/lib/lua/luci/ucodebridge.so'
	no file '/usr/lib/lua/loadall.so'
	no file './luci.so'
	no file '/usr/lib/lua/luci.so'
	no file '/usr/lib/lua/loadall.so'

In [anonymous function](), file [C]

In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 133, byte 10:
  called from function [arrow function] (/usr/share/ucode/luci/runtime.uc:141:63)
  called from function render ([C])
  called from function [anonymous function] (/usr/share/ucode/luci/runtime.uc:141:64)
  called from function run_action (/usr/share/ucode/luci/dispatcher.uc:778:34)
  called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:998:48)
  called from anonymous function (/www/cgi-bin/luci:39:12)

             die(ex);
  Near here --------^

I googled and searched this forum and found many many many people with the same or similar errors but the closest I found to a solution was (unhelpfully) "just factory reset".

Once I got it working again I thought it would be nice to post how I resolved it so that the next person hopefully finds something a bit more useful than "just factory reset" when they have the same problem. Good luck, unknown future person!

I fixed it by SSH-ing into the router and running opkg install luci-app-uhttpd

I don't know why but it works now.

7 Likes

I have the same problem on OpenWrt version 23.05.0-rc4.

By any chance are you making images via the Firmware Selector?

no, I downloaded the firmware here. https://downloads.openwrt.org/releases/23.05.0-rc4

1 Like


Same exact error for me on ramips/mt7621 platform after using attended sysupgrade to 23.05-rc4. Also in order to fix this you don't need to install uhttpd, stuff that fixes this error is in luci-compat package so for the fix opkg install luci-compat is sufficient and you don't have that uhttpd tab in luci in the end.

10 Likes

Same thing happened to me. Except I suspect it's because I recently removed the luci-app-nut package, which may have recursively removed a bit too much.

Oh, and this fix worked just fine.

1 Like

Installing only luci-app-uhttpd didn't work for me as OP suggested. I did something similar like @adworacz did. I removed some package and I kept "Automatically remove unused dependencies" checked while doing it. That might have removed essential packages for luci.

I had to install:

opkg install luci-lua-runtime

Someone else might need to install luci-base too, as mentioned here.

Hope it helps.

OpenWrt SNAPSHOT r24453-a39a49e323 / LuCI Master git-23.292.78363-ee6a4da

4 Likes

thanks :smiley:, i was have the same problem, I fixed it by SSH-ing into the router and running opkg install luci-app-uhttpd

1 Like

Just if anyone stumbles on this ill add this info here, this happened to me too immediatly after un-installing the ddns package from luci, and i needed to run before the install:

opkg update

Oh, and im on 23.05.2

wanted to note that this also resolved my missing /mnt/ssd section under storage heading on the status page

heh i did this to myself a few weeks ago removing a luci theme i was trying, then again today removing a bunch of unbound packages. killed everything lol. so i swapped to my backup flash card and flashed my main lol...

i might have a tinkering problem

Hi szero, please help..
I have same exact error like you, i'm using "Xiaomi Mi Router 4A Gigabit Edition".. can you help to describe step by step to manage the error?
sorry for my bad english

thank you szero

Yes, Its works!

  • Go to this link and follow tutorial in order to setup ssh (i assume you are on Windows)
  • After installing it, open powershell window by pressing Win + X and choosing Windows Powershell
  • Type in the console ssh root@192.168.1.1 and it should connect to your router
  • Type opkg update and than opkg install luci-compat and your luci access should be fixed
1 Like

I also just ran into this issue after removing packages for unbound (including luci-app-unbound, which has luci-compat as a dependency) along with [x] Automatically remove unused dependencies. I found this thread after running a few remove/install combinations on my own and getting nowhere. [SOLVED] I fixed it as OP @iacvlvs did with opkg install luci-app-uhttpd and that fixed it for me.

I was unable to recreate the issue. I tried removing luci-app-uhttpd... no luci.ucodebridge error. Tried removing luci-compat... still no error. Tried reinstalling the unbound packages I had before and removing them as I did before (though I didn't run any of the setup on the unbound stuff)... still no error. So I'm still not sure what did it but I'd have to assume removing my unbound packages happened to remove some config file or package that the luci admin console thing required.

Linux OpenWrt 5.15.137 #0 SMP Tue Nov 14 13:38:11 2023 aarch64 GNU/Linux
LuCI openwrt-23.05 branch (git-24.034.54904-39d1aee) / OpenWrt 23.05.2 (r23630-842932a63d)

Thanks @szero . I discovered this issue today when attemting to login to my Edgerouter X to perform a sysupgrade to v23.05.3. Not sure what caused it since it was working find 71 days ago (uptime). I may have removed a package via cli at some point ... hard to remember!

opkg install luci-compat

I got this after my attended sys upgrade and this fixed it for me also opkg install luci-app-uhttpd