Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]java vm cant find libjli.so when running as user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Farmboy
n00b
n00b


Joined: 10 Jul 2011
Posts: 22

PostPosted: Fri Jun 08, 2012 5:28 pm    Post subject: [solved]java vm cant find libjli.so when running as user Reply with quote

Hello,
here is my problem
I am running Gentoo on amd64(not sure that matters).

I emerge sun-jdk version 1.6.0_32.
I can run java -version as root and as user.

Then I set a capabilities flag on /opt/sun-jdk-1.6.0.32/bin/java
with the command
setcap 'CAP_NET_BIND_SERVICE=+ep' /opt/sun-jdk-1.6.0.32/bin/java

I can run java -version as root but not as user.
I get the error message that libjli.so cannot be loaded.

This lib resides in jre/lib/amd64/jli but java doesnt find it when run as user.

I copy the lib to /usr/local/lib64 and run ldconfig.
Now java -version hangs when run as user.

The same effect happen with oracle-jdk 1.7.0.4.
But when I copy the lib to /usr/local/lib64 I can run it as user.

So why is java not picking up the lib as user?
Any ideas?

Thanks for reading


Last edited by Farmboy on Mon Jul 16, 2012 2:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
anb.clarke
n00b
n00b


Joined: 05 Apr 2006
Posts: 31

PostPosted: Tue Jun 19, 2012 4:35 am    Post subject: Reply with quote

You have both sun-jdk 1.6 and oracle-jdk-bin 1.7. Does choosing the user vm defaults with eselect java-vm help in any way?

Code:
gentoo > eselect java-vm list
Available Java Virtual Machines:
  [1]   oracle-jdk-bin-1.7  system-vm
  [2]   sun-jdk-1.6

gentoo > eselect java-vm list user
Available Java Virtual Machines:
  [1]   oracle-jdk-bin-1.7  system-vm
  [2]   sun-jdk-1.6

gentoo > eselect java-vm set user 1

gentoo > eselect java-vm list user
Available Java Virtual Machines:
  [1]   oracle-jdk-bin-1.7  system-vm user-vm
  [2]   sun-jdk-1.6
Back to top
View user's profile Send private message
Farmboy
n00b
n00b


Joined: 10 Jul 2011
Posts: 22

PostPosted: Tue Jun 19, 2012 4:39 pm    Post subject: Reply with quote

No it doesnt.
I already set the vm as user.
Back to top
View user's profile Send private message
anb.clarke
n00b
n00b


Joined: 05 Apr 2006
Posts: 31

PostPosted: Sat Jun 23, 2012 3:51 am    Post subject: Reply with quote

The reason that capabilities don't seem to work with Java is that the Sun JDK apparently does not support Linux capabilities.(http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6919633).

ALTERNATIVES:
http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l
http://splunk-base.splunk.com/answers/5037/using-setcap-to-allow-non-root-splunk-user-to-start-splunkweb-on-port-443
Back to top
View user's profile Send private message
Farmboy
n00b
n00b


Joined: 10 Jul 2011
Posts: 22

PostPosted: Sat Jun 23, 2012 8:08 am    Post subject: Reply with quote

The JDK bug you linked is the exact same behaviour I am also getting.
But from reading the bug its not so much that the jdk doesnt support posix capabilities and more that due to the way the binary is build there is a problem resolving the library path. The net effect remains the same though.

The stackoverflow link you posted is the one where i got the idea with the capabilities from.

http://splunk-base.splunk.com/answers/5037/using-setcap-to-allow-non-root-splunk-user-to-start-splunkweb-on-port-443
gave me the following interesting tidbit:

Quote:
You cannot use setcap to grant the capability to splunkd or python in any meaningful way. Processes in linux that are run with escalated privileges cannot use a LD_LIBRARY_PATH which is essential.


I am not firm enough with binary loading and library resolving on linux to evaluate this.
But it sounds like this could be the problem.
Back to top
View user's profile Send private message
Farmboy
n00b
n00b


Joined: 10 Jul 2011
Posts: 22

PostPosted: Tue Jul 03, 2012 3:22 pm    Post subject: Reply with quote

I just tested out the workaround from the jdk bug report namely changing the rpath with patchelf and it works for me.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum