How can I use systemtap(stap) in the centos container in docker for mac

1.4k views Asked by At

When I use stap, it tell me this error as the image,how can i fix it.

screenshot from error

1

There are 1 answers

0
Naremy On

Really don't know why this question has been downvotted once. When i get concern, downvotter are one of the reason i always hesitate to ask thing on stackoverflow...

So, got the same concern with a container under ubuntu and it is how i fix it : try to launch an ubuntu bash on docker (not centos but the step should be similar)

docker run -it --cap-add sys_admin ubuntu bash

Then install some library and systemtap

apt-get update
apt-get --yes install build-essential cmake bc curl diffutils git kmod libcurl4-openssl-dev wget
apt-get --yes install systemtap systemtap-sdt-dev

Now install the kernel headers (will take time)

export KERNELVER=$(uname -r  | cut -d '-' -f 1)
export KERNELDIR=/linux-$KERNELVER
cd /
curl -o linux-${KERNELVER}.tar.gz https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNELVER}.tar.gz
tar zxf linux-${KERNELVER}.tar.gz
cd linux-${KERNELVER}
zcat /proc/1/root/proc/config.gz > .config
make all
make modules_prepare
make headers_install
make modules_install

Now run stap -l 'syscall.*'. It should work and display :

...
syscall.waitpid
syscall.write
syscall.writev

This is taken from : https://github.com/fdebonneval/mobydig/blob/master/resources/build