[lxc-users] "failed to create lock" error inside a tox virtual env

Benoit Barthelet benoit.barthelet at gmail.com
Tue Apr 25 11:46:56 UTC 2017


I got around the issue, just replying to myself if this happens to someone
else.

The solution is simply to add passenv = * in tox.ini so that now the
installation of lxc has the needed env parameters.
What is annoying though is that without passing it there's absolutely no
way to know the lxc bindings installation wasn't done "properly".

dev-requirements.txt
pytest
click
git+git://github.com/lxc/lxc.git@master#subdirectory=src/python-lxc

tox.ini
[tox]
envlist = py35

[testenv]
passenv =
    *
deps = -rdev-requirements.txt
commands = python -m pytest {posargs} -s -vv

On Tue, Apr 25, 2017 at 11:40 AM, Benoit Barthelet <
benoit.barthelet at gmail.com> wrote:

> I'm trying to run python tests in virtualenv with tox and got this error:
>
> failed to create lock
> RuntimeError: Container_init:lxc.c:542: error during init for container
> '47a1e552-299a-11e7-a6f1-f832e4beeab7'.
>
> however my tests run fine with "pytest tests -s -v"
>
> I'm not sure that is the root of my issue, but the difference i see
> between the working setup and the failing automatized one using tox, is
> that lxc_global_config_value is not set to the correct value when I use
> tox.
>
> If I add this little print debug in the __init__ line 31 (
> https://github.com/lxc/lxc/blob/master/src/python-lxc/lxc/__init__.py#L31)
>
> default_config_path = _lxc.get_global_config_item("lxc.lxcpath")
> print('LXCPATH: {}'.format(default_config_path))
>
> then I got when I run pytest tests/ -s -v
> LXCPATH: /home/lotso/.local/share/lxc
>
> but when I run tox I have
> LXCPATH: //.local/share/lxc
>
> I dont know if it's because of a failed installation of lxc within tox or
> if that means the get_global_config_item function has an issue.
>
> I'm no tox pro, but if anyone would have an idea or pointers at where to
> look at I'd be interested.
>
>
> --
> benoit barthelet
> http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
>



-- 
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170425/3d4bf016/attachment-0001.html>


More information about the lxc-users mailing list