Repository navigation
Closed
Description
Happy to be proven wrong here, but from my best understanding, calls to lxc.init will always fail as long as it attempts to remove the seed marker prior to starting the container.
remove_seed_marker is set to True at:
https://github.com/saltstack/salt/blob/develop/salt/modules/lxc.py#L1197
The bit that looks like it could use some reordering is:
https://github.com/saltstack/salt/blob/develop/salt/modules/lxc.py#L1230-L1259
Steps to reproduce:
$ salt-call lxc.init testbuntu template=ubuntu options="{'release':'trusty', 'arch': 'amd64'}"
First failure is in attachable()
[ERROR ] Command 'lxc-attach --clear-env -n testbuntu -- /usr/bin/env' failed with return code: 1
Versions report:
$ salt --versions-report
Salt: 2015.5.0
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: 0.9.1
Debian source package: 2015.5.0+ds-1trusty1
Metadata
Metadata
Assignees
Labels
P3Priority 3PlatformRelates to OS, containers, platform-based utilities like FS, system based appsbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Activity
kiorky commentedon May 15, 2015
You are totally wrong:
kiorky commentedon May 15, 2015
(The seeding is meant to be used from the lxc runner) ...
cheuschober commentedon May 15, 2015
@kiorky, Ok. I get that -- what about the steps to reproduce? If the error is misidentified, that makes sense -- still can't init a container.
kiorky commentedon May 15, 2015
http://docs.saltstack.com/en/latest/topics/tutorials/lxc.html#initializing-a-new-container-as-a-salt-minion
runner part.
kiorky commentedon May 15, 2015
I think you may also have been misleaded from false positive debug output.
For exemple, the one you are giving is coming from here :
https://github.com/saltstack/salt/blob/develop/salt/modules/lxc.py#L2853
This tests if the container is attacheable yet but is not a failure, even if it outputs something to your logs.
cheuschober commentedon May 15, 2015
@kiorky Still failed...
lxc.sls
cheuschober commentedon May 15, 2015
The runner in the above scenario can't even fin the profile in pillar. I noticed, however, the documentation diverges in how to name the profiles between the example at:
http://docs.saltstack.com/en/latest/topics/tutorials/lxc.html#creating-a-container-on-the-cli
and
http://docs.saltstack.com/en/latest/topics/tutorials/lxc.html#tutorial-lxc-profiles-container
cheuschober commentedon May 15, 2015
Minnion error log as below:
cheuschober commentedon May 15, 2015
@kiorky If the
attachable()issue is easily ignored, then should I assume thecommand -vcall is really the problem here?I did a manual attach and ran that command and it executed flawlessly but it won't run as above.
[-]lxc.init fails: lxc module attempts to run commands before starting container[/-][+]lxc.init fails to bootstrap image[/+][-]lxc.init fails to bootstrap image[/-][+]lxc.init fails to bootstrap container[/+]kiorky commentedon May 15, 2015
just paste somewhere a full execution log if you are not able to interpret it.
I doubt there is a bug, i use it daily (salt/develop branch) but we also made sure with @terminalmage to have something stabilized in stable/2015.*.
kiorky commentedon May 15, 2015
run with -lall (loglevel: all)
kiorky commentedon May 15, 2015
i personally call the exec mod lxc.init from the runner lxc.cloud_init function.
let me check (that's no how i use it personally, i have another internal interface to setup settings, that i feed the function with).
kiorky commentedon May 15, 2015
removed comment: useless
99 remaining items
cheuschober commentedon May 31, 2015
@kiorky I do but let me do just a little more testing to confirm it's not me -- the issue I had was partly with bootstrap. I had minions pre-seeded in my lxc templates and the bootstrap script wasn't taking the "-C" argument to just set master and other configuration options. I hadn't formally reported it if only because this could be an edge-case with the bootstrap script's autodetection or with the lxc runner's seeding options and I wanted to be sure.
kiorky commentedon Jun 1, 2015
@cheuschober did you saw #24126 , that may be of interrest.
cheuschober commentedon Jun 27, 2015
@kiorky Apologies for taking so long to get back to this but I finally found some time to start debugging and will be doing so all weekend. The first bug I encountered was using lxc init with a default bridge on lxc v1.0.7
In this case the config does not have
lxc.network.ipv4and it is illegal to havelxc.network.ipv4.gatewaywhenlxc.network.ipv4is not set (container will not start).A (potential) suggested fix is:
cheuschober commentedon Jun 30, 2015
I think that's the last major bug I encountered on the 2015.5.X branch.
jpic commentedon Aug 5, 2015
That patch does indeed let salt-cloud start lxc instances, but then it fails as such:
Apparently the "then" statement is outside the command because of
;....aleufroy commentedon May 11, 2016
Hi,
I'm not really sure it's related but I have troubles with lxc-cloud also:
/etc/salt/cloud.providers.d/localhost.provider.conf:/srv/salt/containers.sls:Then I performed a
salt padian state.apply containerswhich results in a "Invalid return for nginx_container: ERROR: nginx_container is not attachable. {'padian': {'ret': 'ERROR: nginx_container is not attachable.', 'out': 'nested'}}".Looking in the log of the minion I found an python traceback ending with:
After some code inspection, I found that the minion fails to execute the following command (return code -11):
This command succeed when I Iaunch it manually, returning:
But It fails when I try:
$ salt padian cmd.run 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin -n nginx_container -- df /' padian:I've to specify
use_vt=true:salt padian cmd.run 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin -n nginx_container -- df /' use_vt=true padian: Filesystem 1K-blocks Used Available Use% Mounted on /var/lib/lxc/jessie-base/rootfs 482316904 29611404 428182136 7% /stale commentedon May 6, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.