*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
run "ldd /path/to/program" and it'll tell you what libraries the jdk depends on (perhaps you've overlooked putting a required lib in the chroot?)
If there are missing libs, you need to copy them into the same directory listed, only within the chroot. In other words, if my program depends on /path/to/some/lib.so.0, and my chroot is /home/chroot/, then I need to copy /path/to/some/lib.so.0 to /home/chroot/path/to/some/lib.so.0.
I don't want to torpedo the discussion, but IMO a more proper way to isolate / secure the tomcat service in this instance is using a Jail. This is FBSD, right? If so, take advantage of that fact.
thanks for the reply; in fact i am trying to set up tomcat in jail using the chroot command. what wonders me is why the comand java -version executed with chroot does not work?
for the second command i coud not write the character "`" but i did this (i think is equivalent to yours):
No, it's not equivalent. The " ` " char is the key to the left of the '1' key. It's used for command substitution. If you do this:
echo "/bin/sh" | ls -lh
you don't get this:
-r-xr-xr-x 3 root bin 317k Aug 30 04:12 /bin/sh
rather, you get the output of "ls -lh" in whatever directory you happen to be in. Using the backtick (" ` ") is equivalent of "ls -lh `(the results of this command)`", which in this instance would do ls -lh on all of the required libs for the executable you're ldd'ing (java), only it'll list those required libs as they need to be in the chroot (because of the sed portion prepending /home/me/chroot/ to each line).
If the command java -version works outside of chroot and NOT within chroot, it stands to assume that the chroot (or something pertaining to the chroot) is the cause of the problem here.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
I'm not sure to understand why you are unable to enter the back-tick character with your French keyboard (it's AltGr-è with mine) and I'm missing why you just don't cut and paste the command suggested to you but anyway, there is an alternative: use $(...) instead.
Eg:
Code:
ls -lh $(ldd /home/me/chroot/usr/local/jdk1.6.0/bin/java | cut -d'/' -f2-20 | sed -e '1,2d' -e 's@^@/home/me/chroot/@')
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.