Nice tip MarcS. That is indeed better than the other workarounds. Here, a quick script -- cleanup-upstart.sh -- that checks initctl list for stalled processes and kills them:
#!/bin/sh # vim: set ts=8 sw=4 sts=4 et ai tw=71: upstart_spawn_and_stop() { name=$1 pid=$2 pkill -xf 'sleep 11' && echo "killed old sleep process" echo $((pid-2)) | sudo tee /proc/sys/kernel/ns_last_pid >/dev/null && sh -c 'sleep 11 &' sleeppid=`pgrep -xf 'sleep 11'` if test "$sleeppid" != "$pid"; then echo "looks like we did not get the right pid.." return 1 fi parentpid=`ps -o%P -p$pid | sed -e1d` if test "$parentpid" -eq 1; then echo "very well.. we've got a live pid" else echo "looks like it got the wrong parent.. started from X?" return 1 fi return 0 } pkill -xf 'sleep 11' && echo "killed old sleep process" initctl list | tac | while read line; do procpid=`echo $line | awk '{print $4}'` if ! test -d /proc/$procpid; then procname=`echo $line | awk '{print $1}'` echo "$procname:" if upstart_spawn_and_stop $procname $procpid; then initctl status $name initctl stop $name # "Terminated"? fi fi done -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to upstart in Ubuntu. https://bugs.launchpad.net/bugs/406397 Title: init: job stuck with expect fork/daemon when parent reaps child Status in Upstart: Triaged Status in “upstart” package in Ubuntu: Invalid Status in “upstart” package in Debian: Confirmed Status in PLD Linux Distribution: New Bug description: Hi Wrong use of the expect fork stanza can create job with status job stop/killled, process nnn without any process nnn running on the system. As an example the following avahi.conf should have used "expect daemon", but will instead create a stuck job. stop on stopping dbus-system respawn expect fork exec avahi-daemon -D /Emil Renner Berthing To manage notifications about this bug go to: https://bugs.launchpad.net/upstart/+bug/406397/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp