Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Since a long time ago my Sony Vaio with Lubuntu 11.10 is showing a red FAIL message during the shutdown process.

It tries to kill some process and the white messages on the screen frozen for some seconds (a little pause) and then the FAIL appears and the shutdown goes on.

But it was not like this when I'd installed Lubuntu. Something happened and I didn't know until last week.

Last week I discovered why it is pausing the shutdown process for a while.

I disabled the wireless adaptor using the button in front of my laptop (that is, the hardware was off). Then I noticed that the shutdown was so quickly. No FAIL messages and my laptop was off after maybe 5 or 6 seconds.

So I'm almost sure that some wlan0 connection is holding the shutdown process. Maybe it is trying to keep connected or trying to disable the connection.

If I disable it using the button, everything is fast.

Any idea to fix this?

Edit: following the suggestion given by @Gilles, now the shutdown process is very fast. I used his script with the additional line rfkill block all.

But, as we can see on the image below, the script is returning some not found.

enter image description here

share|improve this question
how about if you soft shutdown wlan0 before shutting down system... does it still take long ? –  Salton May 28 '13 at 17:06
@Salton, are you talking about using the network icon on the panel to disable the wifi connection? I'd never imagined it. If it'll work, what would be your suggestion? I'll try this when I get home. –  Sigur May 28 '13 at 17:11
What messages appear before FAIL? –  Gilles May 29 '13 at 9:26
@Gilles, I recorded using a camera and I can see that when I press esc to show the messages I can read Asking all remaining process to terminate... [OK] and below killing all remaining process... [FAIL]. Also, something about dispatcher. Sorry but the camera unfocused so I'll need to record again today. –  Sigur May 29 '13 at 16:15
Thanks. That's weird, and hard to diagnose as it's happening after logging stops. Right now I have no idea what might be causing this. –  Gilles May 29 '13 at 17:19
add comment

2 Answers

If you want it to automatically turn off the wireless device before shut down, I would recommend putting

sudo ifconfig wlan0 down

in your ~/.bash_logout file, that way it will be brought down during logout and you don't have to worry about the correct run levels within the rc files, resulting in a fast shutdown sequence.

If you get prompted for your sudo password, you can also do

sudo nano /etc/sudoers

and add


to the end of the file (where username is your username) which will allow you to use sudo without prompting for a password every time, and thus allow you to disable your wireless connection right before the shutdown sequence begins without a password prompt.

share|improve this answer
Just one question: if I need to use the sudoers approach, the pass for sudo commands will never be necessary? All the terminal commands will be executed without root pass requesting? This is not desirable. –  Sigur May 28 '13 at 22:58
@Sigur .bash_logout is the wrong place for this. It's only used in text mode sessions, so it won't be executed if you log out from the GUI, but it will be executed when you log out from an SSH session, which is exactly backwards. –  Gilles May 29 '13 at 9:27
All terminal commands you issue with sudo won't ask for a password, but you can still use it as an access limiter. @Gilles my mistake on bash_logout, I thought it occurred when the system began shutdown sequence and you were logged out. My mistake. –  Jacob Coleman May 29 '13 at 12:46
@Gilles, thanks for the explanation. I noticed that it didn't work. I discovered that LXDE has a file autostart to be used when the session starts. Is there a kind of autoend? –  Sigur May 29 '13 at 16:16
@Sigur, lxsession-logout is the closest equivalent script. –  Jacob Coleman May 29 '13 at 20:50
show 3 more comments

The message “killing all remaining process...” comes from the shutdown script /etc/init.d/sendsigs, which is executed as part of the shutdown sequence through the symbolic link /etc/rc0.d/S20sendsigs.

You can execute a custom script beforehand by linking it in /etc/rc0.d and /etc/rc6.d (0 for shutdown, 6 for reboot — don't ask) and giving it a priority less than 20. Write the following script as /etc/init.d/sigur-wlan-stop:

## Turn off all wireless networks
for x in /sys/class/net/*; do
  if [ -e "$x/wireless" ]; then
    if grep -q "^$x=" /run/network/ifstate; then ifdown "${x##*/}"; fi
    ifconfig "${x##*/}" down

Make the script executable and link it in the shutdown scripts:

chmod 755 /etc/init.d/sigur-wlan-stop
ln -s ../init.d/sigur-wlan-stop /etc/rc0.d/S10sigur-wlan-stop
ln -s ../init.d/sigur-wlan-stop /etc/rc6.d/S10sigur-wlan-stop
share|improve this answer
Ow, I wont ask... lol Thanks so much, I'll try this as soon as possible. Just to inform, if I disconnect the wlan0 using the icon on the panel, not the hard button, the problem remains. So it is something related with the hardware, I guess. –  Sigur May 29 '13 at 17:37
@Sigur Oh. Then after the ifconfig line, I think you'll need to add rfkill block wlan, or maybe rfkill block wifi or rfkill block all. If you're unlucky and you're hitting some weird firmware bug even that might not work. –  Gilles May 29 '13 at 17:40
Thanks. I'm curious to see the result of your script. I don't understand all those lines but /run/network/ifstate should be a path on my disc? Here on my pc (not the vaio) I don't have /run folder. –  Sigur May 29 '13 at 19:11
@Sigur /run is a recent-ish addition, not all distributions have it yet. I checked on Ubuntu 12.04, on older released maybe it's /var/run/network. If you don't have it, try going directly for ifconfig … down or even directly to rfkill. ifdown runs disconnect hooks, but when you're shutting down that rarely matters. –  Gilles May 29 '13 at 19:41
please, see my edited post. Now, it is very fast but some error appears. –  Sigur May 29 '13 at 20:21
show 8 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.