From 43394581bb3106633c8802b378a7f2e6e53b352a Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 30 Apr 2026 14:58:50 +0000 Subject: Change stage 4 commands to use external prefix If you are using slashpackage or an equivalent full-versioned fs hierarchy, if you upgrade s6-l-i, delete the old package, do not restart the s6-linux-init-shutdownd service, and reboot, shutdownd will create a stage 4 script using old full-versioned paths, and your reboot will fail in stage 4, which is very bad since nothing is running anymore so recovery is impossible. (Destructors should never fail.) To prevent that from happening, use non-versioned paths to s6-l-i commands in stage 4. --- src/shutdown/s6-linux-init-shutdownd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c index de7b093..33b7dda 100644 --- a/src/shutdown/s6-linux-init-shutdownd.c +++ b/src/shutdown/s6-linux-init-shutdownd.c @@ -190,12 +190,12 @@ static inline void prepare_stage4 (char const *basedir, char what) if (buffer_puts(&b, "#!" EXECLINE_SHEBANGPREFIX "execlineb -P\n\n" EXECLINE_EXTBINPREFIX "foreground { " - S6_LINUX_INIT_BINPREFIX "s6-linux-init-umountall }\n" + S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-umountall }\n" EXECLINE_EXTBINPREFIX "foreground { tryexec { ") < 0 || !string_quote(&satmp, basedir, strlen(basedir)) || buffer_put(&b, satmp.s + sabase, satmp.len - sabase) < 0 || buffer_puts(&b, "/scripts/" STAGE4 " } }\n" - S6_LINUX_INIT_BINPREFIX "s6-linux-init-hpr -f -") < 0 + S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -f -") < 0 || buffer_put(&b, &what, 1) < 0 || buffer_putsflush(&b, "\n") < 0) strerr_diefu2sys(111, "write to ", STAGE4_FILE ".new") ; -- cgit v1.3.1