Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

Solved Go to solution

Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

Guru

Note: This is in sandbox.

Simple workflow:

  • log into Ranger
  • navigate to Ranger service (Ranger Admin, Ranger Usersync, Ranger Tagsyncs are all running)
  • navigate to configs
  • click "Test Connections
  • Result: Connection failed

stderr says:

/usr/bin/python: can't open file '/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py': [Errno 2] No such file or directory

When I ssh into the ranger host (sandbox) as root, and run ls -l /var/lib/ambari-agent/cache/custom_actions/scripts/ I get the following result (be sure to scroll to bottom):

ls: cannot access scripts/check_host.py: No such file or directory
ls: cannot access scripts/check_host.pyo: No such file or directory
ls: cannot access scripts/clear_repocache.py: No such file or directory
ls: cannot access scripts/clear_repocache.pyo: No such file or directory
ls: cannot access scripts/install_packages.py: No such file or directory
ls: cannot access scripts/install_packages.pyo: No such file or directory
ls: cannot access scripts/remove_bits.py: No such file or directory
ls: cannot access scripts/remove_bits.pyo: No such file or directory
ls: cannot access scripts/ru_execute_tasks.py: No such file or directory
ls: cannot access scripts/ru_execute_tasks.pyo: No such file or directory
ls: cannot access scripts/ru_set_all.py: No such file or directory
ls: cannot access scripts/ru_set_all.pyo: No such file or directory
ls: cannot access scripts/update_repo.py: No such file or directory
ls: cannot access scripts/update_repo.pyo: No such file or directory
ls: cannot access scripts/validate_configs.py: No such file or directory
ls: cannot access scripts/validate_configs.pyo: No such file or directory
total 0
?????????? ? ? ? ?            ? check_host.py
?????????? ? ? ? ?            ? check_host.pyo
?????????? ? ? ? ?            ? clear_repocache.py
?????????? ? ? ? ?            ? clear_repocache.pyo
?????????? ? ? ? ?            ? install_packages.py
?????????? ? ? ? ?            ? install_packages.pyo
?????????? ? ? ? ?            ? remove_bits.py
?????????? ? ? ? ?            ? remove_bits.pyo
?????????? ? ? ? ?            ? ru_execute_tasks.py
?????????? ? ? ? ?            ? ru_execute_tasks.pyo
?????????? ? ? ? ?            ? ru_set_all.py
?????????? ? ? ? ?            ? ru_set_all.pyo
?????????? ? ? ? ?            ? update_repo.py
?????????? ? ? ? ?            ? update_repo.pyo
?????????? ? ? ? ?            ? validate_configs.py
?????????? ? ? ? ?            ? validate_configs.pyo

Any idea what is going on?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

@gkeys

Looks like the permissions of this directory "/var/lib/ambari-agent/cache/custom_actions/scripts/" is messed up. From the output it seems like scripts directory is not given execute permissions(which is needed for all directories).

To view permissions on that directory, just execute

ls -ld /var/lib/ambari-agent/cache/custom_actions/scripts/

To set the read permission on files and the read and execute permissions on directories recursively, use this command:

chmod -R a+rX /var/lib/ambari-agent/cache/custom_actions/scripts/

Here's an explanation of that command:

  • chmod is the name of the command, use for changing the permissions of files.
  • -R is the recursive flag. It means apply this command to the directory, and all of its children, and of its children's children, and so on.
  • a stands for all: apply these permissions the owner of the file, the group owner of the file, and all other users.
  • + means add the following permissions if they aren't set already.
  • r means the read permission.
  • X means the execute permission, but only on directories. Lower-case x would mean the execute permission on both files and directories.

More information is found in the manpage for the chmod command

With the above steps executed, you should be able to test the ranger DB connection. Hope this will solve the issue.

6 REPLIES 6

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

@gkeys

Looks like the permissions of this directory "/var/lib/ambari-agent/cache/custom_actions/scripts/" is messed up. From the output it seems like scripts directory is not given execute permissions(which is needed for all directories).

To view permissions on that directory, just execute

ls -ld /var/lib/ambari-agent/cache/custom_actions/scripts/

To set the read permission on files and the read and execute permissions on directories recursively, use this command:

chmod -R a+rX /var/lib/ambari-agent/cache/custom_actions/scripts/

Here's an explanation of that command:

  • chmod is the name of the command, use for changing the permissions of files.
  • -R is the recursive flag. It means apply this command to the directory, and all of its children, and of its children's children, and so on.
  • a stands for all: apply these permissions the owner of the file, the group owner of the file, and all other users.
  • + means add the following permissions if they aren't set already.
  • r means the read permission.
  • X means the execute permission, but only on directories. Lower-case x would mean the execute permission on both files and directories.

More information is found in the manpage for the chmod command

With the above steps executed, you should be able to test the ranger DB connection. Hope this will solve the issue.

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

Guru

Yes, I tried these .. should have put in description

[root@sandbox ~]# ls -ld /var/lib/ambari-agent/cache/custom_actions/scripts/
drwxrwxrwx 1 root root 4096 Sep 22 18:55 /var/lib/ambari-agent/cache/custom_actions/scripts/
[root@sandbox ~]# chmod -R a+rX /var/lib/ambari-agent/cache/custom_actions/scripts/
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/clear_repocache.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/clear_repocache.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/install_packages.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/install_packages.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/remove_bits.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/remove_bits.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/ru_execute_tasks.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/ru_execute_tasks.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/ru_set_all.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/ru_set_all.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/update_repo.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/update_repo.pyo': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/validate_configs.py': No such file or directory
chmod: cannot access `/var/lib/ambari-agent/cache/custom_actions/scripts/validate_configs.pyo': No such file or directory

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

@Greg Keys Looks like your VM has gone bad. Similar issue is faced by @Vasilis Vagias couple of days back, he pulled the latest VM snapshot and everything is working fine for him. Please try the same over the latest VM snapshot and let me know if it works for you.

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

Guru

Hmm. Interesting. Downloaded latest version of sandbox 2.5 GA and now there simply are no contents

[root@sandbox scripts]# ls -l /var/lib/ambari-agent/cache/custom_actions/scripts/
total 0
[root@sandbox scripts]# sandbox-version
Sandbox information:
Created on: 13_09_2016_11_17_36 for
Hadoop stack version:  Hadoop 2.7.3.2.5.0.0-1245
Ambari Version: 2.4.0.0-1225
Ambari Hash: 59175b7aa1ddb74b85551c632e3ce42fed8f0c85
Ambari build:  Release : 1225
Java version:  1.8.0_101
OS Version:  CentOS release 6.8 (Final)

I will contact sandbox SMEs to communicate issue.

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

New Contributor

I have the same problem....

/var/lib/ambari-agent/cache/custom_actions/scripts/

exists but it is empty!!

Re: Ranger MySql connection error: check_host.py no such file -- but it is there (sort of)

New Contributor

I also faced same issue. The issue was that I was running in Google Cloud Engine.But inside a Docker installed on Google VM, we cannot delete the files. If we try to delete the file, the file is like a symbolic link and is not deleted.

Use Google Optimzed OS for Docker VM (Note this VM is not fully open and has only Toolbox available, I was not able to install Docker-Compose through this)