[ad_1]
I am trying to use systemtap
to debug the kernel in the docker container, both docker host and container is based on CentOS 7(a bit difference: host:7.6, container:7.9) with kernel version of 5.4.142
I had installed the kernel devel from the host and copy the corresponding source into container ,the Dockerfile sinppet as follow:
COPY usr/src/kernels/$CORE_VERSION /usr/src/kernels/
RUN mkdir -p /usr/src/kernels/ /lib/modules/$CORE_VERSION/ \
&& ln -sf /usr/src/kernels/$CORE_VERSION /lib/modules/$CORE_VERSION/build
RUN yum install -y systemtap
When I am trying to test if everything works fine,the stap
unable to work properly with the following output:
root@localhost:/$ stap -v -e 'probe begin { printf("Hello, World!\n"); exit() }'
Pass 1: parsed user script and 473 library scripts using 171104virt/75048res/6540shr/68868data kb, in 510usr/30sys/539real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 172688virt/76488res/6668shr/70452data kb, in 10usr/0sys/8real ms.
Pass 3: translated to C into "/tmp/stap9zJPle/stap_90dcd5396e3d1eab74012be092c294cd_1021_src.c" using 172688virt/77484res/7436shr/70452data kb, in 0usr/0sys/0real ms.
In file included from <command-line>:0:0:
././include/linux/compiler_types.h:246:1: fatal error: /tmp/stap9zJPle/stapconf_4192a6168188ad613d079287c6bbfd7e_778.h: No such file or directory
#endif /* __LINUX_COMPILER_TYPES_H */
^
compilation terminated.
In file included from <command-line>:0:0:
././include/linux/compiler_types.h:246:1: fatal error: /tmp/stap9zJPle/stapconf_4192a6168188ad613d079287c6bbfd7e_778.h: No such file or directory
#endif /* __LINUX_COMPILER_TYPES_H */
^
compilation terminated.
make[2]: *** [/tmp/stap9zJPle/stap_90dcd5396e3d1eab74012be092c294cd_1021_src.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [/tmp/stap9zJPle/stap_90dcd5396e3d1eab74012be092c294cd_1021_aux_0.o] Error 1
make[1]: *** [/tmp/stap9zJPle] Error 2
make: *** [sub-make] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_90dcd5396e3d1eab74012be092c294cd_1021.ko" in 730usr/460sys/1115real ms.
Pass 4: compilation failed. [man error::pass4]
My question is that:
- Did i missing any dependency in the docker container
- I wonder if there is some officially or best practices for setting up kernel debugging environment in docker container
[ad_2]