The system does not allow connecting debuggers to processes (Fedora, Ubuntu)

The Ubuntu ptrace scope control feature only allows a process to attach to other processes that it has launched directly.

See https://wiki.ubuntu.com/Security/Features#ptrace for more details.

Solution

  • To disable this feature until the next reboot, run the following command:

    echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
    
  • To disable the feature permanently, add this line to /etc/sysctl.d/10-ptrace.conf or /etc/sysctl.conf:

    kernel.yama.ptrace_scope = 0
    

    This takes effect after the next reboot.

Note

On Fedora, ptrace might be blocked by SELinux and Yama. See The system does not allow connecting debuggers to processes (Fedora, Red Hat) for more information.