Sorry, I got the base image wrong when experimenting with strace. Here's my updated Dockerfile. I've confirmed that this bug still happens when I *only* install libc6 (and dependencies):
--- begin Dockerfile --- FROM rocker/r-base:4.1.2 COPY ./test_executable.sh /usr/local/bin RUN test_executable.sh # works RUN apt-get update && apt-get install -y strace RUN test_executable.sh # works RUN apt-get install -y libc6 RUN test_executable.sh # doesn't work --- end Dockerfile --- Working: ii libc6:amd64 2.32-4 amd64 GNU C Library: Shared libraries Not working: ii libc6:amd64 2.33-5 amd64 GNU C Library: Shared libraries When installing/upgrading libc6, apt also installs the following packages: libc-bin libc-dev-bin libc-l10n libc6 libc6-dev locales --- begin working strace [last 2 lines of Dockerfile excluded] --- execve("/usr/local/bin/test_executable.sh", ["test_executable.sh"], 0x7ffdf9f53d10 /* 7 vars */) = 0 brk(NULL) = 0x556026cf2000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=18355, ...}) = 0 mmap(NULL, 18355, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6aa0fa9000 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\177\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1839168, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6aa0fa7000 mmap(NULL, 1852480, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6aa0de2000 mprotect(0x7f6aa0e08000, 1658880, PROT_NONE) = 0 mmap(0x7f6aa0e08000, 1347584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f6aa0e08000 mmap(0x7f6aa0f51000, 307200, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16f000) = 0x7f6aa0f51000 mmap(0x7f6aa0f9d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f6aa0f9d000 --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} --- mmap(0x7f6aa0fa3000, 13376, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6aa0fa3000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6aa0de0000 arch_prctl(ARCH_SET_FS, 0x7f6aa0fa85c0) = 0 mprotect(0x7f6aa0f9d000, 12288, PROT_READ) = 0 mprotect(0x5560268b6000, 8192, PROT_READ) = 0 mprotect(0x7f6aa0fd8000, 4096, PROT_READ) = 0 munmap(0x7f6aa0fa9000, 18355) = 0 getuid() = 0 getgid() = 0 getpid() = 8 rt_sigaction(SIGCHLD, {sa_handler=0x5560268aba20, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f6aa0e1eef0}, NULL, 8) = 0 geteuid() = 0 brk(NULL) = 0x556026cf2000 brk(0x556026d13000) = 0x556026d13000 getppid() = 1 getcwd("/", 4096) = 2 openat(AT_FDCWD, "/usr/local/bin/test_executable.sh", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 geteuid() = 0 getegid() = 0 rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGINT, {sa_handler=0x5560268aba20, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f6aa0e1eef0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f6aa0e1eef0}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f6aa0e1eef0}, NULL, 8) = 0 read(10, "#!/bin/sh\nif test -x /usr/bin/he"..., 8192) = 103 faccessat(AT_FDCWD, "/usr/bin/head", X_OK) = 0 write(1, "/usr/bin/head is executable\n", 28/usr/bin/head is executable ) = 28 read(10, "", 8192) = 0 exit_group(0) = ? +++ exited with 0 +++ --- begin not-working strace --- execve("/usr/local/bin/test_executable.sh", ["test_executable.sh"], 0x7ffecf53fc30 /* 7 vars */) = 0 brk(NULL) = 0x5564890d3000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=15011, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 15011, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1fc89ab000 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000y\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\200\0\300\4\0\0\0\1\0\0\0\0\0\0\0", 32, 848) = 32 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0007\365/\272`\30\360\245\204\243\5\207\253\306\35("..., 68, 880) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1835120, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1fc89a9000 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 1864568, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1fc87e1000 mmap(0x7f1fc8807000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f1fc8807000 mmap(0x7f1fc894f000, 307200, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16e000) = 0x7f1fc894f000 mmap(0x7f1fc899a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b9000) = 0x7f1fc899a000 mmap(0x7f1fc89a0000, 33656, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1fc89a0000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1fc87df000 arch_prctl(ARCH_SET_FS, 0x7f1fc89aa600) = 0 mprotect(0x7f1fc899a000, 12288, PROT_READ) = 0 mprotect(0x556488c8e000, 8192, PROT_READ) = 0 mprotect(0x7f1fc89de000, 8192, PROT_READ) = 0 munmap(0x7f1fc89ab000, 15011) = 0 --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} --- getuid() = 0 getgid() = 0 getpid() = 8 rt_sigaction(SIGCHLD, {sa_handler=0x556488c83a20, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f1fc881d910}, NULL, 8) = 0 geteuid() = 0 brk(NULL) = 0x5564890d3000 brk(0x5564890f4000) = 0x5564890f4000 getppid() = 1 getcwd("/", 4096) = 2 openat(AT_FDCWD, "/usr/local/bin/test_executable.sh", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 geteuid() = 0 getegid() = 0 rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGINT, {sa_handler=0x556488c83a20, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f1fc881d910}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f1fc881d910}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f1fc881d910}, NULL, 8) = 0 read(10, "#!/bin/sh\nif test -x /usr/bin/he"..., 8192) = 103 syscall_0xffffffffffffffff(0xffffff9c, 0x5564890d3490, 0x1, 0x200, 0x5564890d34b0, 0x7f1fc899dc00) = -1 EPERM (Operation not permitted) write(1, "dead beef\n", 10dead beef ) = 10 read(10, "", 8192) = 0 exit_group(0) = ? +++ exited with 0 +++