Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch plugins: "Failed to resolve config path" error

I install elasticsearch 1.7.3 on debian jessie. It uses default config files and works normally. But when i call sudo /usr/share/elasticsearch/bin/plugin it returns an error:

Exception in thread "main" org.elasticsearch.env.FailedToResolveConfigException: Failed to resolve config path ["/usr/share/elasticsearch/config/elasticsearch.yml"], tried file path ["/usr/share/elasticsearch/config/elasticsearch.yml"], path file ["/usr/share/elasticsearch/config"/"/usr/share/elasticsearch/config/elasticsearch.yml"], and classpath
        at org.elasticsearch.env.Environment.resolveConfig(Environment.java:291)
        at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:95)
        at org.elasticsearch.plugins.PluginManager.main(PluginManager.java:396)

File /usr/share/elasticsearch/config/elasticsearch.yml is exists and i can open him in nano.

There is /etc/default/elasticsearch file:

# Start Elasticsearch automatically
START_DAEMON=true

# Run Elasticsearch as this user ID and group ID
#ES_USER=elasticsearch
#ES_GROUP=elasticsearch

# Heap Size (defaults to 256m min, 1g max)
#ES_HEAP_SIZE=2g

# Heap new generation
#ES_HEAP_NEWSIZE=

# max direct memory
#ES_DIRECT_SIZE=

# Maximum number of open files, defaults to 65535.
#MAX_OPEN_FILES=65535

# Maximum locked memory size. Set to "unlimited" if you use the
# bootstrap.mlockall option in elasticsearch.yml. You must also set
# ES_HEAP_SIZE.
#MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
#MAX_MAP_COUNT=262144

# Elasticsearch log directory
#LOG_DIR=/var/log/elasticsearch

# Elasticsearch data directory
#DATA_DIR=/var/lib/elasticsearch

# Elasticsearch work directory
#WORK_DIR=/tmp/elasticsearch

# Elasticsearch configuration directory
#CONF_DIR=/etc/elasticsearch

# Elasticsearch configuration file (elasticsearch.yml)
#CONF_FILE=/etc/elasticsearch/elasticsearch.yml

# Additional Java OPTS
#ES_JAVA_OPTS=

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

There are no records in /var/log/elasticsearch/elasticsearch.log and /var/log/elasticsearch/elasticsearch.error files.

Does anybody know why is can fail?

like image 468
Haru Atari Avatar asked Nov 11 '15 14:11

Haru Atari


3 Answers

It is not resolve of question. But i resolved my problem.

Script in /usr/share/elasticsearch/bin/plugin generate bash-command and run it. I edited this file. It printed this command by echo instead running it. I copied this command and ran it from bush terminal. And it ran correctly.

I don't know why but it work. May be it will be helpful for someone.

like image 174
Haru Atari Avatar answered Sep 21 '22 07:09

Haru Atari


I was stuck with the same problem, too -- 2016, September. Turned out, this problem occurs with an old version of elastic search (i.e. 1.7.3) which is in the repos for Ubuntu. Use the current one (which is recommended anyway) and you should not get this error.

To install the current one (writing this, it is version 2.4) follow these steps:

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list

sudo apt-get update && sudo apt-get install elasticsearch
like image 35
Maurice Müller Avatar answered Sep 19 '22 07:09

Maurice Müller


These changes fixed the issue for me:

--- /usr/share/elasticsearch/bin/plugin 2015-12-24 05:14:52.000000000 +0000
+++ /usr/share/elasticsearch/bin/pluginfix  2018-04-21 22:54:49.547134959 +0000
@@ -79,7 +79,7 @@
       properties="$properties \"$var\"=\"$1\""
       ;;
     *)
-      args="$args \"$1\""
+      args="$args $1"
   esac
   shift
 done
@@ -90,7 +90,7 @@
     *-Des.default.path.conf=*|*-Des.path.conf=*)
     ;;
     *)
-      properties="$properties -Des.default.path.conf=\"$CONF_DIR\""
+      properties="$properties -Des.default.path.conf=$CONF_DIR"
     ;;
   esac
 fi
@@ -100,11 +100,11 @@
     *-Des.default.config=*|*-Des.config=*)
     ;;
     *)
-      properties="$properties -Des.default.config=\"$CONF_FILE\""
+      properties="$properties -Des.default.config=$CONF_FILE"
     ;;
   esac
 fi

 export HOSTNAME=`hostname -s`

-exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home=\""$ES_HOME"\" $properties -cp \""$ES_CLASSPATH"\" org.elasticsearch.plugins.PluginManager $args
+exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home="$ES_HOME" $properties -cp "$ES_CLASSPATH" org.elasticsearch.plugins.PluginManager $args

The workaround posted by Pikaev Viktor applies essentially the same fix. Through the action of copy-pasting the command that would be executed by the script, one level of pairs of quotes get removed by the shell.

This bug has also been reported to Ubuntu Debian (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807596) but has been marked as won't fix because:

... the package elasticsearch has just been removed from the Debian archive unstable ...

as of March 11, 2018.

like image 31
Robrecht Dewaele Avatar answered Sep 19 '22 07:09

Robrecht Dewaele