How do I share a namespace between snap commands?

Jamie Strandboge jamie at canonical.com
Wed Jul 27 17:30:37 UTC 2016


On Wed, 2016-07-27 at 12:03 -0500, Jamie Strandboge wrote:
> On Wed, 2016-07-27 at 15:50 +0000, David Garrod wrote:
> ...
> > 
> > 
> > The important point here is that there are multiple commands that are part
> > of
> > the snap. I start our snap using the command:
> > 
> > sudo /snap/bin/openswitch-appliance.start-openswitch
> > 
> > Inside the SNAP this creates a couple of namespaces (swns and nonet):
> > 
> > /sbin/ip netns add swns
> > /sbin/ip netns add nonet
> > 
> > The problem is that if I then start up another command in the SNAP,
> > specifically a bash shell using:
> > 
> > sudo /snap/bin/openswitch-appliance.bash
>
> To the point, the design of snappy is precisely so that apps within the same
> snap can work together (but also interact with other snaps in controlled ways
> via interfaces).

John Lenton mentioned to me on IRC that this might be that you are trying to
call applications from /snap/bin from within your snap, but it isn't clear to me
that this is what you are doing.

Just in case, all apps within a snap may execute anything in $SNAP, $SNAP_DATA
and $SNAP_USER_DATA and these directories are shared among all apps within the
same snap. Apps are not allowed to execute anything in /snap/bin (their own or
otherwise). If you are trying to run things in /snap/bin, simply adjust your
snap to run your executables directly, ideally referencing the various $SNAP*
environment variables.

(If you are unfamiliar with the $SNAP* environment variables, within your bash
app do 'set|grep SNAP' or install hello-world and run 'hello-world.env').

-- 
Jamie Strandboge             | http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160727/4592a74d/attachment.sig>


More information about the Snapcraft mailing list