java not working in chrooted environment
Andrew Wilkins
andrew.wilkins at canonical.com
Thu Oct 10 03:09:41 UTC 2013
On Wed, Oct 9, 2013 at 11:04 PM, Saurabh <saurabh.kumar at techblue.co.uk>wrote:
> Hi everybody,
>
Hi Saurabh,
> I have Installed juju on my ubuntu 12.04 machine in a local environment.
> I am writing a charm for an application development server, but It could
> not get java.
> I have written the install hook to install open_jdk via apt.
> Java gets installed, when I manually chroot to the location of this
> machine (chroot /var/lib/lxc/saurabh-local-machine-1/rootfs) and do a
> "which java" command It says "/usr/bin/java". But when I do "java -version"
> it says "*java: error while loading shared libraries: libjli.so: cannot
> open shared object file: No such file or directory* "
>
You probably don't want to chroot into the filesystem. If you want to run
java from the context of the charm, then you can run "juju ssh <unit>" to
get into the machine where the charm is installed.
For example, I just bootstrapped a local environment and deployed apache2.
I now have the unit "apache2/0" running on machine 1. I can log into that
machine by doing "juju ssh apache2/0". In your example, you'll "juju ssh
$servicename/0", and then you should be able to execute java.
On googling a bit I found that I will have to mount proc in the chrooted
> environment. I tried to mount proc using the install hook by adding a line
> " *mount -t proc none /proc*" but it could not mount /proc as in logs it
> says proc already mounted still the application could not get java.
> When I manually mount the proc in the chrooted environment and start the
> app server it runs fine and java also starts working.
>
> So my question is how to mount proc using a hook in the chrooted
> environment.
> If any body has any idea please help.
>
The charm does not run in a chroot, which is why you get the error. The
charm runs in an LXC container, which already has a /proc. Consider it as a
lightweight VM. You can read a little more about LXC here, if you're
interested: http://lxc.sourceforge.net/
Hope this helps.
Cheers,
Andrew
> Here is the log of that server unit.
>
>
>
> 2013-10-09 14:20:56 INFO juju.worker.uniter uniter.go:369 committing
> "install" hook
> 2013-10-09 14:20:56 INFO juju.worker.uniter uniter.go:387 committed
> "install" hook
> 2013-10-09 14:20:56 DEBUG juju.worker.uniter modes.go:410 ModeContinue
> exiting
> 2013-10-09 14:20:56 INFO juju.worker.uniter modes.go:408 ModeContinue
> starting
> 2013-10-09 14:20:56 INFO juju.worker.uniter modes.go:79 continuing after
> "install" hook
> 2013-10-09 14:20:56 DEBUG juju.worker.uniter modes.go:410 ModeContinue
> exiting
> 2013-10-09 14:20:56 INFO juju.worker.uniter modes.go:408 ModeConfigChanged
> starting
> 2013-10-09 14:20:56 DEBUG juju.worker.uniter.filter filter.go:407
> discarded config event
> 2013-10-09 14:20:56 INFO juju.worker.uniter uniter.go:354 running
> "config-changed" hook
> 2013-10-09 14:20:56 INFO juju.worker.uniter context.go:203 skipped
> "config-changed" hook (not implemented)
> 2013-10-09 14:20:56 INFO juju.worker.uniter uniter.go:362 ran
> "config-changed" hook
> 2013-10-09 14:20:56 INFO juju.worker.uniter uniter.go:369 committing
> "config-changed" hook
> 2013-10-09 14:20:57 INFO juju.worker.uniter uniter.go:387 committed
> "config-changed" hook
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter modes.go:410
> ModeConfigChanged exiting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:408 ModeContinue
> starting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:79 continuing after
> "config-changed" hook
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter modes.go:410 ModeContinue
> exiting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:408 ModeStarting
> starting
> 2013-10-09 14:20:57 INFO juju.worker.uniter uniter.go:354 running "start"
> hook
> *2013-10-09 14:20:57 INFO juju.worker.uniter context.go:234 "HOOK mount:
> proc already mounted"*
> 2013-10-09 14:20:57 INFO juju.worker.uniter uniter.go:362 ran "start" hook
> 2013-10-09 14:20:57 INFO juju.worker.uniter uniter.go:369 committing
> "start" hook
> 2013-10-09 14:20:57 INFO juju.worker.uniter uniter.go:387 committed
> "start" hook
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter modes.go:410 ModeStarting
> exiting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:408 ModeContinue
> starting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:79 continuing after
> "start" hook
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter modes.go:410 ModeContinue
> exiting
> 2013-10-09 14:20:57 INFO juju.worker.uniter modes.go:408 ModeAbide starting
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter.filter filter.go:382 want
> forced upgrade false
> 2013-10-09 14:20:57 DEBUG juju.worker.uniter.filter filter.go:486 no new
> charm event
>
>
>
> Thanks
> saurabh.
>
> --
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20131010/eb5294c1/attachment-0001.html>
More information about the Juju
mailing list