Ubuntu 13.04 will not shutdown
Solution 1:
I modified the script responsible for sending the kill signal with allocated delay, /etc/init.d/sendsigs, and reduce the amount of time it does to kill the remaining processes in 2 iteration. Healthy or not it gets the job done on my system and is no longer hanging on shutdown and restart.
Below is a portion of the /etc/init.d/sendsigs with modification indicated by # <--- :
# Kill all processes.
log_action_begin_msg "Asking all remaining processes to terminate"
killall5 -15 $OMITPIDS # SIGTERM
log_action_end_msg 0
alldead=""
OMITPIDS0="$OMITPIDS"
#for seq in 1 2 3 4 5 6 7 8 9 10; do # this is the original line
for seq in 1 2; do # <--- the above line is replaced by this one.
then on the lower part of the script:
# Upstart has a method to set a kill timeout and so the job author
# may want us to wait longer than 10 seconds (as in the case of
# mysql). (LP: #688541)
#
# We will wait up to 300 seconds for any jobs in stop/killed state.
# Any kill timeout higher than that will be overridden by the need
# to shutdown. NOTE the re-use of seq from above, since we already
# waited up to 10 seconds for them.
while [ -n "$(upstart_killed_jobs)" ] ; do
seq=$(($seq+1))
#if [ $seq -ge 300 ] ; then # this is the original line
if [ $seq -ge 2 ] ; then # <--- I can't wait for another 300 iteration
break
fi
NOTE: This may not be the best solution since the original script is working on other systems, for those systems like mine where several suggested solutions did not apply - this is what I can share considering I am only running the system as a workstation with no critical services running after closing all the desktop applications I use before clicking on the shutdown or restart icon.
System in use is an Asus X550DP laptop.
Solution 2:
Try the command
sudo shutdown -P now
in the terminal.
If even after broadcast, the state remains active, then force shutdown by holding the power key pressed for 5 seconds reboot and go to
/etc/default/halt
and forcefully add
INIT_HALT = power_off
(as pointed by mauro above) this must work again with the normal shutdown or shutdown from the terminal.