Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-10413

Knox gateway fails to restart on Ubuntu 12.04 after system restart using custom pid dir because /usr/hdp/current/knox-server/pids does not point to custom pid dir

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0, 2.1.0
    • 2.1.1
    • None
    • None
    • Ubuntu 12.04

    Description

      I tried setting "Knox PID dir" to /opt/run/knox (after creating this directory), but on server restart I get the error below. It seems that this is because the /usr/hdp/current/knox-server/pids symlink is pointing to the default /var/run/knox instead of the configured directory /opt/run/knox.

      I think it would be good to provide instructions for how to workaround this issue for the 2.0.0 release.

      Error log:
      stderr: /var/lib/ambari-agent/data/errors-218.txt

      2015-04-09 14:25:54,086 - Error while executing command 'start':
      Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 214, in execute
      method(env)
      File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", line 89, in thunk
      return fn(*args, **kwargs)
      File "/var/lib/ambari-agent/cache/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py", line 87, in start
      not_if=no_op_test
      File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in _init_
      self.env.run()
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 152, in run
      self.run_action(resource, action)
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 118, in run_action
      provider_action()
      File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 274, in action_run
      raise ex
      Fail: Execution of '/usr/hdp/current/knox-server/bin/gateway.sh start' returned 1. Directory /usr/hdp/current/knox-server/pids does not exist.
      stdout: /var/lib/ambari-agent/data/output-218.txt

      2015-04-09 14:25:43,357 - u"Group['hadoop']"

      {'ignore_failures': False}

      2015-04-09 14:25:43,358 - Modifying group hadoop
      2015-04-09 14:25:43,409 - u"Group['users']"

      {'ignore_failures': False}

      2015-04-09 14:25:43,409 - Modifying group users
      2015-04-09 14:25:43,453 - u"Group['knox']"

      {'ignore_failures': False}

      2015-04-09 14:25:43,453 - Modifying group knox
      2015-04-09 14:25:43,496 - u"Group['ranger']"

      {'ignore_failures': False}

      2015-04-09 14:25:43,496 - Modifying group ranger
      2015-04-09 14:25:43,539 - u"User['hive']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,539 - Modifying user hive
      2015-04-09 14:25:43,582 - u"User['oozie']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'users']}

      2015-04-09 14:25:43,583 - Modifying user oozie
      2015-04-09 14:25:43,627 - u"User['root']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,627 - Modifying user root
      2015-04-09 14:25:43,671 - u"User['ambari-qa']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'users']}

      2015-04-09 14:25:43,671 - Modifying user ambari-qa
      2015-04-09 14:25:43,714 - u"User['flume']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,714 - Modifying user flume
      2015-04-09 14:25:43,758 - u"User['hdfs']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,759 - Modifying user hdfs
      2015-04-09 14:25:43,802 - u"User['knox']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,803 - Modifying user knox
      2015-04-09 14:25:43,846 - u"User['ranger']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,846 - Modifying user ranger
      2015-04-09 14:25:43,890 - u"User['mapred']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,891 - Modifying user mapred
      2015-04-09 14:25:43,934 - u"User['tez']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'users']}

      2015-04-09 14:25:43,934 - Modifying user tez
      2015-04-09 14:25:43,979 - u"User['zookeeper']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:43,979 - Modifying user zookeeper
      2015-04-09 14:25:44,023 - u"User['rangerlogger']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,023 - Modifying user rangerlogger
      2015-04-09 14:25:44,068 - u"User['sqoop']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,068 - Modifying user sqoop
      2015-04-09 14:25:44,111 - u"User['yarn']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,111 - Modifying user yarn
      2015-04-09 14:25:44,154 - u"User['hcat']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,154 - Modifying user hcat
      2015-04-09 14:25:44,199 - u"User['ams']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,199 - Modifying user ams
      2015-04-09 14:25:44,244 - u"User['rangeradmin']"

      {'gid': 'hadoop', 'ignore_failures': False, 'groups': [u'hadoop']}

      2015-04-09 14:25:44,244 - Modifying user rangeradmin
      2015-04-09 14:25:44,289 - u"File['/var/lib/ambari-agent/data/tmp/changeUid.sh']"

      {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}

      2015-04-09 14:25:44,560 - u"Execute['/var/lib/ambari-agent/data/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa']"

      {'not_if': '(test $(id -u ambari-qa) -gt 1000) || (false)'}

      2015-04-09 14:25:44,605 - Skipping u"Execute['/var/lib/ambari-agent/data/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa']" due to not_if
      2015-04-09 14:25:44,605 - u"Group['hdfs']"

      {'ignore_failures': False}

      2015-04-09 14:25:44,605 - Modifying group hdfs
      2015-04-09 14:25:44,648 - u"User['hdfs']"

      {'ignore_failures': False, 'groups': [u'hadoop', 'hadoop', 'hdfs', u'hdfs']}

      2015-04-09 14:25:44,648 - Modifying user hdfs
      2015-04-09 14:25:44,691 - u"Directory['/etc/hadoop']"

      {'mode': 0755}

      2015-04-09 14:25:44,830 - u"Directory['/etc/hadoop/conf.empty']"

      {'owner': 'root', 'group': 'hadoop', 'recursive': True}

      2015-04-09 14:25:44,969 - u"Link['/etc/hadoop/conf']"

      {'not_if': 'ls /etc/hadoop/conf', 'to': '/etc/hadoop/conf.empty'}

      2015-04-09 14:25:45,016 - Skipping u"Link['/etc/hadoop/conf']" due to not_if
      2015-04-09 14:25:45,025 - u"File['/etc/hadoop/conf/hadoop-env.sh']"

      {'content': InlineTemplate(...), 'owner': 'hdfs', 'group': 'hadoop'}

      2015-04-09 14:25:45,260 - u"Execute['('setenforce', '0')']"

      {'sudo': True, 'only_if': 'test -f /selinux/enforce'}

      2015-04-09 14:25:45,313 - Skipping u"Execute['('setenforce', '0')']" due to only_if
      2015-04-09 14:25:45,313 - u"Directory['/var/log/hadoop']"

      {'owner': 'root', 'mode': 0775, 'group': 'hadoop', 'recursive': True, 'cd_access': 'a'}

      2015-04-09 14:25:45,711 - u"Directory['/var/run/hadoop']"

      {'owner': 'root', 'group': 'root', 'recursive': True, 'cd_access': 'a'}

      2015-04-09 14:25:45,761 - Creating directory u"Directory['/var/run/hadoop']"
      2015-04-09 14:25:45,941 - Changing group for /var/run/hadoop from 1000 to root
      2015-04-09 14:25:46,241 - u"Directory['/tmp/hadoop-hdfs']"

      {'owner': 'hdfs', 'recursive': True, 'cd_access': 'a'}

      2015-04-09 14:25:46,285 - Creating directory u"Directory['/tmp/hadoop-hdfs']"
      2015-04-09 14:25:46,474 - Changing owner for /tmp/hadoop-hdfs from 0 to hdfs
      2015-04-09 14:25:46,695 - u"File['/etc/hadoop/conf/commons-logging.properties']"

      {'content': Template('commons-logging.properties.j2'), 'owner': 'hdfs'}

      2015-04-09 14:25:46,925 - u"File['/etc/hadoop/conf/health_check']"

      {'content': Template('health_check-v2.j2'), 'owner': 'hdfs'}

      2015-04-09 14:25:47,158 - u"File['/etc/hadoop/conf/log4j.properties']"

      {'content': '...', 'owner': 'hdfs', 'group': 'hadoop', 'mode': 0644}

      2015-04-09 14:25:47,394 - u"File['/etc/hadoop/conf/hadoop-metrics2.properties']"

      {'content': Template('hadoop-metrics2.properties.j2'), 'owner': 'hdfs'}

      2015-04-09 14:25:47,628 - u"File['/etc/hadoop/conf/task-log4j.properties']"

      {'content': StaticFile('task-log4j.properties'), 'mode': 0755}

      2015-04-09 14:25:48,021 - u"Directory['/etc/knox/conf']"

      {'owner': 'knox', 'group': 'knox', 'recursive': True}

      2015-04-09 14:25:48,170 - u"XmlConfig['gateway-site.xml']" {'owner': 'knox', 'group': 'knox', 'conf_dir': '/etc/knox/conf', 'configuration_attributes': {}, 'configurations': ...}
      2015-04-09 14:25:48,179 - Generating config: /etc/knox/conf/gateway-site.xml
      2015-04-09 14:25:48,180 - u"File['/etc/knox/conf/gateway-site.xml']"

      {'owner': 'knox', 'content': InlineTemplate(...), 'group': 'knox', 'mode': None, 'encoding': 'UTF-8'}

      2015-04-09 14:25:48,359 - Writing u"File['/etc/knox/conf/gateway-site.xml']" because contents don't match
      2015-04-09 14:25:48,502 - u"File['/etc/knox/conf/gateway-log4j.properties']"

      {'content': '...', 'owner': 'knox', 'group': 'knox', 'mode': 0644}

      2015-04-09 14:25:48,731 - u"File['/etc/knox/conf/topologies/default.xml']"

      {'content': InlineTemplate(...), 'owner': 'knox', 'group': 'knox'}

      2015-04-09 14:25:48,956 - u"Execute['('chown', '-R', u'knox:knox', '/var/lib/knox/data', '/var/log/knox', '/var/log/knox', u'/opt/run/knox', '/etc/knox/conf')']"

      {'sudo': True}

      2015-04-09 14:25:48,999 - u"Execute['/usr/hdp/current/knox-server/bin/knoxcli.sh create-master --master [PROTECTED]']" {'environment':

      {'JAVA_HOME': u'/usr/lib/jvm/java-7-oracle'}

      , 'not_if': "ambari-sudo.sh su knox -l -s /bin/bash -c 'test -f /var/lib/knox/data/security/master'", 'user': 'knox'}
      2015-04-09 14:25:49,042 - Skipping u"Execute['/usr/hdp/current/knox-server/bin/knoxcli.sh create-master --master [PROTECTED]']" due to not_if
      2015-04-09 14:25:49,042 - u"Execute['/usr/hdp/current/knox-server/bin/knoxcli.sh create-cert --hostname master.local.cloud']" {'environment':

      {'JAVA_HOME': u'/usr/lib/jvm/java-7-oracle'}

      , 'not_if': "ambari-sudo.sh su knox -l -s /bin/bash -c 'test -f /var/lib/knox/data/security/keystores/gateway.jks'", 'user': 'knox'}
      2015-04-09 14:25:49,085 - Skipping u"Execute['/usr/hdp/current/knox-server/bin/knoxcli.sh create-cert --hostname master.local.cloud']" due to not_if
      2015-04-09 14:25:49,085 - u"File['/etc/knox/conf/ldap-log4j.properties']"

      {'content': '...', 'owner': 'knox', 'group': 'knox', 'mode': 0644}

      2015-04-09 14:25:49,316 - u"File['/etc/knox/conf/users.ldif']"

      {'content': '...', 'owner': 'knox', 'group': 'knox', 'mode': 0644}

      2015-04-09 14:25:49,545 - u"File['/var/lib/ambari-agent/data/tmp/mysql-connector-java.jar']"

      {'content': DownloadSource('http://master.local.cloud:8080/resources//mysql-jdbc-driver.jar')}

      2015-04-09 14:25:49,640 - Not downloading the file from http://master.local.cloud:8080/resources//mysql-jdbc-driver.jar, because /var/lib/ambari-agent/data/tmp/mysql-jdbc-driver.jar already exists
      2015-04-09 14:25:49,786 - call['hdp-select status knox-server']

      {'timeout': 20}

      2015-04-09 14:25:50,318 - amb_ranger_admin user already exists, using existing user from configurations.
      2015-04-09 14:25:50,531 - Knox Repository exist
      2015-04-09 14:25:50,532 - u"Execute['cd /usr/hdp/2.2.0.0-2041/ranger-knox-plugin/ && sh enable-knox-plugin.sh']" {'logoutput': True, 'environment': {'JAVA_HOME': u'/usr/lib/jvm/java-7-oracle'}}
      enable-knox-plugin.sh: 37: [: /usr/lib/jvm/java-7-oracle: unexpected operator
      + Thu Apr 9 14:25:50 UTC 2015 : Saving /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-audit.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-audit.xml.20150409-142550 ...
      + Thu Apr 9 14:25:50 UTC 2015 : Saving /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-knox-security.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-knox-security.xml.20150409-142550 ...
      + Thu Apr 9 14:25:50 UTC 2015 : Saving /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-policymgr-ssl.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-policymgr-ssl.xml.20150409-142550 ...
      + Thu Apr 9 14:25:50 UTC 2015 : Saving current config file: /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-audit.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-audit.xml.20150409-142550 ...
      + Thu Apr 9 14:25:50 UTC 2015 : Saving current config file: /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-knox-security.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-knox-security.xml.20150409-142550 ...
      + Thu Apr 9 14:25:51 UTC 2015 : Saving current config file: /usr/hdp/2.2.0.0-2041/knox/conf/xasecure-policymgr-ssl.xml to /usr/hdp/2.2.0.0-2041/knox/conf/.xasecure-policymgr-ssl.xml.20150409-142550 ...
      + Thu Apr 9 14:25:51 UTC 2015 : Saving current JCE file: /etc/ranger/local_cloud_knox/cred.jceks to /etc/ranger/local_cloud_knox/.cred.jceks.20150409142551 ...
      + Thu Apr 9 14:25:52 UTC 2015 : Saving current JCE file: /etc/ranger/local_cloud_knox/cred.jceks to /etc/ranger/local_cloud_knox/.cred.jceks.20150409142552 ...
      + Thu Apr 9 14:25:53 UTC 2015 : Saving current JCE file: /etc/ranger/local_cloud_knox/cred.jceks to /etc/ranger/local_cloud_knox/.cred.jceks.20150409142553 ...
      backup of /usr/hdp/2.2.0.0-2041/knox/conf/topologies/admin.xml to /usr/hdp/2.2.0.0-2041/knox/conf/topologies/.admin.xml.20150409142553 ...
      Updating topology file: [/usr/hdp/2.2.0.0-2041/knox/conf/topologies/admin.xml] ...
      backup of /usr/hdp/2.2.0.0-2041/knox/conf/topologies/default.xml to /usr/hdp/2.2.0.0-2041/knox/conf/topologies/.default.xml.20150409142553 ...
      Updating topology file: [/usr/hdp/2.2.0.0-2041/knox/conf/topologies/default.xml] ...
      Ranger Plugin for knox has been enabled. Please restart knox to ensure that changes are effective.
      2015-04-09 14:25:53,977 - u"Execute['/usr/hdp/current/knox-server/bin/gateway.sh start']" {'environment':

      {'JAVA_HOME': u'/usr/lib/jvm/java-7-oracle'}

      , 'not_if': 'ls /opt/run/knox/gateway.pid >/dev/null 2>&1 && ps -p `cat /opt/run/knox/gateway.pid` >/dev/null 2>&1', 'user': 'knox'}
      2015-04-09 14:25:54,086 - Error while executing command 'start':
      Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 214, in execute
      method(env)
      File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", line 89, in thunk
      return fn(*args, **kwargs)
      File "/var/lib/ambari-agent/cache/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py", line 87, in start
      not_if=no_op_test
      File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in _init_
      self.env.run()
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 152, in run
      self.run_action(resource, action)
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 118, in run_action
      provider_action()
      File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 274, in action_run
      raise ex
      Fail: Execution of '/usr/hdp/current/knox-server/bin/gateway.sh start' returned 1. Directory /usr/hdp/current/knox-server/pids does not exist.
      2015-04-09 14:25:54,130 - Command: /usr/bin/hdp-select status knox-server > /tmp/tmpxP9LJS
      Output: knox-server - 2.2.0.0-2041

      Attachments

        Issue Links

          Activity

            People

              aonishuk Andrew Onischuk
              dmcwhorter David McWhorter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: