Description of problem: 使用docker镜像cloud-native-sig-registry.cn-hangzhou.cr.aliyuncs.com/openanolis/anolisos:23创建docker容器,在容器执行dmesg -l warn -T,没有dmesg命令:OCI runtime exec failed: exec failed: unable to start container process: exec: "dmesg": executable file not found in $PATH: unknown Steps to Reproduce: 1.yum install -y yum-utils && yum install docker -y --enablerepo=Plus && systemctl start docker 2.docker pull cloud-native-sig-registry.cn-hangzhou.cr.aliyuncs.com/openanolis/anolisos:23 3.docker image ls && docker run -dit --privileged=true -v /home:/home cloud-native-sig-registry.cn-hangzhou.cr.aliyuncs.com/openanolis/anolisos:23 4.docker exec docker-id dmesg -l warn -T Actual results: docker镜像没有dmesg命令 Expected results: docker经常有dmesg命令,并且正常执行dmesg -l warn -T和dmesg -l err -T Additional info:
Created attachment 820 [details] anolis8 docker执行截图
anolis8 docker上是执行可以通过的
结论:建议在 docker 环境中直接安装 util-linux-core 后在进行使用。 原因:dmesg 命令不在 docker 默认的范围内的,docker 制作是通过声明需要的包列表进行制作生成。Anolis OS 8 和 Anolis OS 23 的 docker.ks 文件中声明的包范围是相同的,这个结果的差异是由于两个版本的依赖关系有变更导致的。 具体原因如下: Anolis OS 8 里面有 dmesg 的原因: dmesg 在 Anolis OS 8 中由 util-linux 提供。glibc-minimal-langpack 在需要安装的列表范围内,然后 glibc-minimal-langpack 安装依赖 glibc,而 glibc 依赖了 util-linux。导致 dmesg 被引入。 [root@iZbp1duxh1y47uucrbr0qyZ ~]# rpm -qf /usr/bin/dmesg util-linux-2.32.1-35.0.1.an8.aarch64 [root@iZbp1duxh1y47uucrbr0qyZ ~]# yum repoquery --requires glibc | grep util-linux Failed to set locale, defaulting to C.UTF-8 Last metadata expiration check: 1:13:33 ago on Wed Jul 5 18:27:59 2023. util-linux Anolis OS 23 里没有 dmesg 的原因: dmesg 在 Anolis OS 23 中是由 util-linux-core 提供。glibc-minimal-langpack 在需要安装的列表范围内,然后 glibc-minimal-langpack 安装不再依赖 glibc,所以 dmesg 不会被再次带入。 [root@iZbp11f2prmazn8pd90bduZ ~]# rpm -qf /usr/bin/dmesg util-linux-core-2.38.1-1.an23.x86_64 [root@iZbp11f2prmazn8pd90bduZ ~]# yum repoquery --whatrequires util-linux-core Last metadata expiration check: 0:53:22 ago on Wed 05 Jul 2023 06:31:37 PM CST. resource-agents-0:4.12.0-1.an23.x86_64 systemd-0:252.4-6.an23.x86_64 util-linux-0:2.38.1-1.an23.x86_64