pkgcore / pychroot

a python library and cli tool that simplify chroot handling

Home Page:https://pkgcore.github.io/pychroot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails when running as root

ERROR-404-NULL-NOT-FOUND opened this issue · comments

commented
sudo python
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pychroot
>>> with pychroot.Chroot('/mnt/gentoo'):
...      print('test')
... 
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pychroot/utils.py", line 109, in bind
    mount(source=src, target=dest, fstype=fstype,
  File "/usr/lib/python3.10/site-packages/snakeoil/osutils/__init__.py", line 99, in _wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/snakeoil/osutils/mount.py", line 52, in mount
    raise OSError(e, os.strerror(e))
OSError: [Errno 16] Device or resource busy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/snakeoil/contexts.py", line 133, in __enter__
    self._child_setup()
  File "/usr/lib/python3.10/site-packages/pychroot/base.py", line 105, in _child_setup
    self._mount()
  File "/usr/lib/python3.10/site-packages/pychroot/base.py", line 137, in _mount
    bind(src=source, dest=chrmount, chroot=self.path, log=self.log, **opts)
  File "/usr/lib/python3.10/site-packages/pychroot/utils.py", line 118, in bind
    raise ChrootMountError(
pychroot.exceptions.ChrootMountError: failed mounting: mount -t sysfs sysfs /mnt/gentoo/sys: Device or resource busy

[2]+  Stopped                 sudo python