Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elasticsearch server error with "failed to bind" nested: AccessDeniedException #182

Open
ovizii opened this issue Feb 1, 2023 · 2 comments

Comments

@ovizii
Copy link

ovizii commented Feb 1, 2023

Seems to be a permission problem. What are the user and group IDs used by this container so I can make sure the mapped docker volumes are accessible to these IDs?

docker logs -f onlyoffice-elasticsearch

{"type": "server", "timestamp": "2023-02-01T14:42:48,262Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "onlyoffice-elasticsearch", "message": "loaded plugin [ingest-attachment]" }                                                             
{"type": "server", "timestamp": "2023-02-01T14:42:48,370Z", "level": "ERROR", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "cluster.name": "docker-cluster", "node.name": "onlyoffice-elasticsearch", "message": "uncaught exception in thread [main]",                                    
"stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];",                                                                                                                       
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.16.3.jar:7.16.3]",                                      
"at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-7.16.3.jar:7.16.3]",                                   
"at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.16.3.jar:7.16.3]",                      
"at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.16.3.jar:7.16.3]",                              
  
"at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.16.3.jar:7.16.3]",                                                     
"at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) ~[elasticsearch-7.16.3.jar:7.16.3]",                                      
"at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.16.3.jar:7.16.3]",                                       
"Caused by: org.elasticsearch.ElasticsearchException: failed to bind service",                                                                       
"at org.elasticsearch.node.Node.<init>(Node.java:1090) ~[elasticsearch-7.16.3.jar:7.16.3]",                                                          
"at org.elasticsearch.node.Node.<init>(Node.java:309) ~[elasticsearch-7.16.3.jar:7.16.3]",                                                           
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234) ~[elasticsearch-7.16.3.jar:7.16.3]",                                          
"at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.16.3.jar:7.16.3]",                                             
"at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.16.3.jar:7.16.3]",                                              
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.16.3.jar:7.16.3]",                                      
"... 6 more",                                                                                                                                        
"Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes",                                                               
"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.createDirectory(UnixFileSystemProvider.java:398) ~[?:?]",                                                      
"at java.nio.file.Files.createDirectory(Files.java:700) ~[?:?]",                                                                                     
"at java.nio.file.Files.createAndCheckIsDirectory(Files.java:807) ~[?:?]",                                                                           
"at java.nio.file.Files.createDirectories(Files.java:793) ~[?:?]",                                                                                   
"at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:300) ~[elasticsearch-7.16.3.jar:7.16.3]",                                
"at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:224) ~[elasticsearch-7.16.3.jar:7.16.3]",                             
"at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:298) ~[elasticsearch-7.16.3.jar:7.16.3]",                                      
"at org.elasticsearch.node.Node.<init>(Node.java:427) ~[elasticsearch-7.16.3.jar:7.16.3]",                                                           
"at org.elasticsearch.node.Node.<init>(Node.java:309) ~[elasticsearch-7.16.3.jar:7.16.3]",                                                           
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234) ~[elasticsearch-7.16.3.jar:7.16.3]",                                          
"at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.16.3.jar:7.16.3]",                                             
"at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.16.3.jar:7.16.3]",                                              
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.16.3.jar:7.16.3]",                                      
"... 6 more"] }                                                                                                                                      
uncaught exception in thread [main]                                                                                                                  
ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];                                  
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes                                                          
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)                                                          
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)                                                           
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)                                                           
        at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:398)                                              
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)                                                                             
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)                                                                   
        at java.base/java.nio.file.Files.createDirectories(Files.java:793)                                                                           
        at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:300)                                                              
        at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:224)                                                           
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:298)                                                                    
        at org.elasticsearch.node.Node.<init>(Node.java:427)                                                                                         
        at org.elasticsearch.node.Node.<init>(Node.java:309)                                                                                         
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234)                                                                        
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234)                                                                           
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434)                                                                            
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166)                                                                    
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157)                                                                 
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)                                                    
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)                                                                  
        at org.elasticsearch.cli.Command.main(Command.java:77)                                                                                       
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122)                                                                    
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)                                                                     
For complete error details, refer to the log at /usr/share/elasticsearch/logs/docker-cluster.log 
@ovizii
Copy link
Author

ovizii commented Feb 1, 2023

I fixed this temporarily wit ha

chmod -R 777 es_data/ as this is the folder I use as a docker volume for elasticsearch

checking the content of this folder later, it looks like the user it rusn as has the id 1000?

ls -aln es_data/                                                                                                
total 50                                                                                                                                             
drwxrwxrwx  3    0 0  3 Feb  1 15:47 .                                                                                                               
drwxrwx--- 13 1000 0 15 Feb  1 15:45 ..                                                                                                              
drwxrwxr-x  3 1000 0  3 Feb  1 15:47 nodes  

@Carazyda
Copy link
Member

Carazyda commented Feb 1, 2023

Hello @ovizii Have you made changes to the file docker-compose.workspace.yml, in part environment for elasticsearch? Also please scpecify version of docker-compose and your OS?

By default it should look like this

total 12
drwxrwxr-x 3 1000 0 4096 Feb  1 16:43 .
drwx-----x 3    0 0 4096 Feb  1 16:38 ..
drwxrwxr-x 3 1000 0 4096 Feb  1 16:43 nodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants