You are great. You have saved my system. Thank you so much!
What I just saw after using your rollback script is that CSF released a new version 5 days ago
Now I wonder if the problem has been fixed in it? Does anyone know?
You are great. You have saved my system. Thank you so much!
What I just saw after using your rollback script is that CSF released a new version 5 days ago
Now I wonder if the problem has been fixed in it? Does anyone know?
I have different CyberPanel Server based obn Ubunto20.04LTS and Ubuntu22.04LTS
It seems your Rollback-Script only works on Ubuntu20.04LTS based installs of Cyberpanel. It dosen´t work ob Ubuntu22.04LTS based Cyberpanel machines. After the rollback the Error 500 is back
Ok. So for Ubuntu 22.04 Cyberpanel v2.3.5 Iâm getting 500 error.
I pinpointed the error:
Traceback (most recent call last):
File "/usr/local/CyberCP/CyberCP/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/CyberCP/CyberCP/settings.py", line 14, in <module>
from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/local/CyberCP/lib/python3.10/site-packages/django/utils/translation/__init__.py)
2024-09-03 20:01:22.569851 [UID:1001][1888163] packetLen < 0
ugettext_lazy
is deprecated.
As stated before, this doesnât seem so much of CSF issue as it is Django package version mismatch within CyberCP (control panel itself).
I donât think thatâs an issue particular with Ubuntu 22.
I was checking yesterday with @dcupertino and he also got that issue on Almalinux 9 but was able to solve it.
Check to make sure django is on 3.1.3
python -m django --version
Run the following:
pip install --upgrade pip
pip install --upgrade packaging setuptools
pip install Django==3.1.3
pip install -r /usr/local/CyberCP/requirments.txt --force-reinstall
find /usr/local/CyberCP/ -type d -name __pycache__ -exec rm -r {} \+; service lscpd restart && service lsws restart; killall lsphp
After check to see if that fixes the panel. If not upgrade Django and upgrade Cyberpanel to 2.3.5
pip install --upgrade django
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)
After the upgrade, you should be back up to 2.3.5 with No CSF.
Rerun my script and then follow the steps to uninstall and reinstall CSF then restore your CSF config backup.
Double, triple-checked everything:
3.1.3
versionHere is the error (that previously also occurred):
File "/usr/local/CyberCP/CyberCP/wsgi.py", line 17, in <module>
application = get_wsgi_application()
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/apps/registry.py", line 83, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
2024-09-03 17:35:51.264906 [UID:1001][1929473] packetLen < 0
Basically what this issue means is that Djangoâs app registry is being populated more than once.
So this is a good news. Now for the sake of finding out what is the real reason for this - I changed in django/apps/registry.py
:
raise RuntimeError("populate() isn't reentrant")
to
self.app_configs = {}
to allow Django continue loading.
Now 500 error disapeared and I tried to install CSF again and got this error during installation:
local variable 'cPort' referenced before assignment [404]Downloading CSF..
Checking out stderr.log
i got that module signals
is missing:
Traceback (most recent call last):
File "/usr/local/CyberCP/CyberCP/wsgi.py", line 17, in <module>
application = get_wsgi_application()
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
app_config.ready()
File "/usr/local/CyberCP/configservercsf/apps.py", line 10, in ready
import signals
ModuleNotFoundError: No module named 'signals'
2024-09-03 17:52:20.291332 [UID:1001][1972596] packetLen < 0
Continuing investigating⌠Update coming soonâŚ
[UPDATE]
So the issue lies within /usr/local/CyberCP/configservcsf/
as suspected.
I installed signals
and after restart got this error:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/utils/deprecation.py", line 134, in __call__
response = response or self.get_response(request)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 57, in inner
response = response_for_exception(request, exc)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
response = handle_uncaught_exception(
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 184, in handle_uncaught_exception
callback = resolver.resolve_error_handler(500)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/urls/resolvers.py", line 729, in resolve_error_handler
callback = getattr(self.urlconf_module, "handler%s" % view_type, None)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/CyberCP/CyberCP/urls.py", line 40, in <module>
url(r'^configservercsf/',include('configservercsf.urls')),
NameError: name 'url' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 124, in __call__
response = self.get_response(request)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/base.py", line 140, in get_response
response = self._middleware_chain(request)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 57, in inner
response = response_for_exception(request, exc)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
response = handle_uncaught_exception(
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/core/handlers/exception.py", line 184, in handle_uncaught_exception
callback = resolver.resolve_error_handler(500)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/urls/resolvers.py", line 729, in resolve_error_handler
callback = getattr(self.urlconf_module, "handler%s" % view_type, None)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/CyberCP/CyberCP/urls.py", line 40, in <module>
url(r'^configservercsf/',include('configservercsf.urls')),
NameError: name 'url' is not define
I suspect its configuration issue from CyberCP side. Iâm not confident in messing around CyberCP and configservcsf urls.py
atm, so Iâll take a break, look around and maybe continue once I figure out why CSF installation doesnât provide correct URLs or why CyberCP doesnât load csf correctly.
Thatâs it from me now. Hope somebody will have better luck debugging this.
Again, Thanks @sajetek_developer for your effort.
Edit /usr/local/CyberCP/CyberCP/settings.py and remove the line that contains âconfigservcsfâ
restart lscpd and that will fix the âRuntimeError: populate() isnât reentrantâ error
From there your panel should load
Welp, yeah - getting same error:
File "/usr/local/CyberCP/CyberCP/urls.py", line 40, in <module>
url(r'^configservercsf/',include('configservercsf.urls')),
NameError: name 'url' is not defined
I tried to rerun everything also with /usr/local/CyberCP/bin/pip
and /usr/local/CyberCP/bin/python
but I get the same error.
Please redownload the script as there was an update.
Thanks to @richardevcom for helping resolve the issue on Ubuntu 22
Thank you @sajetek_developer
Whoever is still searching for solution, here is the updated one (works on Ubuntu 22.04
as well): https://sajetekengineering.com/blog-article/how-to-re-enable-csf-firewall-on-cyberpanel/
Hello, thank you very much for your help. With the latest version of your script I was able to successfully rollback Cyberpanel and reinstall CSF on my Ubuntu22.04LTS based systems.
Thank you very much !!!
I have another problem and Iâm not sure if itâs related. In any case, my ImunifyAV is no longer working. I can still call it up and log in and also start a manual scan, but it scans NOTHING, as you can see from the fact that there is always a 0 in the âTotal Objects Scannedâ:
Even a new installation does not help.
I see this error in the system services. This aibolit-resident.socket probably has something to do with Imunify. Does anyone have an idea about this?
Definitely not related. Please create another topic regarding this.