service with shared libraries
Loïc Minier
loic.minier at ubuntu.com
Wed Apr 15 13:44:15 UTC 2015
(Did further debugging with Andrei yesterday, and this turned out to be an
issue with the app being run as a service because stdin was closed,
triggering a segfault in a code path.)
Cheers,
On Mon, Apr 13, 2015 at 12:27 PM, Andrei Porumb <anporumb at microsoft.com>
wrote:
> Hello all,
>
>
>
> I need to use Ubuntu Snappy to develop a service. The
> service has "special communication needs"... err... AMQP... so it needs a
> shared library to do so.
>
>
>
> The code is written in C. For the executable to load the
> shared library, it needs to have set LD_LIBRARY_PATH. So the service is
> started by a bash script that doesn't do much, except:
>
>
>
> #!/bin/sh
>
> export LD_LIBRARY_PATH=./bin
>
> ./bin/FunkyTv
>
> echo this line should never be executed.
>
>
>
> This is the content of package.yaml
>
>
>
> name: simplesampleamqp
>
> version: 45
>
> icon: meta/icon.png
>
> maintainer: anporumb at microsoft.com
>
> services:
>
> - name: sum
>
> description: SomeService
>
> start: bin/sum.sh
>
> caps: networking
>
>
>
> Problem: the service doesn't start.
>
>
>
> Observations: if the app is run from the command line (as a regular app),
> the app runs just fine and performs as expected.
>
> When run as a service, there's no life.
>
>
>
> Journalctl helps a little here, and this is the output:
>
>
>
>
>
> ubuntu at localhost:/apps/simplesampleamqp/current$ sudo journalctl -f -u
> simplesampleamqp_sum_45
>
> -- Logs begin at Sun 2015-04-12 16:33:29 UTC. --
>
> Apr 13 16:59:12 localhost.localdomain systemd[1]: Started SomeService.
>
> Apr 13 16:59:12 localhost.localdomain systemd[1]: Starting SomeService...
>
> Apr 13 16:59:12 localhost.localdomain sum.sh[2920]: Segmentation fault
>
> Apr 13 16:59:12 localhost.localdomain sum.sh[2920]: this line should never
> be executed.
>
>
>
> The segmentation fault happens (as far as I can tell) before the first
> line in main. Since this is C code (as opposed to C++) there cannot be
> other code executed before main.
>
>
>
> Further investigation revealed that in the small script that attempts to
> start the service there cannot be just any command. For example, "ldd"
> cannot be there (if it is, there's going to be a DENIAL something like :
> Apr 12 19:53:10 localhost.localdomain kernel: audit: type=1400
> audit(1428868390.904:62): apparmor="DENIED" operation="exec"
> profile="simplesampleamqp_sum_44" name="/usr/bin/ldd" pid=2310
> comm="sum.sh" requested_mask="x" denied_mask="x" fsuid=0 ouid=0). Echo is
> fine to be in the script...
>
>
>
> I guess it all boils down to: how does one write some service in C that
> needs some shared libraries and loads them and executes? As an "app" the
> executable runs fine...
>
>
>
>
>
> Any hints/help is greatly appreciated.
>
>
>
> Best Regards,
>
> Andrei Porumb
>
>
>
>
>
>
>
> --
> snappy-app-devel mailing list
> snappy-app-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snappy-app-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snappy-app-devel/attachments/20150415/f27ffa59/attachment.html>
More information about the snappy-app-devel
mailing list