How to run strace inside CoreOS toolbox container?

641 views Asked by At

I run coreos and need to run strace on a certain process. However:

strace -s 99 -ffp 8259
strace: attach: ptrace(PTRACE_SEIZE, 8259): Operation not permitted

I opened up the script that spins up the toolbox and found this:

sudo systemd-nspawn \
    --directory="${machinepath}" \
    --capability=all \
    --share-system \
    ${TOOLBOX_BIND} \
    --user="${TOOLBOX_USER}" "$@"

Which is a namespace container. It looks like a permissions issue but I don't know how to give my container permissions to attach strace to process outside of it. My CoreOS version: DISTRIB_RELEASE=1185.5.0

Any help is appreciated

1

There are 1 answers

3
Shachar Shemesh On

Short answer:

echo 0 > /proc/sys/kernel/yama/ptrace_scope

Longer answer here