Luci menu not shown - think it's a Python issue

Hi,
I’ve had a Turris Omnia for nearly 3 years now and it’s been great! I’ve had veery few issues with it and this is the only time I’ve had one that wasn’t me being a donut and that I’ve had to ask for help with! In the past I’ve been able to solve issues by googling and reading this forum.

I already had a couple of port forwards active, I’d added a range the previous day and added another today. It’s just 10 ports to 1 server each.

I was going to modify one but found that the Luci page showed a Python error. Unfortunately I didn’t capture all of it.

But this was part of it:-
turris "A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. "

I also saw:-
“/usr/lib/lua/luci/dispatcher.lua:427: /etc/config/luci seems to be corrupt, unable to find section ‘main’”

ReForris wouldn’t work as well

Later, I could get into Luci but any page I clicked on showed this:-
turris “seems to be corrupt, unable to find section ‘main’”

I’ve looked at this page:-

which seems to describe the issue. But I don’t think I can do the fix because I don’t have another version of OpenWRT to restore from and I don’t want to mess with things because this is from a general OpenWRT discussion and not specific to Turris.

I’ve also looked at this page:-

but I’m not sure it’s relevant as I can’t see an issue with the files (not sure I’d be able to tell if there was one) and the file timestamp is from November last year.

I’ve also looked at this page:-
forum.turris.cz/t/luci-inaccessible/12855

but I’m not sure that’s relevant because that is about issues after an upgrade and I’d not upgraded right before the issue occurred. All I’d done is add a port forwarding rule and then load up the router with lots of connections.

These are the things I’ve done so far:-

  1. I’ve tried rebooting the router.
  2. I’ve tried rolling back to the latest snapshot which I can tell worked because looking in /etc/config/firewall the latest port forwarding rule I put in isn’t there and the file timestamp is from May when I last changed things.
  3. I’ve tried doing an update from ReForris and I’m now on :- TurrisOS 6.4.0 47054075e2a8d37a4f83d27572c4b97b08b8cb5c

The situation right now is that:-

  • The router is up and working normally
  • ReForris seems to be fully working
  • Luci is accessible but there is no menu across the top being shown so I can’t configure it further.

Are there any logs or config files that would be helpful?

Thanks!

Hardware: Device Turris Omnia

Software:
reForis version 1.4.1
Turris OS version 6.4.0
Turris OS branch HBS
Kernel version 5.15.120

I’ve seen such symptoms in luci going away when clearing cookies and logging in again. (but I don’t really understand this web stuff)

2 Likes

I’ve seen such symptoms in luci going away when clearing cookies and logging in again. (but I don’t really understand this web stuff)

Ah! You’re right! Thanks!

To start with I definitely had the issue that seemed to be related to Python because ReForris and Luci just weren’t accessible. I don’t know which of the remedies I tried above fixed that but I think it was the upgrade because after that the only problem was Luci not showing the menus. And I think it was clearing the cache and cookies that fixed that.

I think this can be closed now. But I still think there is an issue with Python or a config file in some way that might have been caused by the config change and the high number of connections.

I have an update: I’ve been able to trigger the issue again. I’ve been doing something that causes a lot of traffic and connections to the internet on my router - more than 3000. And it was just a reboot that was needed to clear the condition. Not a restore to the latest Snapshot. Then you have to clear cache and cookies in your browser for the router’s IP. But you don’t get the issue if you don’t have the Realtime Graphs open.

So:-

Steps to reproduce:-

  1. Have some Luci Realtime Graphs open. I had Connections, Traffic and Load open
  2. Do something that causes lots of connections to the internet and a lot of traffic. More than 3000 connections seemed to do it.

Symptoms

  • Graphs freeze and Connections just shows “No information available” for the IPs
  • When you try to move to another page you see:-
    /usr/lib/lua/luci/dispatcher.lua:427: /etc/config/luci seems to be corrupt, unable to find section 'main'
  • When you try to login to ReForris you see this after entering your password:-
<big><big>**RuntimeError**</big></big> Python 3.9.17: /usr/bin/python3
Sun Jul 30 12:44:55 2023

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

[/usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py](file:///usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py) in **_main**(self=<turris_auth.server.wsgi.Server object>, environ={'CONTENT_LENGTH': '21', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DOCUMENT_ROOT': '/www/turris-webapps/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br', 'HTTP_ACCEPT_LANGUAGE': 'en-GB,en;q=0.9', 'HTTP_CONTENT_LENGTH': '21', 'HTTP_HOST': '10.0.0.1', ...}, start_response=<function BaseFCGIServer.handler.<locals>.start_response>)

[/usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py](file:///usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py) in **_login_post**(self=<turris_auth.server.wsgi.Server object>, environ={'CONTENT_LENGTH': '21', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DOCUMENT_ROOT': '/www/turris-webapps/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br', 'HTTP_ACCEPT_LANGUAGE': 'en-GB,en;q=0.9', 'HTTP_CONTENT_LENGTH': '21', 'HTTP_HOST': '10.0.0.1', ...}, start_response=<function BaseFCGIServer.handler.<locals>.start_response>)

[/usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py](file:///usr/lib/python3.9/site-packages/turris_auth/server/wsgi.py) in **_login_new_session**(self=<turris_auth.server.wsgi.Server object>, environ={'CONTENT_LENGTH': '21', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DOCUMENT_ROOT': '/www/turris-webapps/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br', 'HTTP_ACCEPT_LANGUAGE': 'en-GB,en;q=0.9', 'HTTP_CONTENT_LENGTH': '21', 'HTTP_HOST': '10.0.0.1', ...}, start_response=<function BaseFCGIServer.handler.<locals>.start_response>)

[/usr/lib/python3.9/site-packages/turris_auth/cookie.py](file:///usr/lib/python3.9/site-packages/turris_auth/cookie.py) in **generate**(secure=True, luci_login=True)

[/usr/lib/python3.9/site-packages/turris_auth/luci.py](file:///usr/lib/python3.9/site-packages/turris_auth/luci.py) in **wrapper**(*args=(900,), **kwargs={})

[/usr/lib/python3.9/site-packages/turris_auth/luci.py](file:///usr/lib/python3.9/site-packages/turris_auth/luci.py) in **create_session**(timeout=900, dir=PosixPath('/usr/share/rpcd/acl.d'))

**RuntimeError**: Object 'session' was not found.
args = ("Object 'session' was not found.",)
with_traceback = <built-in method with_traceback of RuntimeError object>

When you login to Luci you see this after entering your password:-

/usr/lib/lua/luci/dispatcher.lua:427: /etc/config/luci seems to be corrupt, unable to find section 'main'

Resolution:-
Reboot router from CLI by logging in as root to the router’s address with the same password used by Luci.
Clear browser cache and cookies for the router’s website.

If you don’t clear the browser cache:-

  • you can login to use Reforris and it seems to work fine
  • you can login to Luci but the menus don’t show.

If you don’t have windows open looking at the Realtime Graphs the issue doesn’t occur. Which is kind of annoying because when you are knowingly loading up the router is exactly when you want to look at graphs!

I don’t know if it would have worked with just 1 graph page showing rather than 3. Maybe I’ll check that at some point but I’ve already rebooted it about 5 times today and I need to get on with stuff!

Hope this is helpful to anyone who gets the same thing and for any bug fixing possible.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.