悲剧了,软路由的 Luci 页面访问报错

154 天前
 wangclack

背景

设备:友善 R4SE

固件:第三方打包的 openwrt

想尝试在软路由上做 IPTV 的组播转发,用 opkg 安装了igmpproxyudpxy。安装之前有看到提示说安装了 udpxy 后 Web 端就会无法正常使用,没有引起注意,心想大不了恢复出厂。没想到果然悲剧了。

安装完之后,访问 Luci 地址,nginx返回 502 错误(是的,这个版本的固件是用 nginx 而不是 uhttpd )

报错的地址是: http://ip/cgi-bin/luci/

排查

nginx 日志:

Wed Dec 13 16:18:13 2023 daemon.info uwsgi-luci: /usr/bin/lua:
Wed Dec 13 16:18:13 2023 daemon.info uwsgi-luci: /usr/lib/lua/luci/dispatcher.lua:7: attempt to index field 'L' (a nil value) stack traceback: 	/usr/lib/lua/luci/dispatcher.lua:7: in main chunk 	[C]: in function 'require' 	/usr/lib/lua/luci/sgi/cgi.lua:10: in main chunk 	[C]: in function 'require' 	/www/cgi-bin/luci:3: in main chunk 	[C]: ?
Wed Dec 13 16:18:13 2023 daemon.info uwsgi-luci:
Wed Dec 13 16:18:13 2023 daemon.err nginx[2705]: 2023/12/13 16:18:13 [error] 2982#0: *13091 upstream prematurely closed connection while reading response header from upstream, client: 192.168.4.3, server: op, request: "GET /cgi-bin/luci/admin/system/opkg HTTP/1.1", upstream: "uwsgi://unix:////var/run/luci-webui.socket:", host: "192.168.3.1", referrer: "http://192.168.3.1/cgi-bin/luci/"
Wed Dec 13 16:18:16 2023 daemon.info uwsgi-luci: /usr/bin/lua:

/usr/lib/lua/luci/dispatcher.lua的部分内容

-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.

module("luci.dispatcher", package.seeall)
-- 报错的第 7 行 --
local http = _G.L.http 

不熟悉 Lua 和 Luci ,问了 GPT ,回答_G 是全局环境,L 是 Luci 的全局变量。

请问各位大佬,如何排查和解决这个问题?在网上没找到关于 Luci 如何初始化全局环境和全局变量的资料。

932 次点击
所在节点    OpenWrt
2 条回复
morytyann
153 天前
试试用 opkg 重装 luci 和 nginx 还有相关的包,卸载的时候别勾选自动移除未使用的依赖
wangclack
153 天前
@morytyann 你的意思是先 remove 然后重新 install 一下?
另外,没有 web 页面,是不是也没办法取消勾选自动移除未使用的依赖

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1000270

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX