Bug 1147484

Summary: Apache configuration cannot be retrieved in case when Augeas is enabled but /tmp folder has "no exec" permissions
Product: [Retired] JBoss Web Server 3 Reporter: bkramer <bkramer>
Component: JON PluginAssignee: Jean-frederic Clere <jclere>
Status: CLOSED DEFERRED QA Contact: Libor Fuka <lfuka>
Severity: high Docs Contact:
Priority: high    
Version: 2.1.0CC: dknox, hbrock, jdoyle, loleary, mfoley, myarboro
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: 2015-02-24 18:33:43 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:    
Bug Blocks: 1147485    

Description bkramer 2014-09-29 11:19:05 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):
JBoss ON 3.2.3

How reproducible:
Always

Steps to Reproduce:
1. Install and start JBoss ON 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 JBoss ON Agent discover it;
4. Import discovered Apache instance and confirm that it's availability is green;
5. From JBoss ON 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 JBoss ON:

# 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 4 Larry O'Leary 2015-01-09 23:57:02 UTC
The Augeas plug-in is part of JBoss Web Server.

Comment 5 Jean-frederic Clere 2015-01-12 10:49:57 UTC
if /tmp can't be used another location must be provided (a valid java.io.tmpdir) so I don't see how to fix the problem...

Comment 6 David Knox 2015-02-24 18:33:43 UTC
ported to JIRA. add all future comments to https://issues.jboss.org/browse/JWS-8