pifpaf
pifpaf copied to clipboard
pifpaf fails to start elasticsearch on Debian
After installing elasticsearch using debian packages, and trying to use pifpaf with it I get the following error :
tox -e py27
[snip]
ERROR [pifpaf] Program did not print: ` started'
Output: warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
/usr/share/elasticsearch/bin/elasticsearch-env: line 71: /etc/default/elasticsearch: Permission denied
[snip]
ERROR: py27: commands failed
ls -al /etc/default/elasticsearch
.rw-rw---- root elasticsearch 1.5 KB Thu Mar 21 16:39:41 2019 elasticsearch
the user used by pifpaf is not part of the elasticsearch group. Changing that (or changing the rights on the config file) solves the problem, but it would be nice to have pifpaf work out of the box in userland without any system tweaks.
(thanks for the awesome piece of software by the way ! :sparkles: )
Can you just try to run pifpaf --debug run elasticsearch
to see what's happening under the hood?
thanks for taking a look into this issue
py27 runtests: commands[0] | pifpaf --debug run elasticsearch
DEBUG [pifpaf.drivers] executing: ['elasticsearch', '-Ehttp.port=9200', '-Epath.logs=/tmp/tmpJiKEkf/log', '-Epath.data=/tmp/tmpJiKEkf']
DEBUG [pifpaf.drivers] elasticsearch[24210] output: warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
DEBUG [pifpaf.drivers] elasticsearch[24210] output: /usr/share/elasticsearch/bin/elasticsearch-env: line 71: /etc/default/elasticsearch: Permission denied
DEBUG [pifpaf.drivers] elasticsearch[24210] output:
ERROR [pifpaf] Traceback (most recent call last):
File "/home/arthur/src/clients/SIAF/cubes/francearchives/.tox/py27/local/lib/python2.7/site-packages/fixtures/fixture.py", line 197, in setUp
self._setUp()
File "/home/arthur/src/clients/SIAF/cubes/francearchives/.tox/py27/local/lib/python2.7/site-packages/pifpaf/drivers/elasticsearch.py", line 47, in _setUp
wait_for_line=" started")
File "/home/arthur/src/clients/SIAF/cubes/francearchives/.tox/py27/local/lib/python2.7/site-packages/pifpaf/drivers/__init__.py", line 259, in _exec
% (wait_for_line, b"".join(lines)))
RuntimeError: Program did not print: ` started'
Output: warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
/usr/share/elasticsearch/bin/elasticsearch-env: line 71: /etc/default/elasticsearch: Permission denied
It looks like /usr/share/elasticsearch/bin/elasticsearch-env
is called and not the real elasticsearch
binary. I guess Debian have a wrapper around that binary to set some environment variables.
I don't see elasticsearch in Debian itself, where did you get those packages?
I'd be interested to see the content of /usr/bin/elasticsearch
and /usr/share/elasticsearch/bin/elasticsearch-env
.
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.deb is being used
This is clearly a packaging issue. The sourcing of that file without a test is a problem. Here's the difference between the package and the tarball:
~/Downloads/elasticsearch-e˘nv.txt
--- /usr/local/Cellar/elasticsearch/6.7.0/libexec/bin/elasticsearch-env 2019-04-03 12:39:33.000000000 -0400
+++ /Users/jd/Downloads/elasticsearch-env.txt 2019-04-03 12:35:03.000000000 -0400
@@ -68,7 +68,7 @@
export HOSTNAME=$HOSTNAME
-if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="/usr/local/etc/elasticsearch"; fi
+source /etc/default/elasticsearch
if [ -z "$ES_PATH_CONF" ]; then
echo "ES_PATH_CONF must be set to the configuration path"
@@ -78,8 +78,8 @@
# now make ES_PATH_CONF absolute
ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
-ES_DISTRIBUTION_FLAVOR=oss
-ES_DISTRIBUTION_TYPE=tar
+ES_DISTRIBUTION_FLAVOR=default
+ES_DISTRIBUTION_TYPE=deb
if [ -z "$ES_TMPDIR" ]; then
ES_TMPDIR=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.TempDirectory`
There's absolutely no way to prevent this sourcing of /etc/default/elasticsearch
. Sigh.
It's currently broken on Arch as well, but with a different error:
$ pifpaf --debug run elasticsearch
DEBUG [pifpaf.drivers] executing: ['elasticsearch', '-Ehttp.port=9200', '-Epath.logs=/tmp/tmpvwculju3/log', '-Epath.data=/tmp/tmpvwculju3']
DEBUG [pifpaf.drivers] elasticsearch[440072] output: /usr/share/elasticsearch/bin/elasticsearch-env: line 90: cd: /usr/share/elasticsearch/config: Permission denied
DEBUG [pifpaf.drivers] elasticsearch[440072] output: bin/elasticsearch-env: line 90: cd: /usr/share/elasticsearch/config: Permission denied
DEBUG [pifpaf.drivers] elasticsearch[440072] output: Exception in thread "main" java.nio.file.NoSuchFileException: /home/felix/projects/arch/community/pifpaf/trunk/jvm.options
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at java.base/java.nio.file.Files.newInputStream(Files.java:160)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at org.elasticsearch.tools.launchers.JvmOptionsParser.readJvmOptionsFiles(JvmOptionsParser.java:167)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:128)
DEBUG [pifpaf.drivers] elasticsearch[440072] output: at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)
DEBUG [pifpaf.drivers] elasticsearch[440072] output:
DEBUG [pifpaf.util] Terminating (440072)
DEBUG [pifpaf.util] Waiting (440072)
ERROR [pifpaf] Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/fixtures/fixture.py", line 197, in setUp
self._setUp()
File "/usr/lib/python3.8/site-packages/pifpaf/drivers/elasticsearch.py", line 39, in _setUp
c, _ = self._exec(
File "/usr/lib/python3.8/site-packages/pifpaf/drivers/__init__.py", line 214, in _exec
raise RuntimeError(
RuntimeError: Program did not print: ` started'
Output: b'/usr/share/elasticsearch/bin/elasticsearch-env: line 90: cd: /usr/share/elasticsearch/config: Permission denied\nbin/elasticsearch-env: line 90: cd: /usr/share/elasticsearch/config: Permission denied\nException in thread "main" java.nio.file.NoSuchFileException: /home/felix/projects/arch/community/pifpaf/trunk/jvm.options\n\tat java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)\n\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)\n\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)\n\tat java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)\n\tat java.base/java.nio.file.Files.newByteChannel(Files.java:375)\n\tat java.base/java.nio.file.Files.newByteChannel(Files.java:426)\n\tat java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)\n\tat java.base/java.nio.file.Files.newInputStream(Files.java:160)\n\tat org.elasticsearch.tools.launchers.JvmOptionsParser.readJvmOptionsFiles(JvmOptionsParser.java:167)\n\tat org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:128)\n\tat org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)\n'
The folder /usr/share/elasticsearch/config
is a symlink to /etc/elasticsearch/
, which has 640 permission owned by root:elasticsearch
. Unfortunately I don't know how to proceed either.