Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed fetching headers #144

Closed
keyolk opened this issue Nov 4, 2020 · 3 comments
Closed

Failed fetching headers #144

keyolk opened this issue Nov 4, 2020 · 3 comments

Comments

@keyolk
Copy link

keyolk commented Nov 4, 2020

Hi.
I'm trying to use kubectl-trace on my single node microk8s env

My system is

$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

$ uname -r
5.8.17

$ ls -l /lib/modules/$(uname -r)
total 3448
lrwxrwxrwx  1 root root     19 Nov  1 12:56 build -> /home/keyolk/src/linux-stable
drwxr-xr-x 13 root root    141 Nov  1 13:57 kernel
-rw-r--r--  1 root root 874945 Nov  1 14:00 modules.alias
-rw-r--r--  1 root root 839183 Nov  1 14:00 modules.alias.bin
-rw-r--r--  1 root root   8196 Nov  1 13:55 modules.builtin
-rw-r--r--  1 root root  10534 Nov  1 14:00 modules.builtin.bin
-rw-r--r--  1 root root  62087 Nov  1 13:55 modules.builtin.modinfo
-rw-r--r--  1 root root 278851 Nov  1 14:00 modules.dep
-rw-r--r--  1 root root 389143 Nov  1 14:00 modules.dep.bin
-rw-r--r--  1 root root    405 Nov  1 14:00 modules.devname
-rw-r--r--  1 root root  99528 Nov  1 13:55 modules.order
-rw-r--r--  1 root root    521 Nov  1 14:00 modules.softdep
-rw-r--r--  1 root root 422542 Nov  1 14:00 modules.symbols
-rw-r--r--  1 root root 510124 Nov  1 14:00 modules.symbols.bin
lrwxrwxrwx  1 root root     19 Nov  1 13:55 source -> /home/keyolk/src/linux-stable

$ ls /usr/src/kernels/$(uname -r)
Kconfig  Makefile  default_cpio_list  gen_init_cpio.c  gen_initramfs.sh  include  initramfs_data.S

$ zcat /proc/config.gz | grep -iE 'bpf|btf'
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_LSM=y
CONFIG_BPF_SYSCALL=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
# CONFIG_BPFILTER is not set
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf"
CONFIG_DEBUG_INFO_BTF=y
CONFIG_BPF_EVENTS=y
# CONFIG_BPF_KPROBE_OVERRIDE is not set
CONFIG_TEST_BPF=m

$ kubectl-trace version
git commit: d34d1d586b110af718aeadc9f3213c78e543a961
build date: 2019-09-20 00:00:13 +0900 KST

What I did first run it without "--fetching header"

$ kubectl trace run dev-keyolk003-ncl -e "tracepoint:syscalls:sys_enter_* { @[probe] = count() }"
trace b89c8f3c-1e76-11eb-8da5-f670c888798e created

$ kubectl trace get
NAMESPACE       NODE                    NAME                                                    STATUS  AGE
default         dev-keyolk003-ncl       kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e      Failed  34m

$ kubectl trace logs kubectl-trace-b89c8f3c-1e76-11eb-8da5-f670c888798e
if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times
/bpftrace/include/clang_workarounds.h:14:10: fatal error: 'linux/types.h' file not found
exit status 1

then tried with "--fetch-headers"

$ kubectl trace run dev-keyolk003-ncl --fetch-headers -e "tracepoint:syscalls:sys_enter_* { @[probe] = count() }"
trace df593bfc-1e71-11eb-abba-f670c888798e created

$  kubectl trace get
NAMESPACE       NODE                    NAME                                                    STATUS  AGE
default         dev-keyolk003-ncl       kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e      Failed  22s

$ kubectl get pod
NAME                                                       READY   STATUS       RESTARTS   AGE
kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-hx4m9   0/1     Init:Error   0          35s
kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv   0/1     Init:Error   0          26s

$ kubectl describe pod kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv
Name:         kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv
Namespace:    default
Priority:     0
Node:         dev-keyolk003-ncl/10.113.85.167
Start Time:   Wed, 04 Nov 2020 16:46:48 +0900
Labels:       controller-uid=446013c5-4152-40c7-b325-bc711ea66115
              iovisor.org/kubectl-trace=kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
              iovisor.org/kubectl-trace-id=df593bfc-1e71-11eb-abba-f670c888798e
              job-name=kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
Annotations:  cni.projectcalico.org/podIP: 10.1.198.149/32
              cni.projectcalico.org/podIPs: 10.1.198.149/32
              iovisor.org/kubectl-trace: kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
              iovisor.org/kubectl-trace-id: df593bfc-1e71-11eb-abba-f670c888798e
Status:       Failed
IP:           10.1.198.149
IPs:
  IP:           10.1.198.149
Controlled By:  Job/kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
Init Containers:
  kubectl-trace-init:
    Container ID:   containerd://151cbfeafe487c560277a6074b15f1a4e8fa4024da6c8357beb32302762430e3
    Image:          quay.io/iovisor/kubectl-trace-init:latest
    Image ID:       quay.io/iovisor/kubectl-trace-init@sha256:5909add1e8b7cb1cca740bb587fc5f742c468e2b3dad49789660a47f14e7a1f5
    Port:           <none>
    Host Port:      <none>
    State:          Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 04 Nov 2020 16:46:50 +0900
      Finished:     Wed, 04 Nov 2020 16:46:55 +0900
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  1G
    Requests:
      cpu:        100m
      memory:     100Mi
    Environment:  <none>
    Mounts:
      /etc/lsb-release.host from lsb-release (ro)
      /etc/os-release.host from os-release (ro)
      /lib/modules from modules-dir (rw)
      /lib/modules.host from modules-host (ro)
      /usr/src/ from linux-headers-generated (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-hqfpf (ro)
Conditions:
  Type              Status
  Initialized       False
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  program:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
    Optional:  false
  usr-src-host:
    Type:          HostPath (bare host directory volume)
    Path:          /usr/src
    HostPathType:
  modules-host:
    Type:          HostPath (bare host directory volume)
    Path:          /lib/modules
    HostPathType:
  sys:
    Type:          HostPath (bare host directory volume)
    Path:          /sys
    HostPathType:
  lsb-release:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/lsb-release
    HostPathType:
  os-release:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/os-release
    HostPathType:
  modules-dir:
    Type:          HostPath (bare host directory volume)
    Path:          /var/cache/linux-headers/modules_dir
    HostPathType:
  linux-headers-generated:
    Type:          HostPath (bare host directory volume)
    Path:          /var/cache/linux-headers/generated
    HostPathType:
  default-token-hqfpf:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-hqfpf
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  44s   default-scheduler  Successfully assigned default/kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv to dev-keyolk003-ncl
  Normal  Pulling    43s   kubelet            Pulling image "quay.io/iovisor/kubectl-trace-init:latest"
  Normal  Pulled     42s   kubelet            Successfully pulled image "quay.io/iovisor/kubectl-trace-init:latest" in 951.832792ms
  Normal  Created    42s   kubelet            Created container kubectl-trace-init
  Normal  Started    42s   kubelet            Started container kubectl-trace-init

$ kubectl logs kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv -c kubectl-trace-init
+ LSB_FILE=/etc/lsb-release.host
+ OS_RELEASE_FILE=/etc/os-release.host
+ TARGET_DIR=/usr/src
+ HOST_MODULES_DIR=/lib/modules.host
++ uname -r
+ KERNEL_VERSION=5.8.17
+ [[ ! -e /lib/modules/.installed ]]
+ check_headers /lib/modules.host
+ modules_path=/lib/modules.host
++ uname -m
+ arch=x86_64
+ kdir=/lib/modules.host/5.8.17
+ [[ x86_64 == \x\8\6\_\6\4 ]]
+ arch=x86
+ [[ ! -e /lib/modules.host/5.8.17 ]]
+ [[ ! -e /lib/modules.host/5.8.17/source ]]
+ [[ ! -e /lib/modules.host/5.8.17/build ]]
+ return 1
+ install_headers
++ awk '/^NAME *= */ { gsub(/^NAME *= */, ""); print }' /etc/os-release.host
WARNING: Cannot find distro-specific headers for "CentOS Linux". Fetching generic headers.
+ distro='"CentOS Linux"'
+ case $distro in
+ echo 'WARNING: Cannot find distro-specific headers for "CentOS Linux". Fetching generic headers.'
+ install_generic_linux_headers
+ BUILD_DIR=/linux-generic-5.8.17
+ SOURCES_DIR=/usr/src/linux-generic-5.8.17
+ [[ ! -e /usr/src/linux-generic-5.8.17/.installed ]]
+ echo 'Installing kernel headers for generic kernel'
+ fetch_generic_linux_sources
++ echo 5.8.17
Installing kernel headers for generic kernel
++ awk '-vFS=[-+]' '{ print $1 }'
+ kernel_version=5.8.17
Fetching upstream kernel sources for 5.8.17.
++ echo 5.8.17
++ awk -vFS=. '{ print $1 }'
+ major_version=5
+ [[ 5.8.17 == *.0 ]]
+ echo 'Fetching upstream kernel sources for 5.8.17.'
+ mkdir -p /linux-generic-5.8.17
+ curl -sL https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.8.17.tar.gz
+ tar --strip-components=1 -xzf - -C /linux-generic-5.8.17
tar: invalid magic
tar: short read

real    0m5.067s
user    0m0.005s
sys     0m0.008s

Any hints to solve it?

@keyolk
Copy link
Author

keyolk commented Nov 4, 2020

seems that symlink /lib/modules/$(uname -r)/build make problem
after updating it, it solved : )

@keyolk keyolk closed this as completed Nov 4, 2020
@lu-you
Copy link

lu-you commented Jan 10, 2022

I don't quite understand what you mean, could you give me detailed instructions

Thanks very much!

@lu-you
Copy link

lu-you commented Jan 11, 2022

I don't quite understand what you mean, could you give me detailed instructions

Thanks very much!

Hi. I'm trying to use kubectl-trace on my single node microk8s env

My system is

$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

$ uname -r
5.8.17

$ ls -l /lib/modules/$(uname -r)
total 3448
lrwxrwxrwx  1 root root     19 Nov  1 12:56 build -> /home/keyolk/src/linux-stable
drwxr-xr-x 13 root root    141 Nov  1 13:57 kernel
-rw-r--r--  1 root root 874945 Nov  1 14:00 modules.alias
-rw-r--r--  1 root root 839183 Nov  1 14:00 modules.alias.bin
-rw-r--r--  1 root root   8196 Nov  1 13:55 modules.builtin
-rw-r--r--  1 root root  10534 Nov  1 14:00 modules.builtin.bin
-rw-r--r--  1 root root  62087 Nov  1 13:55 modules.builtin.modinfo
-rw-r--r--  1 root root 278851 Nov  1 14:00 modules.dep
-rw-r--r--  1 root root 389143 Nov  1 14:00 modules.dep.bin
-rw-r--r--  1 root root    405 Nov  1 14:00 modules.devname
-rw-r--r--  1 root root  99528 Nov  1 13:55 modules.order
-rw-r--r--  1 root root    521 Nov  1 14:00 modules.softdep
-rw-r--r--  1 root root 422542 Nov  1 14:00 modules.symbols
-rw-r--r--  1 root root 510124 Nov  1 14:00 modules.symbols.bin
lrwxrwxrwx  1 root root     19 Nov  1 13:55 source -> /home/keyolk/src/linux-stable

$ ls /usr/src/kernels/$(uname -r)
Kconfig  Makefile  default_cpio_list  gen_init_cpio.c  gen_initramfs.sh  include  initramfs_data.S

$ zcat /proc/config.gz | grep -iE 'bpf|btf'
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_LSM=y
CONFIG_BPF_SYSCALL=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
# CONFIG_BPFILTER is not set
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf"
CONFIG_DEBUG_INFO_BTF=y
CONFIG_BPF_EVENTS=y
# CONFIG_BPF_KPROBE_OVERRIDE is not set
CONFIG_TEST_BPF=m

$ kubectl-trace version
git commit: d34d1d586b110af718aeadc9f3213c78e543a961
build date: 2019-09-20 00:00:13 +0900 KST

What I did first run it without "--fetching header"

$ kubectl trace run dev-keyolk003-ncl -e "tracepoint:syscalls:sys_enter_* { @[probe] = count() }"
trace b89c8f3c-1e76-11eb-8da5-f670c888798e created

$ kubectl trace get
NAMESPACE       NODE                    NAME                                                    STATUS  AGE
default         dev-keyolk003-ncl       kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e      Failed  34m

$ kubectl trace logs kubectl-trace-b89c8f3c-1e76-11eb-8da5-f670c888798e
if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times
/bpftrace/include/clang_workarounds.h:14:10: fatal error: 'linux/types.h' file not found
exit status 1

then tried with "--fetch-headers"

$ kubectl trace run dev-keyolk003-ncl --fetch-headers -e "tracepoint:syscalls:sys_enter_* { @[probe] = count() }"
trace df593bfc-1e71-11eb-abba-f670c888798e created

$  kubectl trace get
NAMESPACE       NODE                    NAME                                                    STATUS  AGE
default         dev-keyolk003-ncl       kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e      Failed  22s

$ kubectl get pod
NAME                                                       READY   STATUS       RESTARTS   AGE
kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-hx4m9   0/1     Init:Error   0          35s
kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv   0/1     Init:Error   0          26s

$ kubectl describe pod kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv
Name:         kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv
Namespace:    default
Priority:     0
Node:         dev-keyolk003-ncl/10.113.85.167
Start Time:   Wed, 04 Nov 2020 16:46:48 +0900
Labels:       controller-uid=446013c5-4152-40c7-b325-bc711ea66115
              iovisor.org/kubectl-trace=kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
              iovisor.org/kubectl-trace-id=df593bfc-1e71-11eb-abba-f670c888798e
              job-name=kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
Annotations:  cni.projectcalico.org/podIP: 10.1.198.149/32
              cni.projectcalico.org/podIPs: 10.1.198.149/32
              iovisor.org/kubectl-trace: kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
              iovisor.org/kubectl-trace-id: df593bfc-1e71-11eb-abba-f670c888798e
Status:       Failed
IP:           10.1.198.149
IPs:
  IP:           10.1.198.149
Controlled By:  Job/kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
Init Containers:
  kubectl-trace-init:
    Container ID:   containerd://151cbfeafe487c560277a6074b15f1a4e8fa4024da6c8357beb32302762430e3
    Image:          quay.io/iovisor/kubectl-trace-init:latest
    Image ID:       quay.io/iovisor/kubectl-trace-init@sha256:5909add1e8b7cb1cca740bb587fc5f742c468e2b3dad49789660a47f14e7a1f5
    Port:           <none>
    Host Port:      <none>
    State:          Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 04 Nov 2020 16:46:50 +0900
      Finished:     Wed, 04 Nov 2020 16:46:55 +0900
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  1G
    Requests:
      cpu:        100m
      memory:     100Mi
    Environment:  <none>
    Mounts:
      /etc/lsb-release.host from lsb-release (ro)
      /etc/os-release.host from os-release (ro)
      /lib/modules from modules-dir (rw)
      /lib/modules.host from modules-host (ro)
      /usr/src/ from linux-headers-generated (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-hqfpf (ro)
Conditions:
  Type              Status
  Initialized       False
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  program:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e
    Optional:  false
  usr-src-host:
    Type:          HostPath (bare host directory volume)
    Path:          /usr/src
    HostPathType:
  modules-host:
    Type:          HostPath (bare host directory volume)
    Path:          /lib/modules
    HostPathType:
  sys:
    Type:          HostPath (bare host directory volume)
    Path:          /sys
    HostPathType:
  lsb-release:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/lsb-release
    HostPathType:
  os-release:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/os-release
    HostPathType:
  modules-dir:
    Type:          HostPath (bare host directory volume)
    Path:          /var/cache/linux-headers/modules_dir
    HostPathType:
  linux-headers-generated:
    Type:          HostPath (bare host directory volume)
    Path:          /var/cache/linux-headers/generated
    HostPathType:
  default-token-hqfpf:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-hqfpf
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  44s   default-scheduler  Successfully assigned default/kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv to dev-keyolk003-ncl
  Normal  Pulling    43s   kubelet            Pulling image "quay.io/iovisor/kubectl-trace-init:latest"
  Normal  Pulled     42s   kubelet            Successfully pulled image "quay.io/iovisor/kubectl-trace-init:latest" in 951.832792ms
  Normal  Created    42s   kubelet            Created container kubectl-trace-init
  Normal  Started    42s   kubelet            Started container kubectl-trace-init

$ kubectl logs kubectl-trace-df593bfc-1e71-11eb-abba-f670c888798e-5vpsv -c kubectl-trace-init
+ LSB_FILE=/etc/lsb-release.host
+ OS_RELEASE_FILE=/etc/os-release.host
+ TARGET_DIR=/usr/src
+ HOST_MODULES_DIR=/lib/modules.host
++ uname -r
+ KERNEL_VERSION=5.8.17
+ [[ ! -e /lib/modules/.installed ]]
+ check_headers /lib/modules.host
+ modules_path=/lib/modules.host
++ uname -m
+ arch=x86_64
+ kdir=/lib/modules.host/5.8.17
+ [[ x86_64 == \x\8\6\_\6\4 ]]
+ arch=x86
+ [[ ! -e /lib/modules.host/5.8.17 ]]
+ [[ ! -e /lib/modules.host/5.8.17/source ]]
+ [[ ! -e /lib/modules.host/5.8.17/build ]]
+ return 1
+ install_headers
++ awk '/^NAME *= */ { gsub(/^NAME *= */, ""); print }' /etc/os-release.host
WARNING: Cannot find distro-specific headers for "CentOS Linux". Fetching generic headers.
+ distro='"CentOS Linux"'
+ case $distro in
+ echo 'WARNING: Cannot find distro-specific headers for "CentOS Linux". Fetching generic headers.'
+ install_generic_linux_headers
+ BUILD_DIR=/linux-generic-5.8.17
+ SOURCES_DIR=/usr/src/linux-generic-5.8.17
+ [[ ! -e /usr/src/linux-generic-5.8.17/.installed ]]
+ echo 'Installing kernel headers for generic kernel'
+ fetch_generic_linux_sources
++ echo 5.8.17
Installing kernel headers for generic kernel
++ awk '-vFS=[-+]' '{ print $1 }'
+ kernel_version=5.8.17
Fetching upstream kernel sources for 5.8.17.
++ echo 5.8.17
++ awk -vFS=. '{ print $1 }'
+ major_version=5
+ [[ 5.8.17 == *.0 ]]
+ echo 'Fetching upstream kernel sources for 5.8.17.'
+ mkdir -p /linux-generic-5.8.17
+ curl -sL https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.8.17.tar.gz
+ tar --strip-components=1 -xzf - -C /linux-generic-5.8.17
tar: invalid magic
tar: short read

real    0m5.067s
user    0m0.005s
sys     0m0.008s

Any hints to solve it?

That's a problem I think I've solved!

kubectl trace ,There are two parameters,Look at help, I'm ignoring the alias here:

kubetrace run -h | grep head

kubectl trace run pod/nginx nginx -e "tracepoint:syscalls:sys_enter_* { @[probe] = count(); } --init-imagename=quay.io/custom-init-image-name --fetch-headers"
--fetch-headers Whether to fetch linux headers or not
--init-imagename string Custom image for the init container responsible to fetch and prepare linux headers (default "quay.io/iovisor/kubectl-trace-init:latest")

quay.io/iovisor/kubectl-trace-init:latest This image Can help us to get kernel headers; But because of the system,So you need to modify this script and re-create an image based on your own system!

scripts name is "fetch-linux-headers.sh";Modify several system paths
Before the change:
LSB_FILE="/etc/lsb-release.host"
OS_RELEASE_FILE="/etc/os-release.host"
TARGET_DIR="/usr/src"
HOST_MODULES_DIR="/lib/modules.host"
After the change:
LSB_FILE="/etc/lsb-release.host"
OS_RELEASE_FILE="/etc/os-release"
TARGET_DIR="/usr/src"
HOST_MODULES_DIR="/lib/modules"

The last rebuild your image;Then Specify the parameters

for example:

kubetrace run --serviceaccount=kubectltrace node/your_nodename --fetch-headers --init-imagename quay.io/iovisor/kubectl-trace-init:test --tracer bcc --program tcpconnect -a -n default --args "-p 9831" --args "-t"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants