New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spread (via snap) exec: "lxc": executable file not found in $PATH #11

Open
ryan-beisner opened this Issue Aug 26, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@ryan-beisner
Copy link

ryan-beisner commented Aug 26, 2016

Cannot allocate lxd:ubuntu-16.04: cannot launch lxd container: exec: "lxc": executable file not found in $PATH

I was looking to start using spread very soon while we're redeploy some ci infra. I've got a fresh Xenial instance. I can launch and list lxc a-ok as my user, but can't get spread to do the examples.

It has the same error whether installed in strict or in dev mode.

ubuntu@osci-slavehost:~/temp⟫ tree
.
├── examples
│   └── hello
│       └── task.yaml
└── spread.yaml

2 directories, 3 files


ubuntu@osci-slavehost:~/temp⟫ head -n999 examples/hello/task.yaml spread-hello.yaml spread.yaml 
==> examples/hello/task.yaml <==
summary: Greet the planet
environment:
    GREETING: Hello
    GREETING/bar: Goodbye
    SUBJECT/baz: world
execute: |
    echo "$GREETING $SUBJECT!"
    exit 1


==> spread.yaml <==
project: hello-world

backends:
    lxd:
        systems:
            - ubuntu-16.04

suites:
    examples/:
        summary: Simple examples
        environment:
            SUBJECT/foo: sanity
            SUBJECT/bar: lunacy

path: /remote/path


ubuntu@osci-slavehost:~/temp⟫ lxc list
+-----------------------+---------+------------------+------+------------+-----------+
|         NAME          |  STATE  |       IPV4       | IPV6 |    TYPE    | SNAPSHOTS |
+-----------------------+---------+------------------+------+------------+-----------+
| intergalactic-shellie | RUNNING | 10.0.8.45 (eth0) |      | PERSISTENT | 0         |
+-----------------------+---------+------------------+------+------------+-----------+

# ^ lxc unit created by ubuntu user manually


ubuntu@osci-slavehost:~/temp⟫ spread -list
lxd:ubuntu-16.04:examples/hello:baz
lxd:ubuntu-16.04:examples/hello:bar
lxd:ubuntu-16.04:examples/hello:foo
ubuntu@osci-slavehost:~/temp⟫ spread -v
2016/08/26 00:14:57 Found /home/ubuntu/temp/spread.yaml.
2016/08/26 00:14:57 Allocating lxd:ubuntu-16.04...
2016/08/26 00:14:57 Cannot allocate lxd:ubuntu-16.04: cannot launch lxd container: exec: "lxc": executable file not found in $PATH
2016/08/26 00:14:57 Successful tasks: 0
2016/08/26 00:14:57 Aborted tasks: 3
error: unsuccessful run


1 ubuntu@osci-slavehost:~/temp⟫ snap list
Name         Version     Rev  Developer  Notes
spread       2016.08.23  11   niemeyer   -
ubuntu-core  16.04.1     216  canonical  -
@ryan-beisner

This comment has been minimized.

Copy link

ryan-beisner commented Aug 26, 2016

FYI: My use case is to use LXD local, and prefer to consume spread by snaps.

@nuclearbob

This comment has been minimized.

Copy link

nuclearbob commented Oct 25, 2016

I'm having the same issue on dev/zesty:
max@eden:~/workspace.d$ snap list
Name Version Rev Developer Notes
spread 2016.10.05 23 niemeyer -
ubuntu-core 16.04.1 423 canonical -

@stub42

This comment has been minimized.

Copy link

stub42 commented Nov 21, 2016

Assuming this is a snap confinement issue, is there a PPA available as a work around? I haven't found install instructions anywhere detailing supported installation methods

@morphis

This comment has been minimized.

Copy link
Contributor

morphis commented Dec 6, 2016

I guess the problem here is that spread is installed from a snap and that spread binary can't access the lxc binary from the host as this is a general thing snaps can't do. Same problem applies for the qemu backend.

The only way out is to build spread on your own and copy it somewhere into your $PATH

$ mkdir work
$ export GOPATH=`pwd`/work
$ go get -d -v github.com/snapcore/snapd/...
$ go build github.com/snapcore/spread/cmd/spread
$ sudo cp spread /usr/local/bin

RAOF added a commit to RAOF/spread that referenced this issue Nov 13, 2017

Fix LXD backend when run as a snap (Issue snapcore#11).
Snaps can't access binaries outside their shipped rootfs, so ship the lxc command
in the snap.

This requires that the user manually connect the lxd interface, but that's unavoidable.

RAOF added a commit to RAOF/spread that referenced this issue Jan 4, 2018

Fix LXD backend when run as a snap (Issue snapcore#11).
Snaps can't access binaries outside their shipped rootfs, so ship the lxc command
in the snap.

This requires that the user manually connect the lxd interface, but that's unavoidable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment