java not working in chrooted environment

Saurabh saurabh.kumar at techblue.co.uk
Thu Oct 10 08:37:02 UTC 2013


Hi Andrew,
Thanks for your time, but juju ssh <unit> does not run in my setup. It 
gives the following error.

"Warning: Permanently added '10.0.3.236' (ECDSA) to the list of known hosts.
Permission denied (publickey).
error: exit status 255"

And yes I know that the machines that gets created by juju are lxc 
containers, and my concern is when they have proc already mounted then 
why does the install hook fails to load java?


Thanks
Saurabh.

On 10/10/13 08:39, Andrew Wilkins wrote:
> On Wed, Oct 9, 2013 at 11:04 PM, Saurabh <saurabh.kumar at techblue.co.uk 
> <mailto: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 <mailto:Juju at lists.ubuntu.com>
>     Modify settings or unsubscribe at:
>     https://lists.ubuntu.com/mailman/listinfo/juju
>
>


-- 
Saurabh Kumar


            (RHCSA,RHCE,RHCVA)


System Administrator
FOR AND ON BEHALF OF:

Technology Blueprint Ltd
23 Clemens Street
Royal Leamington Spa
Warwickshire CV31 2DW

E: saurabh.kumar at techblue.co.uk W: www.technologyblueprint.co.uk 
www.propco.co.uk


            The contents of this email are confidential and may be
            privileged, and are intended only for the use of the person
            or company named herein. Any views or opinions presented are
            solely those of the author and do not necessarily represent
            those of Technology Blueprint Limited. If you are not the
            intended recipient of this email or a person responsible for
            delivering it to the intended recipient, you are hereby
            notified that any distribution, copying or dissemination of
            the information herein is strictly prohibited

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20131010/d839fbe3/attachment-0001.html>


More information about the Juju mailing list