Bug#401645: [Pkg-sysvinit-devel] Bug#401645: [pkg-wpa-devel] Bug#401645: wpasupplicant is stopped too early at reboot/shutdown
[Przemyslaw Bruski] here's the updated version of sendsigs script: better English, sed is not required anymore, useless assignment is removed. This version looks very interesting. If it work, it might solve a long-standing problem with NFS mounts. But the process list need to be extended. It might be better to skip all processes without any file descriptiors outside / and the kernel file systems instead of skipping some process names, to avoid having to hardcode a lot of process names in the scripts. I am sure the list isn't complete as it is now, and am unsure if we ever will be able to keep it up to date. I'll test it during christmas. Friendly, -- Petter Reinholdtsen -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#401645: [pkg-wpa-devel] Bug#401645: wpasupplicant is stopped too early at reboot/shutdown
Hi, here's the updated version of sendsigs script: better English, sed is not required anymore, useless assignment is removed. bye, Przemek #! /bin/sh ### BEGIN INIT INFO # Provides: sendsigs # Required-Start: # Required-Stop: umountnfs # Default-Start: # Default-Stop: 0 6 # Short-Description: Kill all remaining processes except for crucial ones. # Description: ### END INIT INFO PATH=/usr/sbin:/usr/bin:/sbin:/bin . /lib/lsb/init-functions #lists all ancestor pids, until pid number 0 is reached getAncestorPids() { local pid=$1 local ppids= while true; do ppid=$(ps --no-headers --format ppid $pid) if [ $ppid -eq 0 ]; then break; fi ppids=$ppid $ppids pid=$ppid done echo $ppids } # Replacement for killall5 command. Just like killall5 does, it sends # a signal to all processes except for: ancestor processes, itself # and kernel threads. # Addtionally, it skips all processes that had been run using command # name passed as a parameter. # # arguments: # signalnumber # list of command names that should not be killed killall5_except() { local signalNumber=$1 shift local myPid=$$ local preciousPids=$(ps --no-headers --format pid -C $*) #initial precious pids are: my pid and pids of processes given as parameters preciousPids=$myPid $preciousPids local ancestorPids= for preciousPid in $preciousPids; do ancestorPids=$ancestorPids $(getAncestorPids $preciousPid) done #kernel threads should not be killed, either. Kernel threads have userspace size of 0. local kernelThreadPids=$(ps --format pid,size --no-headers -A | while read pid size; do [ $size -eq 0 ] echo $pid done ) allPreciousPids=$preciousPids $ancestorPids $kernelThreadPids allPidsToTerminate=$(ps --deselect --no-headers --format pid --pid $allPreciousPids) #a trick to eliminate ps pid from the list allPidsToTerminate=$(ps --no-headers --format pid --pid $allPidsToTerminate) if [ ! -z $allPidsToTerminate ]; then kill $signalNumber $allPidsToTerminate fi } do_stop () { # Kill all processes. log_action_begin_msg Asking all remaining processes to terminate killall5_except -15 wpa_supplicant usplash log_action_end_msg 0 sleep 5 log_action_begin_msg Killing all remaining processes killall5_except -9 wpa_supplicant usplash log_action_end_msg 0 } case $1 in start) # No-op ;; restart|reload|force-reload) echo Error: argument '$1' not supported 2 exit 3 ;; stop) do_stop ;; *) echo Usage: $0 start|stop 2 exit 3 ;; esac :
Bug#401645: [pkg-wpa-devel] Bug#401645: wpasupplicant is stopped too early at reboot/shutdown
reassign 401645 wpasupplicant,sysvinit Przemyslaw Bruski [EMAIL PROTECTED] writes: Kel Modderman wrote: I though I was either crazy, or you were whispering sweet nothings in my ear, because on my boxen sendsigs was still at sequence number 20. Then I found this in /usr/share/doc/initscripts/changelog.Debian.gz: blushes Sorry about that. Hmm. I think this is no longer wpasupplicant issue, but please do not close that bug, it it's OK with you. My suggestion would be to ask the sysvinit guys to replace sendsigs with the following script (not sure if the attachment will come through, if it does not, I will repost the script body). With this rationale, I'm reassigning this bug to both packages, since this is an interaction issue. Full quoting for convinience of the sysvinit maintainers: Basically, in this script killall5 is replaced by a shell function that does the same and takes command names as parameters. These command are never killed. It solves both the wpasupplicant issue and usplash issue (I did not test the latter, I admit). The following sequence would be needed: 1. new (well, let's call it my) sendsigs would have to be run before umountnfs 2. umountnfs 3. wpasupplicant 4. original sendsigs (or mine running without exceptions). What would also be needed is you backing this solution, of course ;-) bye, Przemek #! /bin/sh ### BEGIN INIT INFO # Provides: sendsigs # Required-Start: # Required-Stop: umountnfs # Default-Start: # Default-Stop: 0 6 # Short-Description: Kill all remaining processes except for crucial ones. # Description: ### END INIT INFO PATH=/usr/sbin:/usr/bin:/sbin:/bin . /lib/lsb/init-functions #lists all ancestor pids, until pid number 0 is reached getAncestorPids() { local pid=$1 local ppids= while true; do ppid=$(ps --no-headers --format ppid $pid) if [ $ppid -eq 0 ]; then break; fi ppids=$ppid $ppids pid=$ppid done echo $ppids } # Replacement for killall5 command. Just like killall5 does, it sends # a signal to all processes except for: ancestor processes, itself # and kernel threads. # Addtionally, it skips all processes that had been run using command # name passed as a parameter. # # arguments: # signalnumber # list of command names that should not be killed killall5_except() { local signalNumber=$1 shift local myPid=$$ local preciousPids=$(ps --no-headers --format pid -C $*) #initial precious pids are: my pid and pids of processes given as parameters preciousPids=$myPid $preciousPids local ancestorPids= for preciousPid in $preciousPids; do local sessionLeaderPid=$(ps --no-headers --format session $preciousPid) ancestorPids=$ancestorPids $(getAncestorPids $preciousPid) done #kernel threads should not be killed too. Kernel threads have userspace size of 0. local kernelThreadPids=$(ps --format pid,size --no-headers -A | grep 0$| sed -e s/ [^ ]*$//) allPreciousPids=$preciousPids $ancestorPids $kernelThreadPids allPidsToTerminate=$(ps --deselect --no-headers --format pid --pid $allPreciousPids) #a trick to eliminate ps pid from the list allPidsToTerminate=$(ps --no-headers --format pid --pid $allPidsToTerminate) if [ ! -z $allPidsToTerminate ]; then kill $signalNumber $allPidsToTerminate fi } do_stop () { # Kill all processes. log_action_begin_msg Asking all remaining processes to terminate killall5_except -15 wpa_supplicant usplash log_action_end_msg 0 sleep 5 log_action_begin_msg Killing all remaining processes killall5_except -9 wpa_supplicant usplash log_action_end_msg 0 } case $1 in start) # No-op ;; restart|reload|force-reload) echo Error: argument '$1' not supported 2 exit 3 ;; stop) do_stop ;; *) echo Usage: $0 start|stop 2 exit 3 ;; esac : ___ Pkg-wpa-devel mailing list [EMAIL PROTECTED] http://lists.alioth.debian.org/mailman/listinfo/pkg-wpa-devel -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#401645: [pkg-wpa-devel] Bug#401645: wpasupplicant is stopped too early at reboot/shutdown
On Tuesday 05 December 2006 10:30, Przemyslaw Bruski wrote: Package: wpasupplicant Version: 0.5.5-2 Severity: normal Currently, wpasupplicant is stopped before unmountnfs.sh script is run. This means that the network connection for NFS mounts may be gone by the time we try to unmount them and can cause the system to hang at reboot or shutdown. It seems that wpa-ifupdown (current priority 15) should be run later than umountnfs.sh (current priority 31) . Of course you are right. However, sendsigs is run at sequence number 20, and it kills the wpa_supplicant process. So, we can remove wpa-ifupdown alltogether when the daemon is not killed prematurely by sendsigs. Until then, we opted to at least put down the interface cleanly. Any better ideas? Thanks, Kel. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]