Mbeans error

Hello,

I just started studying elasticsearch and kibana for a project that I have in mind, and I am trying to set this up.

When I downloaded elasticsearch 5.5.0 and I try to run it, is showing up:

blues-mbp:bin bluenarkotic$ ./elasticsearch
2017-07-18 12:08:48,096 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:585)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1848)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:322)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.logging.log4j.core.jmx.Server.register(Server.java:389)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:167)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:556)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:206)
at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:221)
at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:197)
at org.elasticsearch.common.logging.LogConfigurator.configureStatusLogger(LogConfigurator.java:175)
at org.elasticsearch.common.logging.LogConfigurator.configureWithoutConfig(LogConfigurator.java:99)
at org.elasticsearch.cli.Command.main(Command.java:85)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)

Exception in thread "main" SettingsException[Failed to load settings from /Users/bluenarkotic/elasticsearch-5.5.0/config/elasticsearch.yml]; nested: AccessDeniedException[/Users/bluenarkotic/elasticsearch-5.5.0/config/elasticsearch.yml];
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:102)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:72)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
at org.elasticsearch.cli.Command.main(Command.java:88)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
Caused by: java.nio.file.AccessDeniedException: /Users/bluenarkotic/elasticsearch-5.5.0/config/elasticsearch.yml
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1033)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:100)
... 6 more

When I try to run it as root is not letting me.

any ideas? thanks.

hi it is normal as they say it is super insecure to launch it in root, so it is disabled natively, but you still can do it: all you have to do is allow insecure root :

modify the file and add this property as follow : ES_JAVA_OPTS="-Des.insecure.allow.root=true"
1/ vi bin/elasticsearch
2/ add this property ES_JAVA_OPTS="-Des.insecure.allow.root=true"

and I'll leave here a forum from stackoverflow that discuss the same issue :slight_smile:

hope it works for you :slight_smile:

altough i know this was written at time for elastic 2.X and now we're in 5.x but this will still do the trick :wink:

Where is the script file?

thanks

it depends where you've installed it i guess try an updatedb then locate elasticsearch to see where it is ?

what os do you use ?

I am currently running osx.

Please do not try to run Elasticsearch as root. Running anything as root is not secure and leaves you vulnerable to attack. The option mentioned here was removed in 5.0 and is no longer available. You should run Elasticsearch as a non-root user, preferably a user with only the minimal permissions required by Elasticsearch. If you are running on a mac for development purposes then you should run Elasticsearch as your normal logged in user.

I understand, I tried to run it as normal user but still, you can see the logs, is complaining about the java exemption, so I can do anything.

What are the permissions on this file: /Users/bluenarkotic/elasticsearch-5.5.0/config/elasticsearch.yml ?

The exception is saying it doesn't have permission to access that file.

-rw-rw---- 1 root wheel 2854 Jul 1 01:14 elasticsearch.yml

Ok so it looks like the problem is that the file is owned by the root user rather than your user. When you unzipped Elasticsearch did you do that as root (or with a sudo command)?

If so I would suggest that you delete the elasticsearch-5.5.0 directory and unzip the .tar.gz/.zip file again but as your user rather than root and without using sudo.

Alternatively you could chown bluenarkotic:bluenarkotic all the files in elasticsearch-5.5.0 but I think the above option would be safer

Yes! that was the issue, looks like I Started the package and installed it as root user, cleared terminal and exit, and when I did it from the beginning with a normal user it worked! now is fine.

Thank you so much!

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