First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 112991
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo's Team for Core System packages <base-system@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Frank Benkstein <benkstein@gmx.de>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 112991 depends on: Show dependency tree
Show dependency graph
Bug 112991 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-11-19 06:07 0000
Hi,

/etc/init.d/{reboot,shutdown}.sh asume that they are running under a sysv style
init. This this makes reboot and sometimes also shutdown fail when running with
runit as a init replacement. Following small fix should have no impact on normal
systems but makes reboot and shutdown with runit work as expected:

--- ._cfg0000_reboot.sh 2005-11-13 05:09:38.000000000 +0000
+++ reboot.sh   2005-11-19 16:03:46.000000000 +0000
@@ -1,8 +1,10 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-/sbin/reboot -idp
-
-# hmm, if the above failed, that's kind of odd ...
-# so let's force a reboot
-/sbin/reboot -f
+if [ -p /dev/initctl ] ; then
+    /sbin/reboot -idp
+    
+    # hmm, if the above failed, that's kind of odd ...
+    # so let's force a reboot
+    /sbin/reboot -f
+fi

--- ._cfg0000_shutdown.sh       2005-11-13 05:09:38.000000000 +0000
+++ shutdown.sh 2005-11-19 16:03:44.000000000 +0000
@@ -1,8 +1,10 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-/sbin/halt -ihdp
-
-# hmm, if the above failed, that's kind of odd ...
-# so let's force a halt
-/sbin/halt -f
+if [ -p /dev/initctl ] ; then
+    /sbin/halt -ihdp
+    
+    # hmm, if the above failed, that's kind of odd ...
+    # so let's force a halt
+    /sbin/halt -f
+fi

Please apply.

Thanks in advance
Frank Benkstein.

------- Comment #1 From SpanKY 2005-11-27 10:19:03 0000 -------
thats not really a valid test ... the fifo may exist even when sysvinit is not
being used

------- Comment #2 From Frank Benkstein 2006-03-10 00:23:52 0000 -------
What about the check being 

fuser /dev/initctl 2>/dev/null | grep '\<1\>'

? Would that be ok?

------- Comment #3 From Roy Marples (RETIRED) 2006-10-22 10:14:31 0000 -------
A better test would be checking that init owns pid 1

if [[ $(pidof /sbin/init) == "1" ]] ; then
    halt or reboot code
fi

Would that be acceptable?

------- Comment #4 From SpanKY 2006-10-23 00:34:56 0000 -------
not really ... if someone doesnt install sysvinit and their own init installs
as /sbin/init ...

------- Comment #5 From Roy Marples (RETIRED) 2006-10-23 00:40:41 0000 -------
Well, we could reverse the test then

if [[ $(pidof /sbin/runit 2>/dev/null) != "1" ]] ; then

------- Comment #6 From Frank Benkstein 2006-10-23 07:39:05 0000 -------
I don't see what is bad about checking whether /dev/initctl exists,
is a pipe, and is used by process id 1. That is exactly what sysvinit
is doing.

------- Comment #7 From SpanKY 2006-10-23 10:23:34 0000 -------
> if [[ $(pidof /sbin/runit 2>/dev/null) != "1" ]] ; then

i really dont want to go down that path ... then every other non-sysv init user
will be clamoring about their $FAVORITE_INIT and for us to add support ... just
look at the mess that is /etc/init.d/clock

------- Comment #8 From Roy Marples (RETIRED) 2006-10-24 12:08:57 0000 -------
(In reply to comment #7)
> i really dont want to go down that path ... then every other non-sysv init user
> will be clamoring about their $FAVORITE_INIT and for us to add support ... just
> look at the mess that is /etc/init.d/clock

Well, we could punt shutdown.sh and reboot.sh to the sysvinit ebuild - which
makes sense as the BSD's don't use them.

------- Comment #9 From SpanKY 2006-10-25 20:12:26 0000 -------
good idea ... i'll take care of it

------- Comment #10 From Frank Benkstein 2006-10-26 06:33:26 0000 -------
This is only a fix if baselayout depends on virtual/init or something like
this.

------- Comment #11 From SpanKY 2006-10-26 12:26:08 0000 -------
no, it's a proper fix regardless

if you want to persue a virtual/init you could post it to the gentoo-dev list
... not that i see any issue with it

------- Comment #12 From Roy Marples (RETIRED) 2006-12-12 03:16:41 0000 -------
baselayout-1.12.7 and 1.13.0_alpha9 now depend on virtual init which by default
uses sysvinit which now provides reboot and shutdown scripts.

First Last Prev Next    No search results available      Search page      Enter new bug