Ubuntu – Turn off the Wireless card on each boot

startupwireless

I tried to disable the wireless functions at boottime like Lekensteyn described here: How can I keep a wireless card's radio powered off by default?

But it keeps starting enabled after a reboot!

I added the command to /etc/rc.local by running

sudo nano /etc/rc.local

Used the arrow keys / page up/down keys to navigate to the line before exit 0 and add rfkill block wifi, so that the file end like this:

# By default, this script does nothing

rfkill block wifi
# for debugging:
rfkill list > /tmp/wifi-state.txt

exit 0

Now in /tmp/wifi-state.txt I can see that it was blocked right after the call in rc.local But if I call

rfkill list

on the console, it shows that WiFi is enabled again:

0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: hci0: Bluetooth
    Soft blocked: yes
    Hard blocked: no

Additional info:
I added this to disable bluetooth it works fine:

rfkill block bluetooth

and

sudo rfkill block wifi

works fine on the console

Best Answer

You can try to use ifconfig instead...

Add the following to rc.local

$> ifconfig wlan0 down

If you suspend/hibernate your computer the you will have to add the same to the suspend process as well.

Create a file by

$> sudo nano /etc/pm/sleep.d/20_custom_wlan0

add the following to the file.

# Script to disable wlan0 before suspend and restart after wake.
case "${1}" in
        suspend|hibernate)
                echo suspending wlan0
                ;;
        resume|thaw)
               echo Resuming wlan0 - shutting down wlan0
               ifconfig wlan0 down
               ;;
esac

save the file and make sure is executable by

$> sudo nano /etc/pm/sleep.d/20_custom_wlan0

That should do the trick.

By the way the name of the filename doesn't matter so much except it must start with something below 60 as number decide where in the process the file is run. And some system have 60 staring the network card after suspend. Look in the /etc/pm-suspend.log file.