Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't it work if the parent has child processes? #84

Open
manjusm opened this issue Jun 20, 2017 · 14 comments
Open

Doesn't it work if the parent has child processes? #84

manjusm opened this issue Jun 20, 2017 · 14 comments

Comments

@manjusm
Copy link

manjusm commented Jun 20, 2017

~/reptyr-master$ ./reptyr 946227
[-] Process 946489 (gmake) shares 946227's process group. Unable to attach.
(This most commonly means that 946227 has sub-processes).
Unable to attach to pid 946227: Invalid argument

Regards,
Manju

@nelhage
Copy link
Owner

nelhage commented Jun 20, 2017 via email

@SRGOM
Copy link

SRGOM commented Jul 9, 2017

For me, scala programs run using sbt fail to re-attach despite trying -T on parent sbt process.

@wsdjeg
Copy link

wsdjeg commented Jul 22, 2017

now neovim and vim8 support job, so they have suprocesses.
when I use this tools I get:

[-] Process 8411 (python2) shares 8407's process group. Unable to attach.
(This most commonly means that 8407 has suprocesses).
Unable to attach to pid 8407: Invalid argument

@olaulau
Copy link

olaulau commented Aug 17, 2018

same with rsync :-(

@BarbzYHOOL
Copy link

BarbzYHOOL commented Aug 18, 2018

I get this when trying the -T Child is not connected to a pseudo-TTY. Unable to steal TTY the process was started with the "at" command though :D

@jglapa
Copy link

jglapa commented Dec 28, 2018

I have the same problem when I start a command with sudo that spans a new subprocess with the actual command

@michaelpalumbo
Copy link

michaelpalumbo commented Sep 19, 2019

did you try the -T command? see #24

it worked for me on raspbian lite where I had started a process over ssh and then ran

sudo reptyr PID -T

note that there seemed to be no response in the terminal on the target machine for a few minutes, until it finally began printing the stdout. just writing this to encourage patience :)

Many thanks @nelhage for reptyr and providing the -T -- now I can leave for and not worry about restarting an already 10-hour make process on an rpi zero...

@SR-G
Copy link

SR-G commented Jan 14, 2020

I'm trying to recover a process still running in a docker container and started through "docker exec" (the global window has been lost, but the execution is still running in the background, and i would have been willing to recover the output as it's a very long processing).

By default (without any paramters), reptyr fives the same error messages about child processes, but when using the -T feature, i get something else, does anyone have an idea about it ? (of course i'm still logged inside the container as the same user, which in my case - this is a test container - is the root account (UID=GID=0)

root@7de93b6ab1af:~# reptyr 4863 -T
Unable to attach to pid 4863: Operation not permitted
The kernel denied permission while attaching. If your uid matches
the target's, check the value of /proc/sys/kernel/yama/ptrace_scope.
For more information, see /etc/sysctl.d/10-ptrace.conf 

(i have the value 1 in the referenced file, but i'm not sure what it may mean)

Maybe it's just related to how docker works ? (that is, reptyr inside the container is trying to access some processes informations only owned by the underlying kernel ? (hence the errors)

@mihaitodor
Copy link

@SR-G It might be due to not starting the container with --privileged (or maybe --cap-add=SYS_PTRACE is sufficient), since reptyr seems to depend on ptrace. I wonder if it might be possible to call reptyr from the host directly, but I wasn't successful when trying in a DinD container... Would be cool to have support for this, though :)

@darioackermann
Copy link

@SR-G Not sure if this still is a topic for you, probably not, but the value in the referenced file (ptrace_scope) should be 0 AFAIK.

@cormacncheese
Copy link

Any update on this error?

Child is not connected to a pseudo-TTY. Unable to steal TTY.

@HenkPoley
Copy link

HenkPoley commented Jul 23, 2023

Maybe add a hint that -T might work to the "This most commonly means that" message ?

You might want to suggest to use pstree --show-pids to trace to the highest shell process to 'steal TTY' from.

@wuzirui
Copy link

wuzirui commented Mar 4, 2024

did you try the -T command? see #24

it worked for me on raspbian lite where I had started a process over ssh and then ran

sudo reptyr PID -T

note that there seemed to be no response in the terminal on the target machine for a few minutes, until it finally began printing the stdout. just writing this to encourage patience :)

Many thanks @nelhage for reptyr and providing the -T -- now I can leave for and not worry about restarting an already 10-hour make process on an rpi zero...

Hi @michaelpalumbo! I've tried the command and it does not work, do you have any idea? Thanks!

> sudo reptyr 1290042 -T
Unable to attach to pid 1290042: Permission denied

the process (1290042) is created by:

sudo cp /deva /devb

@cooljeanius
Copy link

I think this issue is the one currently preventing me from using this with the GCC testsuite on the GCC compile farm; the -T option doesn't help...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests