Permission troubles in Ubuntu with log files when installing plugins (and possibly other actions)


(Frank Dorssers) #1

The machine I'm using runs Ubuntu 15.04 with Java version 1.8.0_66 (java -version). Installation of Elasticsearch was done using PPA:

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.0/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elk.list
sudo apt-get update && sudo apt-get install elasticsearch -y
sudo service elasticsearch start

And it seemed to work flawless:

{
  "name" : "Michael Nowman",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.0.0-beta2",
    "build_hash" : "91726c3f7cf57336f2f304a5cdc738db3b817234",
    "build_timestamp" : "2015-09-14T14:58:02Z",
    "build_snapshot" : false,
    "lucene_version" : "5.2.1"
  },
  "tagline" : "You Know, for Search"
}

The next thing that I wanted to do was install kopf with the following command:

/usr/share/elasticsearch/bin/plugin -install lmenezes/elasticsearch-kopf

However this gave the following error:

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /usr/share/elasticsearch/logs/elasticsearch.log (Permission denied)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
	at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
	at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
	at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
	at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
	at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
	at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
	at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440)
	at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.plugins.PluginManagerCliParser.main(PluginManagerCliParser.java:56)
....
log4j:ERROR Either File or DatePattern options are not set for appender [index_search_slow_log_file].
ERROR: unknown command [-install]. Use [-h] option to list available commands

Had to remove part of the error due to character limit.

Running this command with sudo also didn't work, however in that case it did not give the extensive error, but only:

ERROR: unknown command [-install]. Use [-h] option to list available commands

So apparently there's a permission issue. So I checked what users exist using cat /etc/passwd and the resulting list contains:

elasticsearch:x:124:135::/home/elasticsearch:/bin/false

So there seems to be an Elasticsearch user. In the next step I checked the permissions of /usr/share/elasticsearch/logs with ls -al /usr/share/elasticsearch and this gave:

drwxr-xr-x   2 elasticsearch elasticsearch  4096 okt 27 13:42 logs

So that also seems to be right.

Next I tried changing the permissions to that folder using sudo chmod -R 777 /usr/share/elasticsearch/logs. That didn't work either. The only thing this changed was that the non sudo version of the command also didn't give any output except for ERROR: unknown command... so I put it back to 755.

This is a personal machine, so I have full access and can change anything required. I'm also still relatively new to Ubuntu, so for all I know I'm missing something very obvious.

Would anyone happen to have a suggestion what I can do to get everything working? Because at the moment I have no idea.


(Mark Harwood) #2

The install command looks wrong.
See the 2.0 plugin installation docs here: https://www.elastic.co/guide/en/elasticsearch/plugins/2.0/installation.html


(Frank Dorssers) #3

You're completely right! I removed the dash and it worked immediately. My fault for assuming the tutorial I was following was completely right, should've taken a better look at the actual docs and at the actual error that explicitly stated that I was using the wrong command. Was too focused on the permission issues.

Thank you.


(system) #4