Reputation: 1
I am trying to do a kind of analyzer. To do that I need to work with different distributions I decided on trying chroot. What im trying to do is,
I have checked out pychroot. It basically works as context manager.
However, when I enter into Chroot context and run apt-get install
. The script execution freezes. When I check the Chroot, I find that the package is installed. But I end up killing processes eventually.
Below, you can find a simplified example of code that freezes:
with Chroot(path) as chroot:
subprocess.run(installation_command)
When strace the frozen apt-get
subprocess, I get the following output:
(.venv) user@server:$ ps aux | grep apt
root 2797755 0.4 0.1 62656 53380 pts/17 T 08:58 0:00 apt-get install -y bluez-dbg
fatih.d+ 2798237 0.0 0.0 8964 656 pts/16 R+ 09:00 0:00 grep --color=auto apt
(.venv) user@server:$ sudo strace -p 2797755
strace: Process 2797755 attached
--- stopped by SIGTTOU ---
(.venv) user@server:$ ps aux | grep python
root 2797660 0.2 0.4 339364 133848 pts/17 S 08:58 0:01 python test.py
root 2797740 0.0 0.3 339364 101696 pts/17 S 08:58 0:00 python test.py
root 2797746 0.0 0.3 339364 101400 pts/17 S 08:58 0:00 python test.py
root 2797749 0.0 0.3 339364 102344 pts/17 T 08:58 0:00 python test.py
(.venv) user@server:$ sudo strace -p 2797660
strace: Process 2797660 attached
read(7, ^Cstrace: Process 2797660 detached
<detached ...>
(.venv) user@server:$ sudo strace -p 2797740
strace: Process 2797740 attached
wait4(-1, ^Cstrace: Process 2797740 detached
<detached ...>
(.venv) user@server:$ sudo strace -p 2797746
strace: Process 2797746 attached
wait4(-1, ^Cstrace: Process 2797746 detached
<detached ...>
(.venv) user@server:$ sudo strace -p 2797749
strace: Process 2797749 attached
--- stopped by SIGTTOU ---
^Cstrace: Process 2797749 detached
Upvotes: 0
Views: 232