pkgcore / pychroot

a python library and cli tool that simplify chroot handling
https://pkgcore.github.io/pychroot/
BSD 3-Clause "New" or "Revised" License
32 stars 7 forks source link

Fails when run from inside a non-pychroot chroot #21

Closed tlhonmey closed 8 years ago

tlhonmey commented 8 years ago

Running pychroot from within a chroot fails with the following:

 # pychroot nvros-base
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/snakeoil/contexts.py", line 84, in __enter__
    self.child_setup()
  File "/usr/lib64/python2.7/site-packages/pychroot/base.py", line 101, in child_setup
    simple_unshare(pid=True, hostname=self.hostname, **kwargs)
  File "/usr/lib64/python2.7/site-packages/snakeoil/process/namespaces.py", line 332, in simple_unshare
    _mount(None, '/', None, MS_REC | MS_SLAVE)
  File "/usr/lib64/python2.7/site-packages/snakeoil/osutils/__init__.py", line 105, in _wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/snakeoil/osutils/mount.py", line 55, in mount
    raise OSError(e, os.strerror(e))
OSError: [Errno 22] Invalid argument

On further testing, it has the same problem if the outer chroot is a pychroot. If this can't be made to work, it would be nice if it at least failed with a sensible error message.

radhermit commented 8 years ago

This should be fixed via https://github.com/pkgcore/snakeoil/commit/3737b2b7e340e828697b98e4e63c0b1e6a656afd and be in the next snakeoil release.

radhermit commented 8 years ago

snakeoil-0.7.1 is out now with the fix, if you have issues let me know.