Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2021-05-12 06:52:59

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Problem z oprogramowaniem NetBox - pilne

Witajcie. Z linuxem mialem do tej pory niewiele do czynienia i prosze o wsparcie doswiadczonych kolegow. Otoz mam serwer na ktorym zainstalowane jest oprogramowanie NetBox (do zarzadzania adresami IP itp.). Kiedy zresetuje ta usluge lub caly serwer interfejs tego softu jest nie osiagalny. W logach syslog znalazlem to:

May 12 04:41:25 srv-netbox gunicorn[1098695]: [2021-05-12 06:41:25 +0200] [1098695] [ERROR] Error handling request /
May 12 04:41:25 srv-netbox gunicorn[1098695]: Traceback (most recent call last):
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 271, in handle
May 12 04:41:25 srv-netbox gunicorn[1098695]:     keepalive = self.handle_request(req, conn)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 320, in handle_request
May 12 04:41:25 srv-netbox gunicorn[1098695]:     respiter = self.wsgi(environ, resp.start_response)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
May 12 04:41:25 srv-netbox gunicorn[1098695]:     response = self.get_response(request)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 128, in get_response
May 12 04:41:25 srv-netbox gunicorn[1098695]:     response = self._middleware_chain(request)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
May 12 04:41:25 srv-netbox gunicorn[1098695]:     response = response_for_exception(request, exc)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 103, in response>
May 12 04:41:25 srv-netbox gunicorn[1098695]:     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 141, in handle_u>
May 12 04:41:25 srv-netbox gunicorn[1098695]:     callback, param_dict = resolver.resolve_error_handler(500)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in resolve_error_han>
May 12 04:41:25 srv-netbox gunicorn[1098695]:     callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
May 12 04:41:25 srv-netbox gunicorn[1098695]:     res = instance.__dict__[self.name] = self.func(instance)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
May 12 04:41:25 srv-netbox gunicorn[1098695]:     return import_module(self.urlconf_name)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
May 12 04:41:25 srv-netbox gunicorn[1098695]:     return _bootstrap._gcd_import(name[level:], package, level)
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap_external>", line 783, in exec_module
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/netbox/netbox/urls.py", line 9, in <module>
May 12 04:41:25 srv-netbox gunicorn[1098695]:     from netbox.views import APIRootView, HomeView, StaticMediaFailureView, SearchView
May 12 04:41:25 srv-netbox gunicorn[1098695]:   File "/opt/netbox/netbox/netbox/views.py", line 34, in <module>
May 12 04:41:25 srv-netbox gunicorn[1098695]:     from secrets.filters import SecretFilterSet
May 12 04:41:25 srv-netbox gunicorn[1098695]: ModuleNotFoundError: No module named 'secrets.filters'; 'secrets' is not a package
May 12 04:41:26 srv-netbox gunicorn[1098695]: [2021-05-12 06:41:26 +0200] [1098695] [ERROR] Error handling request /
May 12 04:41:25 srv-netbox gunicorn[1098695]: ModuleNotFoundError: No module named 'secrets.filters'; 'secrets' is not a package
May 12 04:41:26 srv-netbox gunicorn[1098695]: [2021-05-12 06:41:26 +0200] [1098695] [ERROR] Error handling request /
May 12 04:41:26 srv-netbox gunicorn[1098695]: Traceback (most recent call last):
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 271, in handle
May 12 04:41:26 srv-netbox gunicorn[1098695]:     keepalive = self.handle_request(req, conn)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 320, in handle_request
May 12 04:41:26 srv-netbox gunicorn[1098695]:     respiter = self.wsgi(environ, resp.start_response)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
May 12 04:41:26 srv-netbox gunicorn[1098695]:     response = self.get_response(request)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 128, in get_response
May 12 04:41:26 srv-netbox gunicorn[1098695]:     response = self._middleware_chain(request)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
May 12 04:41:26 srv-netbox gunicorn[1098695]:     response = response_for_exception(request, exc)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 103, in response>
May 12 04:41:26 srv-netbox gunicorn[1098695]:     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 141, in handle_u>
May 12 04:41:26 srv-netbox gunicorn[1098695]:     callback, param_dict = resolver.resolve_error_handler(500)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in resolve_error_han>
May 12 04:41:26 srv-netbox gunicorn[1098695]:     callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
May 12 04:41:26 srv-netbox gunicorn[1098695]:     res = instance.__dict__[self.name] = self.func(instance)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
May 12 04:41:26 srv-netbox gunicorn[1098695]:     return import_module(self.urlconf_name)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
May 12 04:41:26 srv-netbox gunicorn[1098695]:     return _bootstrap._gcd_import(name[level:], package, level)
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap_external>", line 783, in exec_module
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/netbox/netbox/urls.py", line 9, in <module>
May 12 04:41:26 srv-netbox gunicorn[1098695]:     from netbox.views import APIRootView, HomeView, StaticMediaFailureView, SearchView
May 12 04:41:26 srv-netbox gunicorn[1098695]:   File "/opt/netbox/netbox/netbox/views.py", line 34, in <module>
May 12 04:41:26 srv-netbox gunicorn[1098695]:     from secrets.filters import SecretFilterSet
May 12 04:41:26 srv-netbox gunicorn[1098695]: ModuleNotFoundError: No module named 'secrets.filters'; 'secrets' is not a package
May 12 04:41:26 srv-netbox gunicorn[1098696]: [2021-05-12 06:41:26 +0200] [1098696] [ERROR] Error handling request /
May 12 04:41:26 srv-netbox gunicorn[1098696]: Traceback (most recent call last):
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 271, in handle
May 12 04:41:26 srv-netbox gunicorn[1098696]:     keepalive = self.handle_request(req, conn)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 320, in handle_request
May 12 04:41:26 srv-netbox gunicorn[1098696]:     respiter = self.wsgi(environ, resp.start_response)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
May 12 04:41:26 srv-netbox gunicorn[1098696]:     response = self.get_response(request)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 128, in get_response
May 12 04:41:26 srv-netbox gunicorn[1098696]:     response = self._middleware_chain(request)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
May 12 04:41:26 srv-netbox gunicorn[1098696]:     response = response_for_exception(request, exc)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 103, in response>
May 12 04:41:26 srv-netbox gunicorn[1098696]:     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 141, in handle_u>
May 12 04:41:26 srv-netbox gunicorn[1098696]:     callback, param_dict = resolver.resolve_error_handler(500)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in resolve_error_han>
May 12 04:41:26 srv-netbox gunicorn[1098696]:     callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
May 12 04:41:26 srv-netbox gunicorn[1098696]:     res = instance.__dict__[self.name] = self.func(instance)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
May 12 04:41:26 srv-netbox gunicorn[1098696]:     return import_module(self.urlconf_name)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
May 12 04:41:26 srv-netbox gunicorn[1098696]:     return _bootstrap._gcd_import(name[level:], package, level)
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap_external>", line 783, in exec_module
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/netbox/netbox/urls.py", line 9, in <module>
May 12 04:41:26 srv-netbox gunicorn[1098696]:     from netbox.views import APIRootView, HomeView, StaticMediaFailureView, SearchView
May 12 04:41:26 srv-netbox gunicorn[1098696]:   File "/opt/netbox/netbox/netbox/views.py", line 34, in <module>
May 12 04:41:26 srv-netbox gunicorn[1098696]:     from secrets.filters import SecretFilterSet
May 12 04:41:26 srv-netbox gunicorn[1098696]: ModuleNotFoundError: No module named 'secrets.filters'; 'secrets' is not a package
May 12 04:41:28 srv-netbox gunicorn[1098693]: [2021-05-12 06:41:28 +0200] [1098693] [ERROR] Error handling request /
May 12 04:41:28 srv-netbox gunicorn[1098693]: Traceback (most recent call last):



Ja z tego rozumiem, ze brakuje jakiegos modulu python-a 'secrets.filters'. Szukajac w sieci takiego modulu nie znalazlem. Czy moglibyscie mi pomoc rozwiazac ten problem? Z gory dziekuje.

Offline

 

#2  2021-05-12 08:54:17

  urbinek - Dzban Naczelny

urbinek
Dzban Naczelny
Skąd: Sosnowiec
Zarejestrowany: 2009-10-01
Serwis

Re: Problem z oprogramowaniem NetBox - pilne

https://stackoverflow.com/questions/61547620/import-error-no-module-named-secrets-python-manage-py-not-working-after-pul napisał(-a):

The secrets module was added to Python in version 3.6. Your host is using Python 3.5, hence the secrets module is unavailable. You need a host with Python 3.6+, or a version of Django that doesn't depend on the secrets module


A w wolnym czasie, robię noże :)
http://nginx.urbinek.eu/_photos/signature.png

Offline

 

#3  2021-05-12 09:04:39

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Re: Problem z oprogramowaniem NetBox - pilne

Dzieki za wskazowke. Jakim poleceniem moge sprawdzic jaka mam zainstalowana wersje Pythona oraz Django? Jesli mam zainstalowane kilka wersji Pythona, jak moge ustalic ktora wersja jest wykorzystywana przez oprogramowanie NetBox?

Offline

 

#4  2021-05-12 09:12:34

  urbinek - Dzban Naczelny

urbinek
Dzban Naczelny
Skąd: Sosnowiec
Zarejestrowany: 2009-10-01
Serwis

Re: Problem z oprogramowaniem NetBox - pilne

Kod:

python --version
python3 -m django --version

Ostatnio edytowany przez urbinek (2021-05-12 09:21:57)


A w wolnym czasie, robię noże :)
http://nginx.urbinek.eu/_photos/signature.png

Offline

 

#5  2021-05-12 11:13:27

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Re: Problem z oprogramowaniem NetBox - pilne

Dzieki kolego. Jestes wielki. Mam teraz kolejny problem.

Oto co pokazuje syslog:
May 12 07:18:30 srv-netbox systemd[1]: Stopped NetBox WSGI Service.
May 12 07:18:30 srv-netbox systemd[1]: Started NetBox WSGI Service.
May 12 07:18:30 srv-netbox systemd[1092805]: netbox.service: Failed to execute command: No such file or directory
May 12 07:18:30 srv-netbox systemd[1092805]: netbox.service: Failed at step EXEC spawning /opt/netbox/venv/bin/gunicorn: No such file or directory
May 12 07:18:30 srv-netbox systemd[1]: netbox.service: Main process exited, code=exited, status=203/EXEC
May 12 07:18:30 srv-netbox systemd[1]: netbox.service: Failed with result 'exit-code'.
May 12 07:18:30 srv-netbox multipathd[755]: sda: add missing path
May 12 07:18:30 srv-netbox multipathd[755]: sda: failed to get udev uid: Invalid argument

Tu znalazlem fajny poradnik co zrobic w takiej sytuacji: https://stackoverflow.com/questions/40711747/failed … 5678_52912818
jednak nie wiem jak poprawnie "zedytowac" tresc tego pliku gunicorn.service - co dokladnie wpisac w poszczegolnych polach.
Chodzi mi o to, by po restarcie uslugi NetBox lub servera mozna bylo w dalszym ciagu korzystac z oprogramowania Netbox-a w przegladarce.

Offline

 

#6  2021-05-12 11:38:02

  urbinek - Dzban Naczelny

urbinek
Dzban Naczelny
Skąd: Sosnowiec
Zarejestrowany: 2009-10-01
Serwis

Re: Problem z oprogramowaniem NetBox - pilne

https://www.linode.com/docs/guides/introduction-to-systemctl napisał(-a):

sudo systemctl edit netbox.service --full

chociaż to wygląda jak błąd z netboxem a nie gunicornem,m logi mówią, ze czegos brakuje
sprwdź te ściezki

Ostatnio edytowany przez urbinek (2021-05-12 11:39:27)


A w wolnym czasie, robię noże :)
http://nginx.urbinek.eu/_photos/signature.png

Offline

 

#7  2021-05-12 13:00:59

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Re: Problem z oprogramowaniem NetBox - pilne

To pokazuje netbox.service:

root@srv-netbox:/opt/netbox/venv/bin# sudo systemctl edit netbox.service --full
  GNU nano 4.8                                        /etc/systemd/system/.#netbox.serviceea22fc4f4cae60b6
[Unit]
Description=NetBox WSGI Service
Documentation=https://netbox.readthedocs.io/en/stable/
After=network-online.target
Wants=network-online.target

[Service]
Type=simple

User=netbox_service
Group=netbox_service
PIDFile=/var/tmp/netbox.pid
WorkingDirectory=/opt/netbox

ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi
# ExecStart=/usr/local/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi

Restart=on-failure
RestartSec=30
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Offline

 

#8  2021-05-12 13:02:48

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Re: Problem z oprogramowaniem NetBox - pilne

root@srv-netbox:/opt/netbox/venv/bin# cd /opt/netbox/venv/bin/
root@srv-netbox:/opt/netbox/venv/bin# ls
activate      activate.fish  chardetect    django-admin.py  easy_install-3.8  jsonschema   netaddr  pip3    __pycache__  python3  rq      rqworker   wheel
activate.csh  Activate.ps1   django-admin  easy_install     gunicorn          markdown_py  pip


root@srv-netbox:/opt/netbox/venv/bin# nano gunicorn
  GNU nano 4.8                                                              gunicorn
#!/opt/netbox/venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(run())

Offline

 

#9  2021-05-12 13:03:27

  spilip - Użytkownik

spilip
Użytkownik
Zarejestrowany: 2021-05-12

Re: Problem z oprogramowaniem NetBox - pilne

Niby jest plik gunicorn w /opt/netbox/venv/bin: wyglada jak w poscie powyzej. Co moze byc nie tak?

Offline

 

#10  2021-05-12 14:48:34

  fnmirk - Redaktor

fnmirk
Redaktor
Zarejestrowany: 2008-02-19

Re: Problem z oprogramowaniem NetBox - pilne

Przedstaw wynik polecenia:

Kod:

update-alternatives  --get-selections | grep python

Skąd instalowałeś ten program?



PS spilip używaj znaczników bo te logi są mało czytelne. Zaawansowany edytor - opcja podgląd.

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Możesz wyłączyć AdBlock — tu nie ma reklam ;-)