[GH-ISSUE #2720] Internal error on fresh reinstallation #1687

Closed
opened 2026-02-27 11:18:34 +03:00 by kerem · 13 comments
Owner

Originally created by @yannfill on GitHub (Dec 28, 2022).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2720

  • OS Type: Arch
  • OS Version: Arch
  • Database Type: MariaDB
  • Database version: 10.9.4
  • Modoboa: 2.0.3
  • installer used: No
  • Webserver: Nginx

Hi,

On a fresh reinstall the the login page is displayed correctly but after logging I get an internal error. With DEBUG = True in settings.py, I launch gunicorn with this command:

/srv/modoboa/env/bin/gunicorn -c gunicorn.conf.py instance.wsgi:application --log-level debug --access-logfile - --error-logfile -

I have no trace on stdout or on the web page, simply internal error on red background.

Originally created by @yannfill on GitHub (Dec 28, 2022). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2720 * OS Type: Arch * OS Version: Arch * Database Type: MariaDB * Database version: 10.9.4 * Modoboa: 2.0.3 * installer used: No * Webserver: Nginx Hi, On a fresh reinstall the the login page is displayed correctly but after logging I get an internal error. With `DEBUG = True` in settings.py, I launch gunicorn with this command: ``` /srv/modoboa/env/bin/gunicorn -c gunicorn.conf.py instance.wsgi:application --log-level debug --access-logfile - --error-logfile - ``` I have no trace on stdout or on the web page, simply internal error on red background.
kerem closed this issue 2026-02-27 11:18:34 +03:00
Author
Owner

@yannfill commented on GitHub (Dec 28, 2022):

I'm using python 3.10 in venv.

<!-- gh-comment-id:1366625292 --> @yannfill commented on GitHub (Dec 28, 2022): I'm using python 3.10 in venv.
Author
Owner

@Spitfireap commented on GitHub (Dec 28, 2022):

Hi,
Could you open browser console with DEBUG = True and try to log in ? Requests with error should logically have a trace within the response.

<!-- gh-comment-id:1366628427 --> @Spitfireap commented on GitHub (Dec 28, 2022): Hi, Could you open browser console with `DEBUG = True` and try to log in ? Requests with error should logically have a trace within the response.
Author
Owner

@yannfill commented on GitHub (Dec 28, 2022):

All I get is:

GET https://modoboa.example.com/dashboard/ [HTTP/2 500 Internal Server Error 2725ms]
Uncaught Error: Bootstrap's JavaScript requires jQuery
Uncaught bootstrap-datetimepicker requires jQuery to be loaded first

No usable info in the error 500.

If I try /new-admin everything seems to work fine.

<!-- gh-comment-id:1366641925 --> @yannfill commented on GitHub (Dec 28, 2022): All I get is: ``` GET https://modoboa.example.com/dashboard/ [HTTP/2 500 Internal Server Error 2725ms] Uncaught Error: Bootstrap's JavaScript requires jQuery Uncaught bootstrap-datetimepicker requires jQuery to be loaded first ``` No usable info in the error 500. If I try /new-admin everything seems to work fine.
Author
Owner

@Spitfireap commented on GitHub (Dec 28, 2022):

Okay, so I guess that if you reload the page without the browser cache, you see a bunch of 404 error (like jquery) ? If so, you might need to re-apply static collection (python manage.py collectstatic) and check STATIC_ROOT in your settings.py.

<!-- gh-comment-id:1366644594 --> @Spitfireap commented on GitHub (Dec 28, 2022): Okay, so I guess that if you reload the page without the browser cache, you see a bunch of 404 error (like jquery) ? If so, you might need to re-apply static collection (`python manage.py collectstatic`) and check `STATIC_ROOT` in your `settings.py`.
Author
Owner

@yannfill commented on GitHub (Dec 28, 2022):

I always do ctrl-shift-R to flush the browser cache, I see no 404. Error 500 on /dashboard/ and 200 for JS and CSS.

$ $ python manage.py collectstatic
0 static files copied to '/srv/modoboa/instance/sitestatic', 2838 unmodified.
STATIC_ROOT = os.path.join(BASE_DIR, 'sitestatic')
<!-- gh-comment-id:1366668070 --> @yannfill commented on GitHub (Dec 28, 2022): I always do ctrl-shift-R to flush the browser cache, I see no 404. Error 500 on /dashboard/ and 200 for JS and CSS. ``` $ $ python manage.py collectstatic 0 static files copied to '/srv/modoboa/instance/sitestatic', 2838 unmodified. ``` ``` STATIC_ROOT = os.path.join(BASE_DIR, 'sitestatic') ```
Author
Owner

@yannfill commented on GitHub (Dec 28, 2022):

Are modoboa.policyd and modoboa.maillog mandatory in MODOBOA_APPS ?

<!-- gh-comment-id:1366669735 --> @yannfill commented on GitHub (Dec 28, 2022): Are modoboa.policyd and modoboa.maillog mandatory in MODOBOA_APPS ?
Author
Owner

@Spitfireap commented on GitHub (Dec 29, 2022):

policyd is what manage relationship with postfix and maillog is for analyzing logs for the stats. These are not extensions but core feature, so I would leave them there.

As for the error 500, having DEBUG = True should input the trace in the response of the request. Else it might suggest that there is an issue on Nginx side. Have you checked Nginx access logs ?

<!-- gh-comment-id:1367238171 --> @Spitfireap commented on GitHub (Dec 29, 2022): policyd is what manage relationship with postfix and maillog is for analyzing logs for the stats. These are not extensions but core feature, so I would leave them there. As for the error 500, having `DEBUG = True` should input the trace in the response of the request. Else it might suggest that there is an issue on Nginx side. Have you checked Nginx access logs ?
Author
Owner

@yannfill commented on GitHub (Dec 29, 2022):

The error 500 is logged in nginx access log, not error log, so I don't think it's on nginx side. And the internal error seems like a django formatted output.

The thing that I don't understand is, in spite of having DEBUG = True in settings.py, debug = true and loglevel = debug in gunicorn.conf.py, I don't see any error anywhere, not on stdout when using command line or in journald when using systemd unit, or in browser console. If I split gunicorn access and error logs in 2 files, the access log is empty and no error appears in the error log.

Maybe the problem lies between nginx and the gunicorn socket but I don't know how to debug it. It was working a few weeks ago and I don't think anything has changed since then.

<!-- gh-comment-id:1367378876 --> @yannfill commented on GitHub (Dec 29, 2022): The error 500 is logged in nginx access log, not error log, so I don't think it's on nginx side. And the internal error seems like a django formatted output. The thing that I don't understand is, in spite of having `DEBUG = True` in settings.py, `debug = true` and `loglevel = debug` in gunicorn.conf.py, I don't see any error anywhere, not on stdout when using command line or in journald when using systemd unit, or in browser console. If I split gunicorn access and error logs in 2 files, the access log is empty and no error appears in the error log. Maybe the problem lies between nginx and the gunicorn socket but I don't know how to debug it. It was working a few weeks ago and I don't think anything has changed since then.
Author
Owner

@Spitfireap commented on GitHub (Dec 29, 2022):

Yes, If it was on Django side, you would have the traceback. I don't use gunicorn, so I can't really help you on this. Perhaps you could leave the DEBUG to True and restart your server. So you are sure that everything is reloading correctly ?

All I get is:

GET https://modoboa.example.com/dashboard/ [HTTP/2 500 Internal Server Error 2725ms]
Uncaught Error: Bootstrap's JavaScript requires jQuery
Uncaught bootstrap-datetimepicker requires jQuery to be loaded first

No usable info in the error 500.

Do you see the POST request directed to /login ?

<!-- gh-comment-id:1367393519 --> @Spitfireap commented on GitHub (Dec 29, 2022): Yes, If it was on Django side, you would have the traceback. I don't use gunicorn, so I can't really help you on this. Perhaps you could leave the DEBUG to True and restart your server. So you are sure that everything is reloading correctly ? > All I get is: > > ``` > GET https://modoboa.example.com/dashboard/ [HTTP/2 500 Internal Server Error 2725ms] > Uncaught Error: Bootstrap's JavaScript requires jQuery > Uncaught bootstrap-datetimepicker requires jQuery to be loaded first > ``` > > No usable info in the error 500. Do you see the POST request directed to /login ?
Author
Owner

@yannfill commented on GitHub (Dec 29, 2022):

OK, in fact I was using the wrong settings.py file. I still have error 500 but know I have traces:

AttributeError at /dashboard/

module 'collections' has no attribute 'Callable'

    Request Method: GET
       Request URL: https://modoboa.example.com/dashboard/
    Django Version: 3.2.16
    Exception Type: AttributeError
   Exception Value: module 'collections' has no attribute 'Callable'
Exception Location: /srv/modoboa/env/lib/python3.10/site-packages/dateutil/parser.py, line 324, in parse
 Python Executable: /srv/modoboa/env/bin/python
    Python Version: 3.10.9
       Python Path: ['/srv/modoboa/instance',
                     '/srv/modoboa/env/bin',
                     '/usr/lib/python310.zip',
                     '/usr/lib/python3.10',
                     '/usr/lib/python3.10/lib-dynload',
                     '/srv/modoboa/env/lib/python3.10/site-packages']
       Server time: Thu, 29 Dec 2022 16:59:53 +0100
<!-- gh-comment-id:1367443881 --> @yannfill commented on GitHub (Dec 29, 2022): OK, in fact I was using the wrong settings.py file. I still have error 500 but know I have traces: ``` AttributeError at /dashboard/ module 'collections' has no attribute 'Callable' Request Method: GET Request URL: https://modoboa.example.com/dashboard/ Django Version: 3.2.16 Exception Type: AttributeError Exception Value: module 'collections' has no attribute 'Callable' Exception Location: /srv/modoboa/env/lib/python3.10/site-packages/dateutil/parser.py, line 324, in parse Python Executable: /srv/modoboa/env/bin/python Python Version: 3.10.9 Python Path: ['/srv/modoboa/instance', '/srv/modoboa/env/bin', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/srv/modoboa/env/lib/python3.10/site-packages'] Server time: Thu, 29 Dec 2022 16:59:53 +0100 ```
Author
Owner

@yannfill commented on GitHub (Dec 29, 2022):

Seems related to a change in python 3.10: https://bobbyhadz.com/blog/python-attributeerror-module-collections-has-no-attribute-callable

<!-- gh-comment-id:1367447892 --> @yannfill commented on GitHub (Dec 29, 2022): Seems related to a change in python 3.10: https://bobbyhadz.com/blog/python-attributeerror-module-collections-has-no-attribute-callable
Author
Owner

@Spitfireap commented on GitHub (Dec 29, 2022):

Much better, so yes. Simple fix: remove py-dateutil from the venv and install python-dateutil

<!-- gh-comment-id:1367452056 --> @Spitfireap commented on GitHub (Dec 29, 2022): Much better, [so yes](https://github.com/modoboa/modoboa/pull/2677). Simple fix: remove `py-dateutil` from the venv and install `python-dateutil`
Author
Owner

@yannfill commented on GitHub (Dec 29, 2022):

Indeed, now everything is working. Than you very much for your help @Spitfireap.

<!-- gh-comment-id:1367470902 --> @yannfill commented on GitHub (Dec 29, 2022): Indeed, now everything is working. Than you very much for your help @Spitfireap.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1687
No description provided.