From 56db7e7eb45d5fae267da22b0884415bda3ffa90 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 26 Sep 2026 13:58:18 +0000 Subject: run-guix-system-container: KILL sends SIGKILL Containers that hang at boot (e.g. blocked on entropy) ignore SIGTERM; kill -9 them instead. --- README.md | 2 +- bin/run-guix-system-container | Bin 27016 -> 27016 bytes bin/run-guix-system-container.c | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c9ae957..a2a6e4c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ START []\n → OK \n container started (detached) → ERR \n rejected KILL \n -→ OK killed \n SIGTERM sent to a container started by this daemon +→ OK killed \n SIGKILL sent to a container started by this daemon → ERR \n unknown pid, not ours, etc. LIST\n → OK\n + one " " line per running container diff --git a/bin/run-guix-system-container b/bin/run-guix-system-container index 2aad526..9c71e37 100755 Binary files a/bin/run-guix-system-container and b/bin/run-guix-system-container differ diff --git a/bin/run-guix-system-container.c b/bin/run-guix-system-container.c index c159669..10bc427 100644 --- a/bin/run-guix-system-container.c +++ b/bin/run-guix-system-container.c @@ -28,7 +28,7 @@ * → ERR \n validation failure (a non-matching optional * fingerprint yields "ERR fingerprint mismatch") * KILL \n - * → OK killed \n SIGTERM sent + * → OK killed \n SIGKILL (kill -9) sent * → ERR \n not a known container, etc. * LIST\n * → OK\n + one " " line per running container @@ -511,7 +511,7 @@ static int pid_is_container(pid_t pid) } /* Handle "KILL ": terminate a container the daemon started - * (or a previous instance started). */ + * (or a previous instance started) with SIGKILL. */ static void kill_container(int fd, const char *arg, const char *client_ip) { char *end; @@ -527,13 +527,13 @@ static void kill_container(int fd, const char *arg, const char *client_ip) dprintf(fd, "ERR not a container started by this daemon\n"); return; } - if (kill((pid_t)pid, SIGTERM) != 0) { + if (kill((pid_t)pid, SIGKILL) != 0) { logmsg("failed to kill %ld: %s", pid, strerror(errno)); dprintf(fd, "ERR %s\n", strerror(errno)); return; } untrack_pid((pid_t)pid); - logmsg("sent SIGTERM to %ld (client %s)", pid, client_ip); + logmsg("sent SIGKILL to %ld (client %s)", pid, client_ip); dprintf(fd, "OK killed %ld\n", pid); } -- cgit 1.4.1