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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s