From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1228 Path: news.gmane.org!not-for-mail From: Jan =?iso-8859-1?q?K=E4mpe?= Newsgroups: gmane.comp.sysutils.supervision.general Subject: [PATCH] "Kernel panic - not syncing: Attempted to kill init!" at poweroff/halt Date: Wed, 16 Aug 2006 13:40:27 +0300 Message-ID: <200608161340.28280.jkampe@iki.fi> Reply-To: jkampe@iki.fi NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_cYv4Ev6BlCr1IoK" X-Trace: sea.gmane.org 1155728451 2059 80.91.229.2 (16 Aug 2006 11:40:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Aug 2006 11:40:51 +0000 (UTC) Original-X-From: supervision-return-1464-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Aug 16 13:40:44 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1GDJlA-0002vq-Aa for gcsg-supervision@gmane.org; Wed, 16 Aug 2006 13:40:32 +0200 Original-Received: (qmail 22541 invoked by uid 76); 16 Aug 2006 11:40:52 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 19890 invoked from network); 16 Aug 2006 10:40:52 -0000 Original-To: supervision@list.skarnet.org User-Agent: KMail/1.8 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1228 Archived-At: --Boundary-00=_cYv4Ev6BlCr1IoK Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ... --Boundary-00=_cYv4Ev6BlCr1IoK Content-Type: text/x-diff; charset="us-ascii"; name="runit.reboot.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="runit.reboot.diff" --- ./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 #include +#include +#include /* 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); } --Boundary-00=_cYv4Ev6BlCr1IoK--