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.

CAIT Setup page looping

See original GitHub issue

The setup page of CAIT remains in an infinite loop on message “Retreiving device information …”

image

image

The only AJAX Request in error is the /getwifi page.

There is the following message in syslog

Feb  9 20:28:16 raspberrypi bash[467]: ERROR:flask.app:Exception on /getwifi [GET]
Feb  9 20:28:16 raspberrypi bash[467]: Traceback (most recent call last):
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/local/lib/python3.7/dist-packages/wifi/scan.py", line 39, in all
Feb  9 20:28:16 raspberrypi bash[467]:     stderr=subprocess.STDOUT)
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
Feb  9 20:28:16 raspberrypi bash[467]:     **kwargs).stdout
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3.7/subprocess.py", line 487, in run
Feb  9 20:28:16 raspberrypi bash[467]:     output=stdout, stderr=stderr)
Feb  9 20:28:16 raspberrypi bash[467]: subprocess.CalledProcessError: Command '['/sbin/iwlist', 'wlan0', 'scan']' returned non-zero exit status 255.
Feb  9 20:28:16 raspberrypi bash[467]: During handling of the above exception, another exception occurred:
Feb  9 20:28:16 raspberrypi bash[467]: Traceback (most recent call last):
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
Feb  9 20:28:16 raspberrypi bash[467]:     response = self.full_dispatch_request()
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
Feb  9 20:28:16 raspberrypi bash[467]:     rv = self.handle_user_exception(e)
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/local/lib/python3.7/dist-packages/flask_cors/extension.py", line 165, in wrapped_function
Feb  9 20:28:16 raspberrypi bash[467]:     return cors_after_request(app.make_response(f(*args, **kwargs)))
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
Feb  9 20:28:16 raspberrypi bash[467]:     reraise(exc_type, exc_value, tb)
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
Feb  9 20:28:16 raspberrypi bash[467]:     raise value
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
Feb  9 20:28:16 raspberrypi bash[467]:     rv = self.dispatch_request()
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
Feb  9 20:28:16 raspberrypi bash[467]:     return self.view_functions[rule.endpoint](**req.view_args)
Feb  9 20:28:16 raspberrypi bash[467]:   File "/home/pi/ia/cep/src/cait/cortic_webapp/main.py", line 180, in getwifi
Feb  9 20:28:16 raspberrypi bash[467]:     cells = list(Cell.all("wlan0"))
Feb  9 20:28:16 raspberrypi bash[467]:   File "/usr/local/lib/python3.7/dist-packages/wifi/scan.py", line 41, in all
Feb  9 20:28:16 raspberrypi bash[467]:     raise InterfaceError(e.output.strip())
Feb  9 20:28:16 raspberrypi bash[467]: wifi.exceptions.InterfaceError: b"wlan0     Interface doesn't support scanning : Device or resource busy"

When I run the command : iwlist wlan0 scan

There is no error :

wlan0     Scan completed :
          Cell 01 - Address: XX:XX:XX:XX:XX
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=70/70  Signal level=-31 dBm
                    Encryption key:on
                    ESSID:"XZ"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                    ....

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelhwncommented, Feb 10, 2022

Ah I see, I know the cause of this issue then. Since the setup page is hosted on the raspberry pi, so when you access this page on a web browser, the hostname (of the raspberry pi) is extracted from the URL. If an IP address is used to access the web app, the extracted hostname will be incorrect. And since the MQTT topic subscription is based on the incorrectly extracted hostname, this explains why the “CAIT UP” MQTT message is not received and you are seeing an incorrect hostname in the field. This is a bug in the setup web app.

I will fix this by making sure the hostname is obtained by the Pi itself and not by the web app using the web browser.

0reactions
michaelhwncommented, Feb 24, 2022

This commit in the dev branch has fixed the hostname issue. This change will be merged to main branch after some testings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Talk:Cait Sith (Final Fantasy VII)
Does anyone actually know what he said in AC? I got the jist of it, but it's diificult to understand.--Sephiroth2.0 02:15, 25 October...
Read more >
fallout 4 child cbbe - Le Case Tecnologiche
The mod adds enemy children, random encounters, and will include 4 child followers in a later version. Fallout 4 notable childrenEdit Lucy Grandchester ......
Read more >
Shop Smartwatches, Fitness Trackers, and More | Fitbit
EXCLUSIVE. Hook & Loop Bands for Fitbit 24mm Attach. Shop. Woven Bands for Fitbit 24mm Attach ... NEW. ZAGG InvisibleShield® Glass Fusion |...
Read more >
Guide :: How to make a SoundCue with an intro loop as close ...
This is where you will put the numbers in you obtained from the site. By inputting the start loop point as the Selection...
Read more >
Coc2 puzzle - cittafamiglia.it
Play online Slither Link the puzzle game also known as Loop The Loop or Fences. ... however they state that it is not...
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