ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.05k stars 3.42k forks source link

PermissionError: [Errno 13] Permission denied: '/var/lib/awx/projects #10908

Open janviudapi opened 3 years ago

janviudapi commented 3 years ago

Please confirm the following

Summary

While running job on AWX for the first time, I am facing below error.

Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1316, in run
    self.pre_run_hook(self.instance, private_data_dir)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1826, in pre_run_hook
    RunProjectUpdate.make_local_copy(job.project, private_data_dir, scm_revision=job_revision)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2233, in make_local_copy
    source_branch = git_repo.create_head(tmp_branch_name, p.scm_revision)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/repo/base.py", line 386, in create_head
    return Head.create(self, path, commit, force, logmsg)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 543, in create
    return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 510, in _create
    ref.set_reference(target, logmsg)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 326, in set_reference
    assure_directory_exists(fpath, is_file=True)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/util.py", line 177, in assure_directory_exists
    os.makedirs(path, exist_ok=True)
  File "/usr/lib64/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/lib/awx/projects/_8__vcloud_lab_projects/.git/refs/heads/awx_internal'

AWX version:


< AWX 19.3.0 >


      \
      \   ^__^
          (oo)\_______
          (__)      A )\
              ||----w |
              ||     ||

AWX version

19.3.0

Installation method

minikube

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

Chrome

Steps to reproduce

On the newly deployed AWX I created new template and launched it but getting the error.

Expected results

ping result

Actual results

Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1316, in run self.pre_run_hook(self.instance, private_data_dir) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1826, in pre_run_hook RunProjectUpdate.make_local_copy(job.project, private_data_dir, scm_revision=job_revision) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2233, in make_local_copy source_branch = git_repo.create_head(tmp_branch_name, p.scm_revision) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/repo/base.py", line 386, in create_head return Head.create(self, path, commit, force, logmsg) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 543, in create return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 510, in _create ref.set_reference(target, logmsg) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/refs/symbolic.py", line 326, in set_reference assure_directory_exists(fpath, is_file=True) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/git/util.py", line 177, in assure_directory_exists os.makedirs(path, exist_ok=True) File "/usr/lib64/python3.8/os.py", line 223, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/var/lib/awx/projects/_8__vcloud_lab_projects/.git/refs/heads/awx_internal'

Additional information

No response

shanemcd commented 3 years ago

Hi - for a very brief period of time a broken version of awx-ee was on quay.io. This looks like that. Can you please make sure you are using the most up-to-date version of the image and report back?

janviudapi commented 3 years ago

Is there latest version of AWX available greater than 19.3.0, As you can see the provided version I am using the same version and I guess it is the latest once.

binarydesu commented 3 years ago

after following this tutorial (awx on a k3s cluster) and fixing the postgres-0 CrashLoopBackOff with this solution, kubectl logs -f awx-xxxxx-xxxxxx -c awx-web gives a similar error message. All on a fresh ubuntu server 20.04 install.

(1:70)# kubectl logs -f pods/awx-66c64f8d67-fpw5g -c awx-web [wait-for-migrations] Waiting for database migrations... [wait-for-migrations] Attempt 1 of 30 Traceback (most recent call last): File "/usr/bin/awx-manage", line 8, in sys.exit(manage()) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/init.py", line 171, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, *cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(args, **options) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 188, in handle collected = self.collect() File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect handler(path, prefixed_path, storage) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 352, in copy_file self.storage.save(prefixed_path, source_file) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/files/storage.py", line 52, in save return self._save(name, content) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/files/storage.py", line 242, in _save os.makedirs(directory) File "/usr/lib64/python3.8/os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) File "/usr/lib64/python3.8/os.py", line 223, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/var/lib/awx/public/static'

ho11ub commented 3 years ago

Hello, I was facing similar issue (my own installation) and fixed by changing rights to 777 on /var/lib/rancher/k3s/storage/* , as is mentioned here: https://computingforgeeks.com/install-and-configure-ansible-awx-on-centos/

binarydesu commented 3 years ago

Hello, I was facing similar issue (my own installation) and fixed by changing rights to 777 on /var/lib/rancher/k3s/storage/* , as is mentioned here: https://computingforgeeks.com/install-and-configure-ansible-awx-on-centos/

that fixed it for me, thanks!

rust84 commented 3 years ago

Just had the same issue. AWS is deployed in EKS using the AWX Operator and after setting the Control plane image to awx-ee:0.6.0 the project in the/var/lib/awx/projects directory became owned by root.

Even if you chmod 777 the directory it will be changed back on the next sync. I've since changed the awx-ee control plane image to the 'latest' tag and now the files are owned by 'runner' rather than root and everything is working. Hoping there will be a new awx-ee tag pushed soon with the fix for this so we can go back to using a fixed tag.