AccessDeniedException for path.repo while starting Elasticsearch

I have installed elasticsearch Debian package. In /etc/elasticsearch/elasticsearch.yml file, I have this added: path.repo: ["/home/admin/backup_extracted/var/lib/elasticsearch/es_bkp"]. The ownership of backup_exctracted is:

drwxr-x--- 3 elasticsearch elasticsearch 4096 Jan 4 11:31 backup_extracted/

Now, when I start elasticsearch using sudo service elasticsearch start, I am getting following error:

Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

Content of /var/log/elasticsearch/elasticsearch.log:

[2023-01-04T12:55:35,772][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: /tmp/elasticsearch-562874475904728319/jna18017467042813038655.tmp: /tmp/elasticsearch-562874475904728319/jna18017467042813038655.tmp: failed to map segment from shared object
	at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
	at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404) ~[?:?]
	at java.lang.Runtime.load0(Runtime.java:785) ~[?:?]
	at java.lang.System.load(System.java:2011) ~[?:?]
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at com.sun.jna.Native.<clinit>(Native.java:221) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Class.java:390) ~[?:?]
	at java.lang.Class.forName(Class.java:381) ~[?:?]
	at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:34) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.8.jar:7.17.8]
[2023-01-04T12:55:35,783][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot check if running as root because JNA is not available
[2023-01-04T12:55:35,784][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot install system call filter because JNA is not available
[2023-01-04T12:55:35,784][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot register console handler because JNA is not available
[2023-01-04T12:55:35,786][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2023-01-04T12:55:35,786][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot getrlimit RLIMIT_AS because JNA is not available
[2023-01-04T12:55:35,786][WARN ][o.e.b.Natives            ] [aera-k57k27-bb1-elastic-temp] cannot getrlimit RLIMIT_FSIZE because JNA is not available
[2023-01-04T12:55:35,788][WARN ][o.e.c.f.FileSystemNatives] [aera-k57k27-bb1-elastic-temp] unable to load JNA native support library, FileSystemNatives methods will be disabled.
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Class.java:390) ~[?:?]
	at java.lang.Class.forName(Class.java:381) ~[?:?]
	at org.elasticsearch.common.filesystem.FileSystemNatives.loadJnaProvider(FileSystemNatives.java:37) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.common.filesystem.FileSystemNatives.<clinit>(FileSystemNatives.java:31) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:158) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.8.jar:7.17.8]
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /tmp/elasticsearch-562874475904728319/jna18017467042813038655.tmp: /tmp/elasticsearch-562874475904728319/jna18017467042813038655.tmp: failed to map segment from shared object [in thread "main"]
	at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
	at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404) ~[?:?]
	at java.lang.Runtime.load0(Runtime.java:785) ~[?:?]
	at java.lang.System.load(System.java:2011) ~[?:?]
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at com.sun.jna.Native.<clinit>(Native.java:221) ~[jna-5.10.0.jar:5.10.0 (b0)]
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Class.java:390) ~[?:?]
	at java.lang.Class.forName(Class.java:381) ~[?:?]
	at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:34) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-7.17.8.jar:7.17.8]
	... 9 more
[2023-01-04T12:55:35,840][ERROR][o.e.b.Bootstrap          ] [aera-k57k27-bb1-elastic-temp] Exception
java.lang.IllegalStateException: Unable to access 'path.repo' (/home/admin/backup_extracted/var/lib/elasticsearch/es_bkp)
	at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:66) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:242) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:168) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.configure(Security.java:115) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) [elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.8.jar:7.17.8]
Caused by: java.nio.file.AccessDeniedException: /home/admin/backup_extracted/var/lib/elasticsearch
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.checkAccess(UnixFileSystemProvider.java:313) ~[?:?]
	at java.nio.file.Files.createDirectories(Files.java:772) ~[?:?]
	at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:318) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:64) ~[elasticsearch-7.17.8.jar:7.17.8]
	... 12 more
[2023-01-04T12:55:35,843][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [aera-k57k27-bb1-elastic-temp] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Unable to access 'path.repo' (/home/admin/backup_extracted/var/lib/elasticsearch/es_bkp)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:173) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.8.jar:7.17.8]
Caused by: java.lang.IllegalStateException: Unable to access 'path.repo' (/home/admin/backup_extracted/var/lib/elasticsearch/es_bkp)
	at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:66) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:242) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:168) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.configure(Security.java:115) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) ~[elasticsearch-7.17.8.jar:7.17.8]
	... 6 more
Caused by: java.nio.file.AccessDeniedException: /home/admin/backup_extracted/var/lib/elasticsearch
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.checkAccess(UnixFileSystemProvider.java:313) ~[?:?]
	at java.nio.file.Files.createDirectories(Files.java:772) ~[?:?]
	at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:318) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:64) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:242) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:168) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Security.configure(Security.java:115) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.8.jar:7.17.8]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) ~[elasticsearch-7.17.8.jar:7.17.8]
	... 6 more

I have tried changing ownership of backup_extracted to other users also, but getting same error.
What maybe the issue? How to check elasticsearch is run as which user?

I am not getting this error if I am installing elasticsearch from tar archive. But I have to install debian package because I am running elasticsearch on remote using ssh, and I want to keep it running even if I exit from ssh. Is it possible to keep it running if I install it using tar archive? (Already tried nohup, tmux, screen, with not success)

Welcome to our community! :smiley:

What is in that directory, is it an actual snapshot?

1 Like

yes.. it is an actual snapshot and I am able to restore from that snapshot when I am installing elasticsearch from the tar archive. But I want to run elasticsearch as service, and it is giving this error

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

Hi,

Did you find any solution to this. I am stuck with same error.

regards.
Abhijeet