| Summary: | shutdown and reboot fix when not running under sysv style init | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Frank Benkstein <benkstein> |
| Component: | [OLD] baselayout | Assignee: | Gentoo's Team for Core System packages <base-system> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
thats not really a valid test ... the fifo may exist even when sysvinit is not being used What about the check being fuser /dev/initctl 2>/dev/null | grep '\<1\>' ? Would that be ok? 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?
not really ... if someone doesnt install sysvinit and their own init installs as /sbin/init ... Well, we could reverse the test then if [[ $(pidof /sbin/runit 2>/dev/null) != "1" ]] ; then 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. > 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
(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. good idea ... i'll take care of it This is only a fix if baselayout depends on virtual/init or something like this. 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 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. |
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.