0
votes

It looks like I have some sort of permissions problem with kubectl. I have a Docker image, that contains server with native dynamic library + gdbserver. When I'm trying to debug Docker container running on my local machine all is fine. I'm using the following workflow:

  1. start gdb
  2. target remote | docker exec -i CONTAINER gdbserver - --attach PID
  3. set sysroot /path/to/local/binary
  4. Good to go!

But when I'm trying to do such operation with kubectl I'm getting the following error:

Cannot attach to lwp 7: Operation not permitted (1) Exiting Remote connection closed

The only difference is step 2: target remote | kubectl exec -i POD -- gdbserver - --attach PID

1
Can you try kubectl exec -it POD bash and then gdbserver --attach. This will make debugging easier for you. - ignite
@ignite Thanks for response! Unfortunately I've got the same result. Cannot attach to lwp 7: Operation not permitted (1) - vglazkov

1 Answers

0
votes

I think you might need to add ptrace() capabilities and seccomm profile in your yaml file.

--cap-add sys_ptrace