Bug 1147485

Summary: Apache configuration cannot be retrieved in case when Augeas is enabled but /tmp folder has "no exec" permissions
Product: [Other] RHQ Project Reporter: bkramer <bkramer>
Component: PluginsAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.9CC: hrupp, loleary
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-07 17:23:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1147484    
Bug Blocks:    

Description bkramer 2014-09-29 11:22:51 UTC
Description of problem:
Apache configuration cannot be retrieved in case when Augeas is enabled but /tmp folder has "no exec" permissions

Version-Release number of selected component (if applicable):
RHQ 4.9

How reproducible:
Always

Steps to Reproduce:
1. Install and start RHQ Server and Agent and deploy plugins for EWS;
2. Change permissions for /tmp folder to noexec - so direct execution of any binaries on the mounted filesystem is not allowed.
3. Start Apache instance and let RHQ Agent discover it;
4. Import discovered Apache instance and confirm that it's availability is green;
5. From RHQ UI navigate to Apache instance -> Inventory -> Connection Settings and set "Enable augeas support" to Yes and save the change;
6. From above page navigate to Configuration tab for this Apache instance. 


Actual results:
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

***************************************************

Expected results:
No error is logged and configuration is properly discovered.

Additional info:

To work around this, create a new tmp folder for RHQ:

# 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 tmp folder to RHQ_AGENT_JAVA_OPTS:


edit RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/home/tmp/jon"

Save the file and restart the agent.

Comment 1 Larry O'Leary 2016-01-07 17:23:44 UTC
Closing as the workaround is the solution.

If the default Java temporary directory has no exec, then it needs to be set to a location that allows exec. Perhaps $RHQ_AGENT_HOME/data/tmp?