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

[Errno 2] No such file or directory #272

Open
tarasinf opened this issue Dec 8, 2017 · 4 comments
Open

[Errno 2] No such file or directory #272

tarasinf opened this issue Dec 8, 2017 · 4 comments

Comments

@tarasinf
Copy link

tarasinf commented Dec 8, 2017

Run python manage.py dbbackup, get error: [Errno 2] No such file or directory, traceback:

Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/dbbackup/utils.py", line 116, in wrapper
    func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/dbbackup/management/commands/dbbackup.py", line 61, in handle
    self._save_new_backup(database)
  File "/usr/lib/python2.7/site-packages/dbbackup/management/commands/dbbackup.py", line 74, in _save_new_backup
    outputfile = self.connector.create_dump()
  File "/usr/lib/python2.7/site-packages/dbbackup/db/base.py", line 76, in create_dump
    dump = self._create_dump()
  File "/usr/lib/python2.7/site-packages/dbbackup/db/postgresql.py", line 37, in _create_dump
    stdout, stderr = self.run_command(cmd, env=self.dump_env)
  File "/usr/lib/python2.7/site-packages/dbbackup/db/postgresql.py", line 21, in run_command
    return super(PgDumpConnector, self).run_command(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/dbbackup/db/base.py", line 150, in run_command
    "Error running: {}\n{}".format(command, str(err)))
dbbackup.db.exceptions.CommandConnectorError: Error running:  pg_dump gdi --host=localhost --port=5432 --username=gdi --no-password --clean

Under docker compose.
Django: 1.11.7
django-dbbackup: 3.2.0
djangorestframework: 3.7.1

@ZuluPro
Copy link
Contributor

ZuluPro commented Dec 16, 2017

Are you sure pg_dump is installed ?

@evvrivas
Copy link

evvrivas commented Jul 5, 2018

hello, Estoy usando openshift 3, como hago para crear un backup de la base de datos en mi maquina local windows, y como lo restauro

@iAnanich
Copy link

iAnanich commented Sep 3, 2020

pg_dump requirement should be listed on "Installation" section of ReadTheDocs

@banagale
Copy link

banagale commented Sep 18, 2020

I also encountered this after attempting to run using django inside a dockerized container of alpine linux. 

As far as I can tell, Alpine's minimum  postgres dependency for psycopg2  is postgres-dev, however you must also apk install postgres-client to make pg_dump available on that machine.

Once you've done this, you're able to run ./manage.py dbbackup just fine.

A few more notes and links here. I agree with @iAnanich about considering adding a note about this in the docs.

@jonathan-s jonathan-s added docs and removed backup labels Sep 19, 2020
trey added a commit to piepworks/cassettenest that referenced this issue Nov 3, 2021
Let’s hope this makes it so we can again have locally-verifiable
production backups. 😅

Overall, not-so-helpful instructions:
https://django-dbbackup.readthedocs.io/en/master/installation.html

This did it:
postgresql - Running psql command from a docker container:
https://stackoverflow.com/a/63884911

This stuff pointed me in the right direction:

jazzband/django-dbbackup#272 (comment)

jazzband/django-dbbackup#197 (comment)

Other helpful stuff:

https://linuxize.com/post/how-to-check-linux-version/

https://docs.docker.com/engine/reference/builder/#run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants