V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
eephee
V2EX  ›  Kubernetes

求大神指点在 k3s 上面启动容器报错 libc.so.6: invalid ELF header milvus 应该怎么入手排查

  •  
  •   eephee · 2 天前 · 970 次点击

    同事在一台用 VmWare 创建的虚拟机(x86_64)上面,安装了 Debian 12 ,在其上安装了 k3s 1.28.15

    随后在这个 k3s 上面部署了一些服务比如 minio, docker registry 之类的,都是正常启动运行的。但是部署 milvus 时老是起不来,报错

    /tini: error while loading shared libraries: /lib/x86_64-linux-gnu/libc.so.6: invalid ELF header milvus
    

    我随后尝试使用 ctr 创建容器进入 shell 环境,也是不行

    k3s ctr run --rm -t --platform linux/amd64 docker.io/milvusdb/milvus:v2.4.5 milvus /bin/bash
    

    还是一样的报错。

    我一开始怀疑是我们拉取的镜像有问题,怀疑是用了 arm 架构的镜像,但是随后我使用 crictl inspeci 查看了镜像确实是是 linux/amd64 的,另外我看了下 milvus 的 Dockerfile 看着也中规中规,目前还没找出原因,也不知道如何入手排查。

    随后我在这台虚拟机上面安装了 docker 并创建容器,是可以成功启动的,看起来问题可能在 k3s 用的 containerd 这里,但是不知道该从哪里排查了。

    附:该虚拟机 CPU 情况

    root@debian1:~/ccdinstaller# lscpu
    Architecture:            x86_64
      CPU op-mode(s):        32-bit, 64-bit
      Address sizes:         45 bits physical, 48 bits virtual
      Byte Order:            Little Endian
    CPU(s):                  16
      On-line CPU(s) list:   0-15
    Vendor ID:               GenuineIntel
      BIOS Vendor ID:        GenuineIntel
      Model name:            11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz
        BIOS Model name:     11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz  CPU @ 2.5GHz
        BIOS CPU family:     2
        CPU family:          6
        Model:               167
        Thread(s) per core:  1
        Core(s) per socket:  16
        Socket(s):           1
        Stepping:            1
        BogoMIPS:            4991.99
        Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopolo
                             gy tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hyperviso
                             r lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt avx5
                             12cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512vbmi umip avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid md_cle
                             ar flush_l1d arch_capabilities
    Virtualization features:
      Hypervisor vendor:     VMware
      Virtualization type:   full
    Caches (sum of all):
      L1d:                   768 KiB (16 instances)
      L1i:                   512 KiB (16 instances)
      L2:                    8 MiB (16 instances)
      L3:                    16 MiB (1 instance)
    NUMA:
      NUMA node(s):          1
      NUMA node0 CPU(s):     0-15
    Vulnerabilities:
      Gather data sampling:  Unknown: Dependent on hypervisor status
      Itlb multihit:         Not affected
      L1tf:                  Not affected
      Mds:                   Not affected
      Meltdown:              Not affected
      Mmio stale data:       Mitigation; Clear CPU buffers; SMT Host state unknown
      Retbleed:              Mitigation; IBRS
      Spec rstack overflow:  Not affected
      Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
      Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
      Spectre v2:            Mitigation; IBRS, IBPB conditional, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
      Srbds:                 Not affected
      Tsx async abort:       Not affected
    
    23 条回复    2025-07-12 13:41:43 +08:00
    momocraft
        1
    momocraft  
       2 天前
    在那台机器上,用 docker 甚至解压 docker image 在 host 执行会怎样
    stormtrooperx5
        2
    stormtrooperx5  
       2 天前
    你说 docker 使用同一个镜像可用运行,是把这个镜像 export 给 docker 用的,还是重新拉下来的?
    ysicing
        3
    ysicing  
       2 天前
    readelf -h /lib/x86_64-linux-gnu/libc.so.6 看看
    ysicing
        4
    ysicing  
       2 天前
    ```
    ELF Header:
    Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
    Class: ELF64
    Data: 2's complement, little endian
    Version: 1 (current)
    OS/ABI: UNIX - GNU
    ABI Version: 0
    Type: DYN (Shared object file)
    Machine: Advanced Micro Devices X86-64
    Version: 0x1
    Entry point address: 0x27410
    Start of program headers: 64 (bytes into file)
    Start of section headers: 1918040 (bytes into file)
    Flags: 0x0
    Size of this header: 64 (bytes)
    Size of program headers: 56 (bytes)
    Number of program headers: 14
    Size of section headers: 64 (bytes)
    Number of section headers: 64
    Section header string table index: 63
    ```

    感觉是你的机器环境有问题。应该与 k3s 版本关系不大🤔,debian12 k8s1.28 和 1.32 都可以运行的
    guanzhangzhang
        5
    guanzhangzhang  
       2 天前
    k3s ctr run --rm -t --platform linux/amd64 -e LD_PRELOAD= -e LD_LIBRARY_PATH= -e MALLOC_CONF= docker.io/milvusdb/milvus:v2.4.5 milvus /bin/bash
    eephee
        6
    eephee  
    OP
       2 天前
    @momocraft #1 用 docker 执行是 OK 的,解压我还没试过
    eephee
        7
    eephee  
    OP
       2 天前
    @stormtrooperx5 #2 是分别基于一个 tar 文件导入到 ctr 和 docker 然后运行的

    ```
    docker load < milvus.tar
    docker run ...

    ctr images import milvus.tar
    ctr run ...
    ```
    LOTUSSSB
        8
    LOTUSSSB  
       2 天前
    你把打包到 docker 的镜像运行后,由 docker 打包一份给 k3s 试试呢,看看会不会有一样的问题
    patrickyoung
        9
    patrickyoung  
       2 天前 via Android
    把镜像里 /tini 拿出来,然后 ldd /tini 看看
    GiveMeABigName
        10
    GiveMeABigName  
       2 天前
    我印象中碰到过类似报错,好像是和 cpu 平台有关系?
    eephee
        11
    eephee  
    OP
       2 天前
    @ysicing 我看了下 libc.so.6 是指向 libc-2.31.so 的一个链接,readelf 的结果和你的差不多

    ELF Header:
    Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
    Class: ELF64
    Data: 2's complement, little endian
    Version: 1 (current)
    OS/ABI: UNIX - GNU
    ABI Version: 0
    Type: DYN (Shared object file)
    Machine: Advanced Micro Devices X86-64
    Version: 0x1
    Entry point address: 0x241f0
    Start of program headers: 64 (bytes into file)
    Start of section headers: 2025208 (bytes into file)
    Flags: 0x0
    Size of this header: 64 (bytes)
    Size of program headers: 56 (bytes)
    Number of program headers: 14
    Size of section headers: 64 (bytes)
    Number of section headers: 68
    Section header string table index: 67
    eephee
        12
    eephee  
    OP
       2 天前
    @guanzhangzhang 还是报这个错误,奇怪了 😭
    guanzhangzhang
        13
    guanzhangzhang  
       2 天前
    @eephee #12 k3s ctr run --rm -t --platform linux/amd64 -e LD_PRELOAD= -e LD_LIBRARY_PATH= -e MALLOC_CONF= docker.io/milvusdb/milvus:v2.4.5 /bin/bash 这样呢
    eephee
        14
    eephee  
    OP
       2 天前
    @patrickyoung @LOTUSSSB
    这个是 ldd /tini 的输出
    ```
    linux-vdso.so.1 (0x00007ffd248e1000)
    /milvus/lib/libjemalloc.so (0x00007fcf21a9b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcf218a6000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcf216c4000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcf216be000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcf216a3000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcf21680000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fcf21bc8000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcf2152f000)
    ```

    我后面基于 milvus:v2.4.5 又构建了一个新镜像,并且覆盖掉了原镜像中的 `ENTRYPOINT` /tini ,然后导出了镜像并导入到 k3s ctr 运行,还是一样的报错
    eephee
        15
    eephee  
    OP
       2 天前
    @guanzhangzhang

    我执行了

    ```
    k3s ctr run --rm -t --platform linux/amd64 -env LD_PRELOAD= -env LD_LIBRARY_PATH= -env MALLOC_CONF= docker.io/milvusdb/milvus:v2.4.5 /bin/bash
    ```

    还是报错 😭
    eephee
        16
    eephee  
    OP
       2 天前
    @GiveMeABigName 是的我之前在 arm 机器上面跑 x86 镜像有类似的报错,以及 "exec format error" 之类的报错。这次遇到的这个问题很奇怪,一方面我的机器确实是 x86_64 的,另一方面其他的镜像都可以正常运行就 milvus 的不可以
    eephee
        17
    eephee  
    OP
       2 天前
    放弃了,milvus 打算用 docker 跑了
    guanzhangzhang
        18
    guanzhangzhang  
       2 天前
    @eephee #15 rmi 掉镜像后执行下类似 docker 的 system prune -f 啥的清理下看看,可能是镜像里文件损坏了
    eephee
        19
    eephee  
    OP
       2 天前
    @guanzhangzhang 谢谢,不过我已经放弃了,主要这个上面还有一些比较重要的镜像,不太敢 prune 😭
    bingfengfeifei
        20
    bingfengfeifei  
       1 天前
    我试了下,在我本地没问题的
    rpman
        21
    rpman  
       1 天前
    以前遇到过一次,是因为 binary 的 arch 错了
    julyclyde
        22
    julyclyde  
       1 天前
    内核难道是 i386 的?
    zizon
        23
    zizon  
       14 小时 13 分钟前
    可能是 go 依赖的 libc 有问题.
    有时候 go 对内核版本有一定的隐性依赖.
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   924 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 19:55 · PVG 03:55 · LAX 12:55 · JFK 15:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.