:: [devuan-dev] [PATCH] runit: shutdow…
Top Page
Delete this message
Reply to this message
Author: enricopitea
Date:  
To: devuan-dev
Subject: [devuan-dev] [PATCH] runit: shutdown -h / poweroff does not cut the power — execv bypasses syscall_shutdown fallback
--- /mnt/Documenti/FINAL/pacchetti-devuan/runit-fix/shutdown.c.orig    2026-07-30 13:26:56.668071040 +0200
+++ /mnt/Documenti/FINAL/pacchetti-devuan/runit-fix/shutdown.c.patched    2026-07-30 13:54:10.964950092 +0200
@@ -144,12 +144,15 @@
 runit_shutdown(shutdown_action action)
 {
     if (stat(STOPIT,&s) == -1) {
-               return false;
+                   return false;
        }
-    char* args[] = {
-        "/usr/sbin/init", (action == ACTION_HALT) ? "0" : "6", NULL };
-    execv("/usr/sbin/init", args);
-    return false;
+    /* Use sysv initctl instead of execv so that syscall_shutdown()
+       (which calls reboot(RB_POWER_OFF)) is reached as fallback.
+       With execv, the process is replaced and the code path after
+       the || chain in main() -- sleep(15) + syscall_shutdown() --
+       is never executed, leaving poweroff to RB_HALT which does
+       not cut the power on modern hardware. */
+    return sysv_shutdown(action);
 }


static bool