Apache configuration cannot be retrieved in case when Augeas is enabled but /tmp folder has "no exec" permissions
Environment
- Red Hat JBoss Operations Network (JON) 3.2.3;
- Web Server Plugin Pack for Red Hat JBoss Operations Network 3.2.0;
- /tmp folder configured to noexec option;
- Apache instance is discovered, up and running and "Enabled augeas support" property in Connection Settings is set to "Yes".
Issue
- Apache configuration cannot be retrieved in case when Augeas is enabled but /tmp folder has "no exec" permissions
Resolution
When the /tmp directory is configured a noexec in the fstab file, the JBoss ON Agent will throw exceptions because it cannot properly initialize the Augeas lens. This has been captured in the JBoss ON Users Guide - Disabling noexec Options for Apache Directories.
In order to resolve this, do one of the following two options:
- Make sure that the /tmp directory does not have noexec set as an option.
- If option 1. is not viable, then create a new tmp folder for JBoss ON - for instance:
# mkdir /home/tmp/jon
# chown -R <jon_user>:<jon_user> /home/tmp/jon
# chmod a+rwx /home/tmp/jon
and then, edit rhq-agent-env.sh file to add this /home/tmp/jon folder to RHQ_AGENT_JAVA_OPTS:
RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/home/tmp/jon"
Once above change is done, save the file and restart the agent.
Diagnostic Steps
-
When navigating to Configuration tab for Apache instance, message "No configuration was retrieved. This means that either the plugin failed to load the configuration or that configuration collection is merely switched off in the connection settings." is showed at the top of the screen (green background) and no configuration is detected.
-
The agent.log file shows:
2014-09-29 12:01:01,613 WARN [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [Directory] Resources - failed after 15 ms.
java.lang.Exception: Discovery component invocation failed.
at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:309)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/jna6853304923111682447.tmp: /tmp/jna6853304923111682447.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1061)
at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:757)
at com.sun.jna.Native.loadNativeLibrary(Native.java:681)
at com.sun.jna.Native.<clinit>(Native.java:109)
at net.augeas.jna.Aug.<clinit>(Unknown Source)
at net.augeas.Augeas.<init>(Unknown Source)
at net.augeas.Augeas.<init>(Unknown Source)
at org.rhq.plugins.apache.ApacheServerComponent.isAugeasEnabled(ApacheServerComponent.java:1068)
at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.isAugeasEnabled(ApacheVirtualHostServiceComponent.java:666)
at org.rhq.plugins.apache.ApacheDirectoryDiscoveryComponent.discoverResources(ApacheDirectoryDiscoveryComponent.java:64)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:305)
... 5 more
2014-09-29 12:01:01,615 WARN [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [IfModule] Resources - failed after 0 ms.
java.lang.Exception: Discovery component invocation failed.
at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:309)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.augeas.jna.Aug
at net.augeas.Augeas.<init>(Unknown Source)
at net.augeas.Augeas.<init>(Unknown Source)
at org.rhq.plugins.apache.ApacheServerComponent.isAugeasEnabled(ApacheServerComponent.java:1068)
at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.isAugeasEnabled(ApacheVirtualHostServiceComponent.java:666)
at org.rhq.plugins.apache.ApacheIfModuleDiscoveryComponent.discoverResources(ApacheIfModuleDiscoveryComponent.java:53)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:305)
... 5 more
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
