V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
OpenWrt 官方网站
wangclack
V2EX  ›  OpenWrt

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

  •  
  •   wangclack · 137 天前 · 895 次点击
    这是一个创建于 137 天前的主题,其中的信息可能已经有所发展或是发生改变。

    背景

    设备:友善 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 <[email protected]>
    -- Copyright 2008-2015 Jo-Philipp Wich <[email protected]>
    -- 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 如何初始化全局环境和全局变量的资料。

    2 条回复    2023-12-15 16:13:06 +08:00
    morytyann
        1
    morytyann  
       136 天前
    试试用 opkg 重装 luci 和 nginx 还有相关的包,卸载的时候别勾选自动移除未使用的依赖
    wangclack
        2
    wangclack  
    OP
       136 天前
    @morytyann 你的意思是先 remove 然后重新 install 一下?
    另外,没有 web 页面,是不是也没办法取消勾选自动移除未使用的依赖
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3215 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:09 · PVG 20:09 · LAX 05:09 · JFK 08:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.