当我apt-get dist-upgrade
在 Docker 容器中运行时,我得到,
Unpacking libc6:i386 (2.31-1) over (2.30-8) ...
Setting up libc6:i386 (2.31-1) ...
Checking for services that may need to be restarted...
Checking init scripts...
Nothing to restart.
sleep: cannot read realtime clock: Operation not permitted
dpkg: error processing package libc6:i386 (--configure):
installed libc6:i386 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libc6:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)
libc 2.31-1 是否支持在 Debian 测试主机上的 docker 中运行
Linux x1c7 5.7.0-1-amd64 #1 SMP Debian 5.7.6-1 (2020-06-24) x86_64 GNU/Linux
当我在容器内运行时,我可以看到它sleep 0
正在nanosleep
libc 中调用,
nanosleep(0xffd8eb54, 0, 0xf7dbf4d5, 0x565e24ea) = -1
跑步时strace sleep 0
,我看到它在召唤clock_nanosleep_time64
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=0}, 0xff8b0b8c) = -1 EPERM (Operation not permitted)
write(2, "sleep: ", 7sleep: ) = 7
write(2, "cannot read realtime clock", 26cannot read realtime clock) = 26
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
dist 升级发生了什么?这是在我身上吗?我可以在任何机器上重现这个,我所要做的就是
- 在金属上安装 Debian 测试,
- 安装docker
- 运行以下命令,
docker run i386/debian:unstable /bin/sh -c "apt-get update && apt-get install -qy libc6:i386; echo TRYING TO SLEEP; sleep 0"
答案1
您所要做的就是添加--privileged
到docker run