From a88686522c9ee2dc367ad1158dad4e5cf282ecf4 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 29 Aug 2023 14:25:40 +0200 Subject: [PATCH] Fix hanging start-stop-daemon in footloose Alpine Some distributions package Docker in a way that allows for a vast number of open file descriptors, often achieved through systemd's `LimitNOFILE=infinity` configuration. This situation leads to start- stop-daemon appearing to hang, consequently blocking the OpenRC init sequence. However, the issue is not an actual hang; rather, it attempts to close all open file descriptors, resulting in a loop with approximately one billion iterations of the close() syscall. This behavior effectively renders the footloose machine unable to boot. Mitigate this by setting the open file descriptor limit to 1 Mi in OpenRC's rc.conf. Signed-off-by: Tom Wieczorek Link: https://github.com/moby/moby/commit/8db61095a3d0bcb0733580734ba5d54bc27a614d Link: https://github.com/OpenRC/openrc/blob/eb8831a1416ab2ee8123b3add78421c2aa316b39/src/start-stop-daemon/start-stop-daemon.c#L1104-L1105 (cherry picked from commit ed4e3590608983efc0d39738fc90481bd9144a7c) --- inttest/footloose-alpine/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inttest/footloose-alpine/Dockerfile b/inttest/footloose-alpine/Dockerfile index 47a7975eab3a..e5afb1791282 100644 --- a/inttest/footloose-alpine/Dockerfile +++ b/inttest/footloose-alpine/Dockerfile @@ -22,7 +22,8 @@ RUN rc-update add local default RUN rc-update add nginx default # Ensures that /usr/local/bin/k0s is seeded from /dist at startup RUN rc-update add k0s-seed default - +# Prevent start-stop-daemon from hanging when max_fds is huge +RUN sed -Ei -e 's/^[# ](rc_ulimit)=.*/\1="-n 1048576"/' /etc/rc.conf # remove -docker keyword so we actually mount cgroups in container RUN sed -i -e '/keyword/s/-docker//' /etc/init.d/cgroups # disable ttys