Ambari installation client error reporting OSError:[Error 17] File exists

Keywords: shell sudo Python Permission denied

During Ambari's new cluster expansion process, one node installed multiple client s to report errors

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py", line 37, in <module>
    AfterInstallHook().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 219, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py", line 31, in hook
    setup_hdp_symlinks()
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py", line 49, in setup_hdp_symlinks
    hdp_select.select_all(version)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/hdp_select.py", line 122, in select_all
    Execute(command, only_if = only_if_command)
  File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 154, in __init__
    self.env.run()
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run
    self.run_action(resource, action)
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action
    provider_action()
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 238, in action_run
    tries=self.resource.tries, try_sleep=self.resource.try_sleep)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 70, in inner
    result = function(command, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 92, in checked_call
    tries=tries, try_sleep=try_sleep)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 140, in _call_wrapper
    result = _call(command, **kwargs_copy)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 291, in _call
    raise Fail(err_msg)
resource_management.core.exceptions.Fail: Execution of 'ambari-sudo.sh /usr/bin/hdp-select set all `ambari-python-wrap /usr/bin/hdp-select versions | grep ^2.3.4.7-4 | tail -1`' returned 1. Traceback (most recent call last):
  File "/usr/bin/hdp-select", line 374, in <module>
    setPackages(pkgs, args[2], options.rpm_mode)
  File "/usr/bin/hdp-select", line 273, in setPackages
    os.symlink(target + "/" + dir, linkname)
OSError: [Errno 17] File exists

Investigation found

/ There are two directories under usr/hdp, 2.3.4.7 and current, of which current is the soft connection of corresponding Jar package or file under 2.3.4.7. In the process of installing clients, I encountered a lack of client error and copied the file directly to current, resulting in the establishment of soft connection from 2.3.4.7 directory is already existing under current directory. The solution is to delete the corresponding directory and rebuild the soft connection.
During the period, permission denied failed to create Log file and pid file, and the problem was solved after manually creating and modifying permissions.

Posted by stratguitar on Sun, 10 Feb 2019 14:48:17 -0800