gdb attach permission question (ptrace_scope is read-only)
6,653
In docker you can now use the --privileged
option, see https://docs.docker.com/engine/reference/commandline/exec/
docker exec --privileged -ti <container> bash
In privileged mode, gdb just works without any modifications to ptrace_scope.
Related videos on Youtube
Author by
Scott - Слава Україні
Updated on September 18, 2022Comments
-
Scott - Слава Україні over 1 year
When using gdb to attach to the process. It shows
Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.As root I use
echo 0 >/proc/sys/kernel/yama/ptrace_scope
; then it shows:bash: /proc/sys/kernel/yama/ptrace_scope: Read-only file system
How can I fix this problem? The content of
/etc/sysctl.d/10-ptrace.conf
iskernel.yama.ptrace_scope = 0
-
Admin almost 9 yearsCan you try attaching that process with
sudo
?. And for the Read-only system you just remount your rootfs usingsudo mount -o remount,rw /
and then try. -
Admin almost 9 yearsWhat kind of installation are you working on? Is this some kind of virtualized environment?
-