Skip to content

permission error when using backups.py #3

@wisgit

Description

@wisgit

I tried backups.py for backing up the postgresql db of TandoorRecipes (Thanks to vabene1111 for providing all this to the community!).
However, I failed to restore a dump file with the command "python backups.py -l <my_config_profile>". It ended with the error message "PermissionError: [Errno 13] Permission denied: '/home/pi/tandoor/postgresql/'", which resulted from the call "shutil.rmtree(pg_data_dir, ignore_errors=False, onerror=None)" within backups.py.

I know that my dump file (and all entries in the config.ini) were OK, since I was able to restore the dump file (successfully created by "python backups.py -d <my_config_profile>" manually with the command sequence:

  • docker compose stop db_recipes
  • sudo rm -r /home/pi/tandoor/postgresql
  • docker compose up -d db_recipes
  • (wait for >2 sec)
  • docker compose exec -T db_recipes psql -U djangouser postgres < /home/pi/tandoor/dumps/.sql

I found later that I could delete the postgresql folder using 'sudo python' and then using the shutil.rmtree() routine in the interactive python mode. But when starting the script backups.py with "sudo python backups.py -l <my_config_profile>", I receive the error message "docker: 'compose' is not a docker command."

Some further remarks:
I had installed docker (in rootless mode) on a raspi 3B+ (headless, bullseye) in folder /home/pi/tandoor, where I then installed the TandoorRecipes App (following an article in a recent issue of ct magazine).
The dump part of backups.py I had to modify before it worked: I had to replace all occurences of "/usr/local/bin/docker-compose" with just "docker compose" (Note the missing '-').

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions