Logs and data directories are not created by Debian installation for 6.1.x

Hey guys,
I'm playing with Ansible to get Elasticsearch 6.1 + Kibana up & running in a fresh Debian 9.x installation. I've followed the steps at https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html but the service does not start due to small but important issues with the logs and data directories. The service by default expects both directories to be under /usr/share/elasticsearch with write permission for the elasticsearch user.

    2017-12-17 20:21:15,774 main ERROR Unable to create file /usr/share/elasticsearch/logs/Oh_My_Cluster.log java.io.IOException: Could not create directory /usr/share/elasticsearch/logs        
            at org.apache.logging.log4j.core.util.FileUtils.mkdir(FileUtils.java:127)                                                                                                             
            at org.apache.logging.log4j.core.util.FileUtils.makeParentDirs(FileUtils.java:144)                                                                                                    
            at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:627)                                             
            at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)                                             
            at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113) 
    ...
    Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data                          
            at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:1.8.0_151]
            at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_151]
            at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_151]
            at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:1.8.0_151]
            at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_151]
            at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_151]
            at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_151]
            at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:401) 
1 Like

This is not accurate. The default configuration sets path.data to /var/lib/elasticsearch and path.logs to /var/log/elasticsearch. Have you edited or are otherwise not using the default configuration in /etc/elasticsearch/elasticsearch.yml? Are you starting the service using Sys V init or systemd? The package installations are not meant to be started directly from bin/elasticsearch, they simply will not work without effort and instead you should use the archive distribution if you can not run as a service, we only support starting Elasticsearch directly from the archive distributions.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.