Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work on Ubuntu #284

Closed
warpwanderer opened this issue Jul 3, 2024 · 19 comments
Closed

Don't work on Ubuntu #284

warpwanderer opened this issue Jul 3, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@warpwanderer
Copy link

Describe The Problem
When going to http://:10086 the message is displayed: Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Expected Error / Traceback

(myenv) root:~/wgdashboard/src$ sudo ./wgd.sh start
------------------------------------------------------------
| Starting WGDashboard with Gunicorn in the background.    |
Failed to read config file: /home/medraut/wgdashboard/src/gunicorn.conf.py
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 111, in get_config_from_filename
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/medraut/wgdashboard/src/gunicorn.conf.py", line 2, in <module>
    import dashboard
  File "/home/medraut/wgdashboard/src/dashboard.py", line 23, in <module>
    import ifcfg
ModuleNotFoundError: No module named 'ifcfg'
| Log files is under log/                                  |
------------------------------------------------------------
(myenv) root:~/wgdashboard/src$ ./wgd.sh start
------------------------------------------------------------
| Starting WGDashboard with Gunicorn in the background.    |
| Log files is under log/                                  |
------------------------------------------------------------

To Reproduce
http://:10086 in the client browser

OS Information:

  • OS: Ubuntu 24.04 LTS
  • Python 3.12.3
@warpwanderer warpwanderer added the bug Something isn't working label Jul 3, 2024
@Houdoe
Copy link

Houdoe commented Jul 4, 2024

same here

@donaldzou
Copy link
Owner

Hi, could you run python3 -m pip install -r requirements.txt in your virtual environment and see if that helps?

@donaldzou
Copy link
Owner

Hi @Houdoe, are you using an virtual environment? If not, I suggest you to create one since the newer version of Python does not allow user to install global dependencies by default. You can follow this if you're using Debian/Ubuntu system:

$ sudo apt-get install python3.12-venv        << Replace the python version you have on your system
$ cd wgdashboard/src
$ python3 -m venv ./venv
$ source ./venv/bin/activate
(venv) $ python3 -m pip install -r requirements.txt
(venv) $ ./wgd.sh start

Let me know if this helps :)

@warpwanderer
Copy link
Author

warpwanderer commented Jul 4, 2024

Hi, could you run python3 -m pip install -r requirements.txt in your virtual environment and see if that helps?

Hello, yes, I used a virtual environment, everything was installed, but when I go to the IP it gives the error Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
if you do not use a virtual environment, the packages are not installed and an error appears on the server related to import ifcfg.

@donaldzou
Copy link
Owner

donaldzou commented Jul 4, 2024

Hi, are you still encountering the issue even with venv? Would you able to paste the error when you run ./wgd.sh debug please?

@donaldzou donaldzou reopened this Jul 4, 2024
@warpwanderer
Copy link
Author

Hi, are you still encountering the issue even with venv? Would you able to paste the error when you run ./wgd.sh debug please?

when venv the error appears in the browser

@donaldzou
Copy link
Owner

Hi, are you still encountering the issue even with venv? Would you able to paste the error when you run ./wgd.sh debug please?

when venv the error appears in the browser

I see, what if you run ./wgd.sh debug and does it show any error in the console when you access the dashboard?

@warpwanderer
Copy link
Author

warpwanderer commented Jul 4, 2024

./wgd.sh debug

It turns out the port is occupied by another program. Can I edit the launch port in the conf file?

(venv) root@:~/wgdashboard/src$ ./wgd.sh debug
------------------------------------------------------------
| Starting WGDashboard in the foreground.                  |
 * Serving Flask app 'WGDashboard'
 * Debug mode: off
Address already in use
Port 10086 is in use by another program. Either identify and stop that program, or start the server with a different port.

@warpwanderer
Copy link
Author

Hi, are you still encountering the issue even with venv? Would you able to paste the error when you run ./wgd.sh debug please?

when venv the error appears in the browser

I see, what if you run ./wgd.sh debug and does it show any error in the console when you access the dashboard?

I killed the process on the port, restarted it, again the same error in the browser, but the debug shows:

(venv) medraut@:~/wgdashboard/src$ ./wgd.sh debug
------------------------------------------------------------
| Starting WGDashboard in the foreground.                  |
 * Serving Flask app 'WGDashboard'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:10086
 * Running on http://*.*.*.* :10086
Press CTRL+C to quit
[2024-07-04 20:27:21,704] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 878, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1253, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 639, in auth_req
    g.db = connect_db()
           ^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 66, in connect_db
    return sqlite3.connect(os.path.join(configuration_path, 'db', 'wgdashboard.db'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file
*.*.*.*  - - [04/Jul/2024 20:27:21] "GET / HTTP/1.1" 500 -
[2024-07-04 20:27:21,975] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 878, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1253, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 639, in auth_req
    g.db = connect_db()
           ^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 66, in connect_db
    return sqlite3.connect(os.path.join(configuration_path, 'db', 'wgdashboard.db'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file
*.*.*.*  - - [04/Jul/2024 20:27:21] "GET /favicon.ico HTTP/1.1" 500 -
[2024-07-04 20:27:22,803] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 878, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1253, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 639, in auth_req
    g.db = connect_db()
           ^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 66, in connect_db
    return sqlite3.connect(os.path.join(configuration_path, 'db', 'wgdashboard.db'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file
*.*.*.* - - [04/Jul/2024 20:27:22] "GET / HTTP/1.1" 500 -
[2024-07-04 20:27:23,014] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 878, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/venv/lib/python3.12/site-packages/flask/app.py", line 1253, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 639, in auth_req
    g.db = connect_db()
           ^^^^^^^^^^^^
  File "/home/medraut/wgdashboard/src/dashboard.py", line 66, in connect_db
    return sqlite3.connect(os.path.join(configuration_path, 'db', 'wgdashboard.db'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file
95.25.214.72 - - [04/Jul/2024 20:27:23] "GET /favicon.ico HTTP/1.1" 500 -

@donaldzou
Copy link
Owner

Seems like the dashboard can't find the database... I'm thinking will it caused by permission? Could you please try using sudo and run debug and see if that helps?

@warpwanderer
Copy link
Author

warpwanderer commented Jul 5, 2024

Seems like the dashboard can't find the database... I'm thinking will it caused by permission? Could you please try using sudo and run debug and see if that helps?

does not start if used sudo error ModuleNotFoundError: No module named 'ifcfg', without sudo start ok

medraut@:~/wgdashboard/src$ sudo ./wgd.sh start
 [sudo] password for medraut:
 ------------------------------------------------------------
 | Starting WGDashboard with Gunicorn in the background.    |
 Failed to read config file: /home/medraut/wgdashboard/src/gunicorn.conf.py
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 111, in get_config_from_filename
     spec.loader.exec_module(mod)
   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
   File "/home/medraut/wgdashboard/src/gunicorn.conf.py", line 2, in <module>
     import dashboard
   File "/home/medraut/wgdashboard/src/dashboard.py", line 23, in <module>
     import ifcfg
 ModuleNotFoundError: No module named 'ifcfg'
 | Log files is under log/                                  |
 ------------------------------------------------------------

@donaldzou
Copy link
Owner

donaldzou commented Jul 5, 2024 via email

@warpwanderer
Copy link
Author

That's exactly what I did

@donaldzou
Copy link
Owner

Seems like the dashboard can't find the database... I'm thinking will it caused by permission? Could you please try using sudo and run debug and see if that helps?

does not start if used sudo error ModuleNotFoundError: No module named 'ifcfg', without sudo start ok


medraut@:~/wgdashboard/src$ sudo ./wgd.sh start

 [sudo] password for medraut:

 ------------------------------------------------------------

 | Starting WGDashboard with Gunicorn in the background.    |

 Failed to read config file: /home/medraut/wgdashboard/src/gunicorn.conf.py

 Traceback (most recent call last):

   File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 111, in get_config_from_filename

     spec.loader.exec_module(mod)

   File "<frozen importlib._bootstrap_external>", line 995, in exec_module

   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed

   File "/home/medraut/wgdashboard/src/gunicorn.conf.py", line 2, in <module>

     import dashboard

   File "/home/medraut/wgdashboard/src/dashboard.py", line 23, in <module>

     import ifcfg

 ModuleNotFoundError: No module named 'ifcfg'

 | Log files is under log/                                  |

 ------------------------------------------------------------

Hmm I don't think you used venv in this one.. it should have a bracket wrapping your venv's name before each command.

@warpwanderer
Copy link
Author

warpwanderer commented Jul 6, 2024 via email

@DaanSelen
Copy link
Collaborator

Is this issue fixed?

@warpwanderer
Copy link
Author

Is this issue fixed?

Yes, I checked today, installed everything from the beginning, everything works fine

@DaanSelen
Copy link
Collaborator

So this issue is solved?

@warpwanderer
Copy link
Author

So this issue is solved?

Yes, that's right, we can close it, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants