coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
514 stars 257 forks source link

Problem with pakage uci after build firmware archer c7 #435

Open htnghia90 opened 6 years ago

htnghia90 commented 6 years ago

Hi everyone. After I build firmware tp-link archer 7. I can ssh bu port 22 but website 80 is faill. I try to install or update luci or uci. But two of them installed. Anybody know this issue, help me please /usr/lib/lua/luci/controller/admin/users.lua:7: module 'uci' not found: no field package.preload['uci'] no file './uci.lua' no file '/usr/share/lua/uci.lua' no file '/usr/share/lua/uci/init.lua' no file '/usr/lib/lua/uci.lua' no file '/usr/lib/lua/uci/init.lua' no file './uci.so' no file '/usr/lib/lua/uci.so' no file '/usr/lib/lua/loadall.so' stack traceback: [C]: in function 'require' /usr/lib/lua/luci/controller/admin/users.lua:7: in main chunk [C]: in function 'require' /usr/lib/lua/luci/dispatcher.lua:517: in function 'createindex' /usr/lib/lua/luci/dispatcher.lua:544: in function 'createtree' /usr/lib/lua/luci/dispatcher.lua:220: in function 'dispatch' /usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>

Here is source in /usr/lib/lua/luci/controller/admin/users.lua -- Copyright 2008 Steven Barth steven@midlink.org -- Copyright 2011-2015 Jo-Philipp Wich jow@openwrt.org -- Licensed to the public under the Apache License 2.0.

module("luci.controller.admin.users", package.seeall)

require ("uci") local usw = require "luci.users"

function index() local page local nw = require "luci.dispatcher" local user = nw.get_user() local uci = uci.cursor() local fs = require "nixio.fs"

if user == "root" then
  page = node("admin", "users")
  page.target = firstchild()
  page.title  = _("Users")
  page.order  = 50
  page.index  = true

    page = entry({"admin", "users", "add_user"}, cbi("admin_users/add_user"), nil)
    page.leaf = true

    page = entry({"admin", "users", "edit_user"}, cbi("admin_users/edit_user"), nil)
    page.leaf = true

    page = entry({"admin", "users", "user_delete"}, post("user_delete"), nil)
    page.leaf = true

    page = entry({"admin", "users", "user_status"}, call("user_status"), nil)
    page.leaf = true

    page = entry({"admin", "users", "users"}, arcombine(cbi("admin_users/users"), cbi("admin_users/edit_user")), _("Edit Users"), 10)
    page.leaf   = true
    page.subindex = true

    if page.inreq then
        uci:foreach("users", "user",
            function (section)
                local ifc = section[".name"]
                if ifc ~= "loopback" and ifc ~= "new" then
                    entry({"admin", "users", "users", ifc},
                    true, ifc:upper())
                end
            end)
    end

end
if user ~= "root" then
  name = string.sub(user:upper(),0,1) .. user:sub(2,-1)
  page = node("admin", "users")
  page.target = firstchild()
  page.title  = _(name.."s Options")
  page.order  = 50
  page.index  = true

    page = entry({"admin", "users", "passwd"}, cbi("admin_users/passwd"), _("Password"), 10)
end

end

local function cdate(user) local udate = nixio.fs.stat("/home/"..user) local first = os.date("%c", udate.ctime) return first end

local function adate(user) local udate = nixio.fs.stat("/home/"..user) last = os.date("%c", udate.atime) or nil return last end

local function get_shell(user) local uci = uci.cursor() local shell = uci:get("users", user, "shell") return shell end

local function get_group(user) local uci = uci.cursor() local group = uci:get("users", user, "group") return group end

function userstatus(users) local rv = { } local user for user in users:gmatch("[%w%.%-]+") do local first = cdate(user) local last = adate(user) local shell = get_shell(user) local group = get_group(user) if user then local data = { id = user, shell = shell, group = group, first = first, last = last

       }

  rv[#rv+1] = data
else
  rv[#rv+1] = {
        id      = user,
        shell   = "unknown",
        group   = "unknown"
      }
end

end if #rv > 0 then luci.http.prepare_content("application/json") luci.http.write_json(rv) return end luci.http.status(404, "No such device") end

function user_delete(user) local usw = require "luci.users" local uci = uci.cursor() local rem = uci:delete("users",user)

uci:commit("users") usw.del_user(user) luci.http.redirect(luci.dispatcher.build_url("admin/users/users")) return end

jandersonti commented 5 years ago

Hello @htnghia90!

Did you get some solution for that? I'm with the same issue with TP Link Archer C50.

Best regards, Jandersonti.

htnghia90 commented 5 years ago

Dear Jandersonti,

That's problem for new version luci package at https://git.lede-project.org/project/luci.git You must build default openwrt without luci package and then install luci by command line later or you use another luci package on github. Good luck

Best regards

PabloCastellano commented 4 years ago

You need to install libuci-lua

kikomayorga commented 1 year ago

You need to install libuci-lua

This worked for me... similar error and this did the fix.