Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
Moved to LFS-Dev. On 07/17/2011 07:57 PM, Bruce Dubbs wrote: DJ Lucas wrote: On 07/17/2011 02:51 PM, Bruce Dubbs wrote: DJ Lucas wrote: Actually, this check needs to be removed. It causes issues for the alsa script and also setclock (if used to set hwclock when network goes down in RL2). Wouldn't this be just as easy as creating symlinks S50setclock in rc0 and rc6 in the LFS Makefile? In the same way, creating S35alsa symlinks in the BLFS Makefile would save the asla settings. No. Drop to RL1 with alsa volumes restored via udev for an example of why that block should be removed. It doesn't matter for 0 and 6 because the check is skipped. It's been a while, but IIRC, the same thing for a K??setclock link in RL2. I don't understand. What we have now is: snip code In rc1.d I have K30sshd, K80network, K90sysklogd, S25random. The same in rc2.d. setclock is executed in rcsysinit. If alsa utils is installed, you should have K links in RLs 0,1,2,6 and no start links as the volume restore is handled by udev. If I add S50setclock and S40alsa to rc{0,6}.d, the '-f ${prev_start}' fails and the continue is never executed. The command is run with the stop parameter in both cases and does the right thing, AFAICT. Oh, actually, setclock should not be run in rcsysinit any longer. that's for udev to handle now as well. That is where the issue comes into play. The alsa script should write the volumes to disk when switching from runlevel 3 to runlevel 2 (no net == no usr == no alsactl) or especially RL1 as the rootfs might be RO, and it certainly wasn't started by a script in RL3, but by udev (please ignore the FHS /usr argument as we are still bound by it for now). You should see the same issue (not started in previous runlevel) if you were to put Kxxsetclock in rc2.d or rc1.d and telinit 2 or 1. This is proper IMO when using NTP, but not really useful in practice. Agree, except if the hw clock is too far off, ntp is unhappy. That is the point, to set hwclock when dropping network so that it'll be that much closer when you jump back into 3/4/5probably really doesn't matter unless you are in RL2 overnight and system timer is way outta whack (in which case you have bigger problems). Are you suggesting that we just remove the 'if' block above? I'd think that might add some strange failures at shutdown, but shouldn't hurt anything. Yes, that is exactly what I was suggesting. Using S links in 0 and 6 for alsa does nothing for RL1 and RL2. Besides, as mentioned earlier in the thread, the S links in 0 and 6 _were_ intended to be reserved for very specific system requirements. I'm not really sure if ALSA, or anything outside of the base LFS for that matter, should get special treatment here. With the LSB defined return values, it didn't matter because stopping an already stopped service results in a return value of 0 (an OK message). In the case of alsa, this doesn't even apply, you're not stopping a service, only writing a file, there should never be a failure here unless it is run late or you did something that makes /etc read only. Also, I don't really see how we could get a bunch of warning/error messages with current scripts (though I haven't really used the stock scripts for more than a few minutes at a time since 2006). Everything installed by the books is handled in all 7 runlevels or sysinit, with a few exceptions, notably the two above (and only alsa is mentioned in either of the books). The prevlevl check has simply been outdated by modern tools (udev). Going back to the LSB return values mentioned above, the warning messages about items not running at shutdown are not really useful. I mean, what can you do about it at that point? Same thing for the not started in previous runlevel message...just exit 0 and paint a pretty green message on the screen. If the pid file checks are rewritten, again I'll refer to the LSB scripts pidofproc(), you can simply bypass the execution and exit 0. This also fixes the issue with the apache script killing children first. Again, I don't particularly like it (yet), but I have a feeling that we'll begin to see more and more of this in the future. Network cards could conceivably be next in line (think of turning on your wireless card on your laptop), so it makes some sense to rewrite ifup and ifdown now, along with the network script (which could be also be replaced by NM or something similar after LFS). As much can be reused in the future, the better. Of course, I could be very wrong in my prediction, but I figure rather than introduce a couple of corner cases, you should probably go ahead and nip what we can in the bud now while you are familiar with the work that needs to be done. Free time is still not what it should be for me right now, but I'll jump in an make some comments on your changes (if needed/wanted) as soon as I have time to install and test. -- DJ Lucas --
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
On 07/12/2011 06:19 AM, Theodore You wrote: On Tue, Jul 12, 2011 at 9:47 AM, Bruce Dubbsbruce.du...@gmail.com wrote: Theodore You wrote: The book says in chapter 7.3: Links that start with an S in the rc0.d and rc6.d directories will not cause anything to be started. They will be called with the parameter stop to stop something. If so, why are there still scripts starting with an S in these two directories? Why not change all S to K? When changing to any run level, the rc script is run. It goes through the K entries with a stop. For runlevels 0 and 6, all the S entries are also run, in order, with a stop. For runlevels 1-5, The S entries are run with a start. According to the rc script, if an S entry was started in previous runlevel, and not stopped in current runlevel, it will be skipped, but if we are switching to runlevel 0 or 6, this script won't be stopped. Is this intended or I'm wrong? Actually, this check needs to be removed. It causes issues for the alsa script and also setclock (if used to set hwclock when network goes down in RL2). For runlevels 0 and 6, this lets us shut down in the order started (K entries) and then run the S entries, in order, to actually halt or restart the system. If we want to change the order of these scripts, we can simply change the number of the script, I still think there's no need for the S. There is no real _need_ for S links in 0 and 6. What it provides is a failsafe of sorts. Nothing outside of system software should ever put a start link in 0 and 6 ensuring that the last few scripts are run last (sendsignals, mountfs, and reboot/halt IIRC). -- DJ Lucas -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
DJ Lucas wrote: On 07/12/2011 06:19 AM, Theodore You wrote: On Tue, Jul 12, 2011 at 9:47 AM, Bruce Dubbsbruce.du...@gmail.com wrote: According to the rc script, if an S entry was started in previous runlevel, and not stopped in current runlevel, it will be skipped, but if we are switching to runlevel 0 or 6, this script won't be stopped. Is this intended or I'm wrong? Actually, this check needs to be removed. It causes issues for the alsa script and also setclock (if used to set hwclock when network goes down in RL2). Wouldn't this be just as easy as creating symlinks S50setclock in rc0 and rc6 in the LFS Makefile? In the same way, creating S35alsa symlinks in the BLFS Makefile would save the asla settings. There is no real _need_ for S links in 0 and 6. What it provides is a failsafe of sorts. Nothing outside of system software should ever put a start link in 0 and 6 ensuring that the last few scripts are run last (sendsignals, mountfs, and reboot/halt IIRC). Yes, IIRC, the process was taken from RedHat a long time ago. There would be other ways to shut down properly, but I don't see a pressing need to change what fundamentally works (with the tweaks above). -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
On 07/17/2011 02:51 PM, Bruce Dubbs wrote: DJ Lucas wrote: Actually, this check needs to be removed. It causes issues for the alsa script and also setclock (if used to set hwclock when network goes down in RL2). Wouldn't this be just as easy as creating symlinks S50setclock in rc0 and rc6 in the LFS Makefile? In the same way, creating S35alsa symlinks in the BLFS Makefile would save the asla settings. No. Drop to RL1 with alsa volumes restored via udev for an example of why that block should be removed. It doesn't matter for 0 and 6 because the check is skipped. It's been a while, but IIRC, the same thing for a K??setclock link in RL2. This is proper IMO when using NTP, but not really useful in practice. I don't do this any longer, but with the gradual change to udev scripts handling start up items instead of boot scripts for specific hardware (this will likely happen whether we like it or not), it would probably be good to be prepared for it (not to mention the alsa breakage that is there now). -- DJ Lucas -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
DJ Lucas wrote: On 07/17/2011 02:51 PM, Bruce Dubbs wrote: DJ Lucas wrote: Actually, this check needs to be removed. It causes issues for the alsa script and also setclock (if used to set hwclock when network goes down in RL2). Wouldn't this be just as easy as creating symlinks S50setclock in rc0 and rc6 in the LFS Makefile? In the same way, creating S35alsa symlinks in the BLFS Makefile would save the asla settings. No. Drop to RL1 with alsa volumes restored via udev for an example of why that block should be removed. It doesn't matter for 0 and 6 because the check is skipped. It's been a while, but IIRC, the same thing for a K??setclock link in RL2. I don't understand. What we have now is: for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2 /dev/null) do if [ ${previous} != N ]; then suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]} stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix [ -f ${prev_start} ] [ ! -f ${stop} ] continue fi check_script_status case ${runlevel} in 0|6) ${i} stop ;; *) ${i} start ;; esac error_value=${?} if [ ${error_value} != 0 ]; then print_error_msg fi done In rc1.d I have K30sshd, K80network, K90sysklogd, S25random. The same in rc2.d. setclock is executed in rcsysinit. If I add S50setclock and S40alsa to rc{0,6}.d, the '-f ${prev_start}' fails and the continue is never executed. The command is run with the stop parameter in both cases and does the right thing, AFAICT. This is proper IMO when using NTP, but not really useful in practice. Agree, except if the hw clock is too far off, ntp is unhappy. I don't do this any longer, but with the gradual change to udev scripts handling start up items instead of boot scripts for specific hardware (this will likely happen whether we like it or not), it would probably be good to be prepared for it (not to mention the alsa breakage that is there now). Are you suggesting that we just remove the 'if' block above? I'd think that might add some strange failures at shutdown, but shouldn't hurt anything. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
On Tue, Jul 12, 2011 at 9:47 AM, Bruce Dubbs bruce.du...@gmail.com wrote: Theodore You wrote: The book says in chapter 7.3: Links that start with an S in the rc0.d and rc6.d directories will not cause anything to be started. They will be called with the parameter stop to stop something. If so, why are there still scripts starting with an S in these two directories? Why not change all S to K? When changing to any run level, the rc script is run. It goes through the K entries with a stop. For runlevels 0 and 6, all the S entries are also run, in order, with a stop. For runlevels 1-5, The S entries are run with a start. According to the rc script, if an S entry was started in previous runlevel, and not stopped in current runlevel, it will be skipped, but if we are switching to runlevel 0 or 6, this script won't be stopped. Is this intended or I'm wrong? For runlevels 0 and 6, this lets us shut down in the order started (K entries) and then run the S entries, in order, to actually halt or restart the system. If we want to change the order of these scripts, we can simply change the number of the script, I still think there's no need for the S. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
Theodore You wrote: On Tue, Jul 12, 2011 at 9:47 AM, Bruce Dubbs bruce.du...@gmail.com wrote: Theodore You wrote: The book says in chapter 7.3:   Links that start with an S in the rc0.d and rc6.d directories will   not cause anything to be started. They will be called with the   parameter stop to stop something. If so, why are there still scripts starting with an S in these two directories? Why not change all S to K? When changing to any run level, the rc script is run.  It goes through the K entries with a stop.  For runlevels 0 and 6, all the S entries are also run, in order, with a stop.  For runlevels 1-5, The S entries are run with a start. According to the rc script, if an S entry was started in previous runlevel, and not stopped in current runlevel, it will be skipped, but if we are switching to runlevel 0 or 6, this script won't be stopped. Is this intended or I'm wrong? For runlevels 0 and 6, this lets us shut down in the order started (K entries) and then run the S entries, in order, to actually halt or restart the system. If we want to change the order of these scripts, we can simply change the number of the script, I still think there's no need for the S. Your distro, your rules. What we have is the way it's done on most distros that still use sysvinit. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
Re: Question about the 'K' and 'S' in script names in /etc/rc.d/rc{0, 6}.d
Theodore You wrote: The book says in chapter 7.3: Links that start with an S in the rc0.d and rc6.d directories will not cause anything to be started. They will be called with the parameter stop to stop something. If so, why are there still scripts starting with an S in these two directories? Why not change all S to K? When changing to any run level, the rc script is run. It goes through the K entries with a stop. For runlevels 0 and 6, all the S entries are also run, in order, with a stop. For runlevels 1-5, The S entries are run with a start. For runlevels 0 and 6, this lets us shut down in the order started (K entries) and then run the S entries, in order, to actually halt or restart the system. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page