attach: ptrace(PTRACE_ATTACH, …): Operation not permitted

Cause:

The error is common because strace process is already running in the background

[oracle@exdbadm01 ~]$ strace -rp 6307 -o lb.trc
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted

Workaround:

Check the existing strace process using ps and note the pid

[root@exdbadm01 oracle]# ps aux | grep "strace"
oracle    6879  0.0  0.0   4140   640 pts/1    T    01:11   0:00 strace -rp 6307

Kill the process using process id

[root@exdbadm01 oracle]# kill -9 6879

Strace works fine now

[root@exdbadm01 oracle]# strace -rp 6307 -o lb.trc
Process 6307 attached - interrupt to quit

Leave a Reply