diff options
| author | Pjotr Prins <pjotr.public12@thebird.nl> | 2026-09-26 13:58:18 +0000 |
|---|---|---|
| committer | Pjotr Prins <pjotr.public12@thebird.nl> | 2026-09-26 13:58:18 +0000 |
| commit | 56db7e7eb45d5fae267da22b0884415bda3ffa90 (patch) | |
| tree | 11a92576c570f3864ed22a67c5df9d03f6e251fb | |
| parent | e5c76a43a9695d2b156c6b9650fb91512575caab (diff) | |
| download | run-guix-container-56db7e7eb45d5fae267da22b0884415bda3ffa90.tar.gz | |
run-guix-system-container: KILL sends SIGKILL
Containers that hang at boot (e.g. blocked on entropy) ignore SIGTERM; kill -9 them instead.
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | bin/run-guix-system-container | bin | 27016 -> 27016 bytes | |||
| -rw-r--r-- | 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 <hash|/gnu/store/HASH-run-container> [<fingerprint>]\n → OK <pid>\n container started (detached) → ERR <reason>\n rejected KILL <pid>\n -→ OK killed <pid>\n SIGTERM sent to a container started by this daemon +→ OK killed <pid>\n SIGKILL sent to a container started by this daemon → ERR <reason>\n unknown pid, not ours, etc. LIST\n → OK\n + one "<pid> <name>" line per running container diff --git a/bin/run-guix-system-container b/bin/run-guix-system-container index 2aad526..9c71e37 100755 --- a/bin/run-guix-system-container +++ b/bin/run-guix-system-container Binary files differdiff --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 <reason>\n validation failure (a non-matching optional * fingerprint yields "ERR fingerprint mismatch") * KILL <pid>\n - * → OK killed <pid>\n SIGTERM sent + * → OK killed <pid>\n SIGKILL (kill -9) sent * → ERR <reason>\n not a known container, etc. * LIST\n * → OK\n + one "<pid> <name>" line per running container @@ -511,7 +511,7 @@ static int pid_is_container(pid_t pid) } /* Handle "KILL <pid>": 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); } |
