From: "Jan Kämpe" <jkampe@iki.fi>
Subject: [PATCH] "Kernel panic - not syncing: Attempted to kill init!" at poweroff/halt
Date: Wed, 16 Aug 2006 13:40:27 +0300 [thread overview]
Message-ID: <200608161340.28280.jkampe@iki.fi> (raw)
[-- Attachment #1: Type: text/plain, Size: 232 bytes --]
Under linux at runit poweroff/halt one might get "kernel panic"
[snip]
- runit: power off...
Shutdown: hda
System halted.
Kernel panic - not syncing: Attempted to kill init!
Workaround for the kernel panic in attached patch ...
[-- Attachment #2: runit.reboot.diff --]
[-- Type: text/x-diff, Size: 632 bytes --]
--- ./src/reboot_system.h2.jk2 2006-06-29 10:53:17.000000000 +0300
+++ ./src/reboot_system.h2 2006-08-16 10:29:16.000000000 +0300
@@ -1,8 +1,20 @@
#include <unistd.h>
#include <sys/reboot.h>
+#include <sys/types.h>
+#include <sys/wait.h>
/* sysdep: +std reboot */
int reboot_system(int what) {
- return(reboot(what));
+ int pid, status;
+ /* fork() before calling reboot since the linux kernel calls do_exit(0) in
+ * kernel/sys.c, which can cause kernel to panic as
+ * the init process would exit ...
+ */
+ if ((pid = fork()) == 0) {
+ reboot(what);
+ _exit(0);
+ }
+ waitpid(pid, &status, 0);
+ return(0);
}
next reply other threads:[~2006-08-16 10:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-16 10:40 Jan Kämpe [this message]
2006-09-15 14:44 ` Gerrit Pape
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200608161340.28280.jkampe@iki.fi \
--to=jkampe@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).