gdb cannot attach to process gdb cannot attach to process docker docker

gdb cannot attach to process


I modified /etc/sysctl.d/10-ptrace.conf

This will only take effect on next reboot.

Until then, just do sudo sysctl -w kernel.yama.ptrace_scope=0


Are you using a container engine? Try attaching to the process from the outside of the container (on the host); it may have a different PID there.

Alternatively, launch the container with the CAP_SYS_PTRACE capability (using --cap-add sys_ptrace, for example). Of course, if you cannot reproduce the hang, then you cannot use this approach.


@Ted @escapecharacter The kernel parameters you are referring to are taken from the host system that is why it is read-only, you cannot edit the actual config file from inside the container. you can override it in the container, just drop the -w flag to #sudo sysctl kernel.yama.ptrace_scope=0 . A permanent solution is to do this on the host node and all containers would inherit this by default.