question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

luci.model.ipkg.status/lookup doesn't handle opkg failures

See original GitHub issue

As mentioned in the comments, opkg sucks. I had been executing opkg status <pkg-name> directly myself, but after getting errors like

* opkg_conf_load: Could not lock /var/lock/opkg.lock: Resource temporarily unavailable.

I was trying to use luci.model.ipkg.status(xxx) instead, and when calling this in rapid succession for numerous packages, I was, now simply getting a returned data block that was empty.

This is because the “os.execute(“opkg status”…” line doesn’t check the return code, and throws away stderr. See https://github.com/openwrt/luci/blob/master/modules/luci-base/luasrc/model/ipkg.lua#L87

A potential improvement would be…

        local rc = os.execute(cmd .. (" >%s 2>>/tmp/opkg.fails.lua.log" % tmpfile))                                                                               
        local data                                                                 
        if rc == 0 then                                                            
                data = _parselist(io.lines(tmpfile))                                 
        else                                                             
                data = nil                                               
        end                                                              

        os.remove(tmpfile)                                               
        return data                   

But that doesn’t really help fix the problem that opkg is just sucking on this. What I’ve done instead is get opkg status for the entire system, and parse that myself for the pkgs I care about.

Footnote, what on earth is the difference between opkg status and opkg info?!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jow-commented, Dec 6, 2021

I ended up parsing lists manually. The opkg program itself is too inefficient to be relied upon for any status querying.

0reactions
karlpcommented, Dec 6, 2021

My workaround of fetching the entire list is still in place, but you’re deprecating the entire class right? Are the alternatives: a) execute opkg directly, and b) convert to client side via… ? There’s nothing obvious under https://openwrt.github.io/luci/jsapi/index.html, i presume it’s declaring some effectively undocumented ubus method?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
luci.model.ipkg.status/lookup doesn't handle opkg failures.
Read more >
LuCi fails to Install - OpenWrt Forum
First i want to apologize for my bad english. Now to the Problem. I cant install Luci for some reason. It says: root@OpenWrt:~#...
Read more >
Untitled
Tozase bleach, 60 years old and tired, Nys dmv title status lookup, Rotational therapy ... Lucine kasbarian, Ultra model set 40, Blogshop singapore...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found