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

Failure when creating superuser #1152

Closed
nicolocarissimi opened this issue Feb 17, 2020 · 9 comments
Closed

Failure when creating superuser #1152

nicolocarissimi opened this issue Feb 17, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@nicolocarissimi
Copy link

While executing command

docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'

I get this error

Traceback (most recent call last):
File "/home/django/manage.py", line 21, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 61, in execute
return super().execute(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 584, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 577, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/django/cvat/urls.py", line 28, in
path('', include('cvat.apps.engine.urls')),
File "/usr/local/lib/python3.5/dist-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/django/cvat/apps/engine/urls.py", line 7, in
from . import views
File "/home/django/cvat/apps/engine/views.py", line 50, in
import cvat.apps.dataset_manager.task as DatumaroTask
File "/home/django/cvat/apps/dataset_manager/task.py", line 24, in
from datumaro.components.project import Project, Environment
File "/home/django/datumaro/datumaro/components/project.py", line 8, in
import git
File "/usr/local/lib/python3.5/dist-packages/git/init.py", line 38, in
from git.exc import * # @nomove @IgnorePep8
File "/usr/local/lib/python3.5/dist-packages/git/exc.py", line 9, in
from git.compat import UnicodeMixin, safe_decode, string_types
File "/usr/local/lib/python3.5/dist-packages/git/compat.py", line 16, in
from gitdb.utils.compat import (
ImportError: No module named 'gitdb.utils.compat'

@azhavoro
Copy link
Contributor

Should be fixed by #1146

@nicolocarissimi
Copy link
Author

Thanks, I will give it a try

@nicolocarissimi
Copy link
Author

Nope, still not working

Traceback (most recent call last):

File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.5/dist-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "cvat_db" to address: Temporary failure in name resolution

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/django/manage.py", line 21, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 61, in execute
return super().execute(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 363, in execute
self.check_migrations()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 453, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 49, in init
self.build_graph()
File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 212, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/recorder.py", line 73, in applied_migrations
if self.has_table():
File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/recorder.py", line 56, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 256, in cursor
return self._cursor()
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 233, in _cursor
self.ensure_connection()
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.5/dist-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name "cvat_db" to address: Temporary failure in name resolution

@azhavoro
Copy link
Contributor

@nicolocarissimi, looks like another issue, could you please attach output from docker ps -a?

@nicolocarissimi
Copy link
Author

@azhavoro, you are right, it's a different issue.
Here's the output from docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3fd037835add nginx "nginx -g 'daemon of…" 16 hours ago Up 16 hours 0.0.0.0:7080->80/tcp cvat_ui
0de971f3ca4c cvat "/usr/bin/supervisord" 16 hours ago Up 16 hours 0.0.0.0:8080->8080/tcp, 8443/tcp cvat
171ba6ce9f52 postgres:10-alpine "docker-entrypoint.s…" 16 hours ago Restarting (1) About a minute ago cvat_db
12b04e0a3c33 redis:4.0-alpine "docker-entrypoint.s…" 16 hours ago Up 16 hours 6379/tcp cvat_redis

It seems cvat_db keeps restarting.

@azhavoro
Copy link
Contributor

Thanks, your issue is #1145, we will fix it soon.

@azhavoro azhavoro added the bug Something isn't working label Feb 18, 2020
@nicolocarissimi
Copy link
Author

Thanks, #1145 solved my problem. I'm closing this one.

@smerkousdavid
Copy link

smerkousdavid commented Aug 6, 2021

I'm not sure if this is a separate issue or not, but I tried the 'trust' fix and it still didn't solve it. I get a similar error and my postgress container keeps restarting. Except for permission issues when looking at docker logs cvat_db

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2021-08-06 18:18:11.318 UTC [32] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok



PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-08-06 18:18:12.884 UTC [1] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
2021-08-06 18:18:12.884 UTC [1] HINT:  The server must be started by the user that owns the data directory.

PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-08-06 18:18:13.769 UTC [1] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
2021-08-06 18:18:13.769 UTC [1] HINT:  The server must be started by the user that owns the data directory.

PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-08-06 18:18:14.822 UTC [1] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
2021-08-06 18:18:14.822 UTC [1] HINT:  The server must be started by the user that owns the data directory.

On repeat with each reboot. I'm not sure what the right perms are for it in the container. I assume it's not an external dir. I'm quite new to docker

@smerkousdavid
Copy link

It seems like when looking at other issues like here that it's an issue with mounting windows volumes. I assume that refers to NTFS volumes, and even though I'm running arch I have an NTFS volume mounted for my docker data-root. This might be the issue because as soon as I switched my data-root back to my ext4 drive it worked fine.

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

3 participants