[GH-ISSUE #3124] Internal Server Error #1771

Closed
opened 2026-02-27 11:19:02 +03:00 by kerem · 10 comments
Owner

Originally created by @adrians75 on GitHub (Nov 28, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3124

Hello,
I have a fresh install, on a server with Ubuntu 22 I installed Cloudpanel and Modoboa. I followed this tutorial for installation https://www.linuxbabe.com/mail-server/email-server-ubuntu-22-04-modoboa

After completing the installation of Modoboa I received the message "You can enjoy Modoboa at .." but when accessing the link I receive the error "Internal Server Error" on the web page.

I found the following post also on Gihub

Same problem again, i think some package that it needs is not available since i am installing it inside a lxd container. You should put here instructions how people can debug and restart uwsgi whatever that is.
Hi. Just installed modoboa for the first time and faced this error. Temporary fixed this with setting USE_TZ to False in /srv/modoboa/instance/instance/settings.py file and /etc/init.d/uwsgi restart.

I made the respective setting, restarted, but the problem still hasn't been solved.

What else could I check?
Thank you!

Originally created by @adrians75 on GitHub (Nov 28, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3124 Hello, I have a fresh install, on a server with Ubuntu 22 I installed Cloudpanel and Modoboa. I followed this tutorial for installation https://www.linuxbabe.com/mail-server/email-server-ubuntu-22-04-modoboa After completing the installation of Modoboa I received the message "You can enjoy Modoboa at .." but when accessing the link I receive the error "Internal Server Error" on the web page. I found the following post also on Gihub _Same problem again, i think some package that it needs is not available since i am installing it inside a lxd container. You should put here instructions how people can debug and restart uwsgi whatever that is. Hi. Just installed modoboa for the first time and faced this error. Temporary fixed this with setting USE_TZ to False in /srv/modoboa/instance/instance/settings.py file and /etc/init.d/uwsgi restart._ I made the respective setting, restarted, but the problem still hasn't been solved. What else could I check? Thank you!
kerem closed this issue 2026-02-27 11:19:02 +03:00
Author
Owner

@NeitsabTeguom commented on GitHub (Dec 12, 2023):

Same problem, Internal Server Error (500)
And the fix [adrians75] say, effectively not working.
Some solutions ?

I see error on debug mode (i just replace my domain by * ) :

Tue Dec 12 18:17:49 2023 - SIGINT/SIGQUIT received...killing workers...
Tue Dec 12 18:17:50 2023 - worker 1 buried after 1 seconds
Tue Dec 12 18:17:50 2023 - worker 2 buried after 1 seconds
Tue Dec 12 18:17:50 2023 - goodbye to uWSGI.
Tue Dec 12 18:17:50 2023 - VACUUM: unix socket /run/uwsgi/app/modoboa_instance/socket removed.
Tue Dec 12 17:17:50 2023 - *** Starting uWSGI 2.0.19.1-debian (64bit) on [Tue Dec 12 17:17:50 2023] ***
Tue Dec 12 17:17:50 2023 - compiled with version: 10.2.1 20210110 on 11 June 2021 09:08:33
Tue Dec 12 17:17:50 2023 - os: Linux-5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21)
Tue Dec 12 17:17:50 2023 - nodename: mail..
Tue Dec 12 17:17:50 2023 - machine: x86_64
Tue Dec 12 17:17:50 2023 - clock source: unix
Tue Dec 12 17:17:50 2023 - pcre jit disabled
Tue Dec 12 17:17:50 2023 - detected number of CPU cores: 2
Tue Dec 12 17:17:50 2023 - current working directory: /
Tue Dec 12 17:17:50 2023 - writing pidfile to /run/uwsgi/app/modoboa_instance/pid
Tue Dec 12 17:17:50 2023 - detected binary path: /usr/bin/uwsgi-core
Tue Dec 12 17:17:50 2023 - chdir() to /srv/modoboa/instance
Tue Dec 12 17:17:50 2023 - your processes number limit is 7637
Tue Dec 12 17:17:50 2023 - your memory page size is 4096 bytes
Tue Dec 12 17:17:50 2023 - detected max file descriptor number: 1024
Tue Dec 12 17:17:50 2023 - VirtualHosting mode enabled.
Tue Dec 12 17:17:50 2023 - lock engine: pthread robust mutexes
Tue Dec 12 17:17:50 2023 - thunder lock: disabled (you can enable it with --thunder-lock)
Tue Dec 12 17:17:50 2023 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/modoboa_instance/socket fd 3
Tue Dec 12 17:17:50 2023 - setgid() to 1000
Tue Dec 12 17:17:50 2023 - setuid() to 1000
Tue Dec 12 17:17:50 2023 - Python version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
Tue Dec 12 17:17:50 2023 - PEP 405 virtualenv detected: /srv/modoboa/env
Tue Dec 12 17:17:50 2023 - Set PythonHome to /srv/modoboa/env
Tue Dec 12 17:17:50 2023 - *** Python threads support is disabled. You can enable it with --enable-threads ***
Tue Dec 12 17:17:50 2023 - Python main interpreter initialized at 0x557d4e395fb0
Tue Dec 12 17:17:50 2023 - your server socket listen backlog is limited to 100 connections
Tue Dec 12 17:17:50 2023 - your mercy for graceful operations on workers is 60 seconds
Tue Dec 12 17:17:50 2023 - mapped 218808 bytes (213 KB) for 2 cores
Tue Dec 12 17:17:50 2023 - *** Operational MODE: preforking ***
Traceback (most recent call last):
File "./instance/wsgi.py", line 16, in
application = get_wsgi_application()
File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 124, in populate
app_config.ready()
File "/srv/modoboa/env/lib/python3.9/site-packages/modoboa_pdfcredentials/apps.py", line 13, in ready
from . import handlers
File "/srv/modoboa/env/lib/python3.9/site-packages/modoboa_pdfcredentials/handlers.py", line 8, in
from django.utils.translation import ugettext as _
ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/srv/modoboa/env/lib/python3.9/site-packages/django/utils/translation/init.py)
Tue Dec 12 18:17:52 2023 - unable to load app 0 (mountpoint='') (callable not found or import error)
ue Dec 12 18:17:52 2023 - *** no app loaded. going in full dynamic mode ***
Tue Dec 12 18:17:52 2023 - spawned uWSGI master process (pid: 197462)
Tue Dec 12 18:17:52 2023 - spawned uWSGI worker 1 (pid: 197474, cores: 1)
Tue Dec 12 18:17:52 2023 - spawned uWSGI worker 2 (pid: 197475, cores: 1)
Traceback (most recent call last):
File "./instance/wsgi.py", line 16, in
application = get_wsgi_application()
File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 83, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
Tue Dec 12 18:19:09 2023 - unable to load app 0 (mountpoint='mail.
.|') (callable not found or import error)
Tue Dec 12 18:19:09 2023 - --- no python application found, check your startup logs for errors ---
mail.**. [pid: 197475|app: -1|req: -1/1] 109.221.81.79 () {54 vars in 893 bytes} [Tue Dec 12 18:19:09 2023] GET /accounts/login/ => generated 21 bytes in 9 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

<!-- gh-comment-id:1852466730 --> @NeitsabTeguom commented on GitHub (Dec 12, 2023): Same problem, Internal Server Error (500) And the fix [adrians75] say, effectively not working. Some solutions ? I see error on debug mode (i just replace my domain by * ) : Tue Dec 12 18:17:49 2023 - SIGINT/SIGQUIT received...killing workers... Tue Dec 12 18:17:50 2023 - worker 1 buried after 1 seconds Tue Dec 12 18:17:50 2023 - worker 2 buried after 1 seconds Tue Dec 12 18:17:50 2023 - goodbye to uWSGI. Tue Dec 12 18:17:50 2023 - VACUUM: unix socket /run/uwsgi/app/modoboa_instance/socket removed. Tue Dec 12 17:17:50 2023 - *** Starting uWSGI 2.0.19.1-debian (64bit) on [Tue Dec 12 17:17:50 2023] *** Tue Dec 12 17:17:50 2023 - compiled with version: 10.2.1 20210110 on 11 June 2021 09:08:33 Tue Dec 12 17:17:50 2023 - os: Linux-5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) Tue Dec 12 17:17:50 2023 - nodename: mail.*****.*** Tue Dec 12 17:17:50 2023 - machine: x86_64 Tue Dec 12 17:17:50 2023 - clock source: unix Tue Dec 12 17:17:50 2023 - pcre jit disabled Tue Dec 12 17:17:50 2023 - detected number of CPU cores: 2 Tue Dec 12 17:17:50 2023 - current working directory: / Tue Dec 12 17:17:50 2023 - writing pidfile to /run/uwsgi/app/modoboa_instance/pid Tue Dec 12 17:17:50 2023 - detected binary path: /usr/bin/uwsgi-core Tue Dec 12 17:17:50 2023 - chdir() to /srv/modoboa/instance Tue Dec 12 17:17:50 2023 - your processes number limit is 7637 Tue Dec 12 17:17:50 2023 - your memory page size is 4096 bytes Tue Dec 12 17:17:50 2023 - detected max file descriptor number: 1024 Tue Dec 12 17:17:50 2023 - VirtualHosting mode enabled. Tue Dec 12 17:17:50 2023 - lock engine: pthread robust mutexes Tue Dec 12 17:17:50 2023 - thunder lock: disabled (you can enable it with --thunder-lock) Tue Dec 12 17:17:50 2023 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/modoboa_instance/socket fd 3 Tue Dec 12 17:17:50 2023 - setgid() to 1000 Tue Dec 12 17:17:50 2023 - setuid() to 1000 Tue Dec 12 17:17:50 2023 - Python version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] Tue Dec 12 17:17:50 2023 - PEP 405 virtualenv detected: /srv/modoboa/env Tue Dec 12 17:17:50 2023 - Set PythonHome to /srv/modoboa/env Tue Dec 12 17:17:50 2023 - *** Python threads support is disabled. You can enable it with --enable-threads *** Tue Dec 12 17:17:50 2023 - Python main interpreter initialized at 0x557d4e395fb0 Tue Dec 12 17:17:50 2023 - your server socket listen backlog is limited to 100 connections Tue Dec 12 17:17:50 2023 - your mercy for graceful operations on workers is 60 seconds Tue Dec 12 17:17:50 2023 - mapped 218808 bytes (213 KB) for 2 cores Tue Dec 12 17:17:50 2023 - *** Operational MODE: preforking *** Traceback (most recent call last): File "./instance/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/srv/modoboa/env/lib/python3.9/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/srv/modoboa/env/lib/python3.9/site-packages/modoboa_pdfcredentials/apps.py", line 13, in ready from . import handlers File "/srv/modoboa/env/lib/python3.9/site-packages/modoboa_pdfcredentials/handlers.py", line 8, in <module> from django.utils.translation import ugettext as _ ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/srv/modoboa/env/lib/python3.9/site-packages/django/utils/translation/__init__.py) Tue Dec 12 18:17:52 2023 - unable to load app 0 (mountpoint='') (callable not found or import error) ue Dec 12 18:17:52 2023 - *** no app loaded. going in full dynamic mode *** Tue Dec 12 18:17:52 2023 - spawned uWSGI master process (pid: 197462) Tue Dec 12 18:17:52 2023 - spawned uWSGI worker 1 (pid: 197474, cores: 1) Tue Dec 12 18:17:52 2023 - spawned uWSGI worker 2 (pid: 197475, cores: 1) Traceback (most recent call last): File "./instance/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/srv/modoboa/env/lib/python3.9/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 83, in populate raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant Tue Dec 12 18:19:09 2023 - unable to load app 0 (mountpoint='mail.*****.***|') (callable not found or import error) Tue Dec 12 18:19:09 2023 - --- no python application found, check your startup logs for errors --- mail.*****.*** [pid: 197475|app: -1|req: -1/1] 109.221.81.79 () {54 vars in 893 bytes} [Tue Dec 12 18:19:09 2023] GET /accounts/login/ => generated 21 bytes in 9 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
Author
Owner

@redalert99 commented on GitHub (Dec 12, 2023):

same problem here. after install can't access the webpage due to the "internal server error"....

<!-- gh-comment-id:1852583127 --> @redalert99 commented on GitHub (Dec 12, 2023): same problem here. after install can't access the webpage due to the "internal server error"....
Author
Owner

@NeitsabTeguom commented on GitHub (Dec 12, 2023):

Back to previous 2.1.0 temporarily : sudo ./run.py --version=2.1.0 mydomain.com

Next time i make a snapshot of the server before any updates!

<!-- gh-comment-id:1852586286 --> @NeitsabTeguom commented on GitHub (Dec 12, 2023): Back to previous 2.1.0 temporarily : sudo ./run.py --version=2.1.0 mydomain.com Next time i make a snapshot of the server before any updates!
Author
Owner

@Spitfireap commented on GitHub (Dec 12, 2023):

Hi @NeitsabTeguom,
It seems you are trying to perform an upgrade. Could you please check that you applied the specific upgrade instructions after your upgrade ?

As for @adrians75 and @redalert99 if it is indeed a fresh install : can you go to the modoboa-installer directory, type this command : git rev-parse HEAD and post the result ? Also can you go to /srv/modoboa/instance/instance/settings.py, set DEBUG to True then restart uwsgi (systemctl restart uwsgi) and reload the page ?

<!-- gh-comment-id:1852655289 --> @Spitfireap commented on GitHub (Dec 12, 2023): Hi @NeitsabTeguom, It seems you are trying to perform an upgrade. [Could you please check that you applied the specific upgrade instructions after your upgrade](https://modoboa.readthedocs.io/en/latest/upgrade.html#specific-instructions) ? As for @adrians75 and @redalert99 if it is indeed a fresh install : can you go to the modoboa-installer directory, type this command : `git rev-parse HEAD` and post the result ? Also can you go to `/srv/modoboa/instance/instance/settings.py`, set DEBUG to `True` then restart uwsgi (`systemctl restart uwsgi`) and reload the page ?
Author
Owner

@NeitsabTeguom commented on GitHub (Dec 12, 2023):

I do it but not work

<!-- gh-comment-id:1852765427 --> @NeitsabTeguom commented on GitHub (Dec 12, 2023): I do it but not work
Author
Owner

@Spitfireap commented on GitHub (Dec 13, 2023):

modoboa_pdfcredentials shows up in your log. Please apply the specific instruction for 2.1.0.

<!-- gh-comment-id:1854627337 --> @Spitfireap commented on GitHub (Dec 13, 2023): `modoboa_pdfcredentials` shows up in your log. Please apply the specific instruction for 2.1.0.
Author
Owner

@NeitsabTeguom commented on GitHub (Dec 13, 2023):

New log : mail.example.com replaced :

Traceback (most recent call last):
File "./instance/wsgi.py", line 16, in
application = get_wsgi_application()
File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 83, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
Wed Dec 13 22:08:18 2023 - unable to load app 0 (mountpoint='mail.example.com|') (callable not found or import error)
Wed Dec 13 22:08:18 2023 - --- no python application found, check your startup logs for errors ---
mail.example.com [pid: 1316687|app: -1|req: -1/5] 109.221.81.79 () {54 vars in 1008 bytes} [Wed Dec 13 22:08:18 2023] GET /core/ => generated 21 bytes in 3 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

<!-- gh-comment-id:1854705994 --> @NeitsabTeguom commented on GitHub (Dec 13, 2023): New log : mail.example.com replaced : Traceback (most recent call last): File "./instance/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/srv/modoboa/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/srv/modoboa/env/lib/python3.9/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/env/lib/python3.9/site-packages/django/apps/registry.py", line 83, in populate raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant Wed Dec 13 22:08:18 2023 - unable to load app 0 (mountpoint='mail.example.com|') (callable not found or import error) Wed Dec 13 22:08:18 2023 - --- no python application found, check your startup logs for errors --- mail.example.com [pid: 1316687|app: -1|req: -1/5] 109.221.81.79 () {54 vars in 1008 bytes} [Wed Dec 13 22:08:18 2023] GET /core/ => generated 21 bytes in 3 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
Author
Owner

@porrascarlos802018 commented on GitHub (Dec 20, 2023):

Having same problem here :

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = True

ALLOWED_HOSTS = [
'mail.domainwashere.com',
]
CSRF_TRUSTED_ORIGINS = ['https://*.domainwashere']

what logs file should be checked?

<!-- gh-comment-id:1864978430 --> @porrascarlos802018 commented on GitHub (Dec 20, 2023): Having same problem here : # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [ 'mail.domainwashere.com', ] CSRF_TRUSTED_ORIGINS = ['https://*.domainwashere'] what logs file should be checked?
Author
Owner

@lorenzocomotti commented on GitHub (Mar 9, 2024):

Having same problem, In my case uwsgi didn't restart.
To solve the problem, I have run systemctl restart uwsgi.service

<!-- gh-comment-id:1986986660 --> @lorenzocomotti commented on GitHub (Mar 9, 2024): Having same problem, In my case uwsgi didn't restart. To solve the problem, I have run `systemctl restart uwsgi.service`
Author
Owner

@cantrust-hosting-cooperative commented on GitHub (Apr 9, 2024):

If you are hitting this problem and you are doing an upgrade, you need to make certain you haven't missed any of the Upgrade Specific Instructions between your old version and the new.

Pay special attention to removing old extensions that have been moved into core. I had to remove modoboa_pdf_credentials and modoboa_stats from MODOBOA_APPS, because these are both replaced with new core versions. Once I did both of them the 500 errors went away.

You will have a much easier time finding the error if you enable debug mode (but do NOT leave it on in production):

cd /srv/modoboa/instance
cp settings.py settings.bak.py
sed -i -e 's/DEBUG = False/DEBUG = True/' settings.py
systemctl restart uwsgi

Then if you trigger the error you should get some clues about what is wrong, or at least which extension is responsible.
The old extensions are not compatible with the rest of the newer code, which causes the 500 errors.

Don't forget to turn off debug mode afterwards!

cd /srv/modoboa/instance
sed -i -e 's/DEBUG = True/DEBUG = False/' settings.py
systemctl restart uwsgi
<!-- gh-comment-id:2043908209 --> @cantrust-hosting-cooperative commented on GitHub (Apr 9, 2024): If you are hitting this problem and you are doing an upgrade, you need to make certain you haven't missed any of the [Upgrade Specific Instructions](https://modoboa.readthedocs.io/en/latest/upgrade.html#specific-instructions) between your old version and the new. Pay special attention to removing old extensions that have been moved into core. I had to remove _modoboa_pdf_credentials_ and _modoboa_stats_ from MODOBOA_APPS, because these are both replaced with new core versions. Once I did both of them the 500 errors went away. You will have a _much_ easier time finding the error if you enable debug mode (but do NOT leave it on in production): ``` cd /srv/modoboa/instance cp settings.py settings.bak.py sed -i -e 's/DEBUG = False/DEBUG = True/' settings.py systemctl restart uwsgi ``` Then if you trigger the error you should get some clues about what is wrong, or at least which extension is responsible. The old extensions are not compatible with the rest of the newer code, which causes the 500 errors. Don't forget to turn off debug mode afterwards! ``` cd /srv/modoboa/instance sed -i -e 's/DEBUG = True/DEBUG = False/' settings.py systemctl restart uwsgi ```
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#1771
No description provided.