Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My desktop's PCI wireless card is always scanning for available wireless networks, but I only rarely use it. Can I keep the radio turned off until I need it?

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

A bit hacky, but it should work. A wireless card can be disabled using the rfkill command. All devices used by rfkill can be shown using rfkill list. Sample output:

0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

Hard blocked is dependend on a hardware setting, e.g. a wireless switch on a notebook. Soft blocked can be controlled by the OS (Ubuntu).

How does it work? It does not have a manpage, running rfkill provides a help text in this case:

Usage:  rfkill [options] command
Options:
        --version       show version (0.4)
Commands:
        help
        event
        list [IDENTIFIER]
        block IDENTIFIER
        unblock IDENTIFIER
where IDENTIFIER is the index no. of an rfkill switch or one of:
        <idx> all wifi wlan bluetooth uwb ultrawideband wimax wwan gps fm

Ah, now we get somewhere. You need to run rfkill block wifi as root to disable the wireless device. (wlan is an alias of wifi, see the source code of rfkill).

Now, if you want to disable the wireless functions at boottime, add the command to /etc/rc.local by running sudo nano /etc/rc.local. Use 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
exit 0

When finished, press Ctrl + X, then press Y to save it and press Enter to accept the filename.

If you decide to activate the device later, run: sudo rfkill unblock wifi. Do not forget to remove the line from /etc/rc.local if you decide to use the wireless card.

share|improve this answer
    
Thanks. I don't understand why, but it looks like I don't need to use sudo for rfkill to work. –  ændrük Feb 4 '11 at 14:16
1  
You do not need sudo in /etc/rc.local as the script is run with root permissions. It's very unlikely you can disable wifi without root permissions. If I try rfkill block wifi or rfkill unblock wifi, I get "Can't open RFKILL control device: Permission denied". –  Lekensteyn Feb 4 '11 at 20:41
    
On both my ThinkPad X60 and my desktop with a PCI wireless card, running $ rfkill block wifi causes the NetworkManager applet to display "Wireless is disabled" and $ iwconfig to display Tx-Power=off. $ rfkill unblock wifi undoes this effect. –  ændrük Feb 13 '11 at 23:22
add comment

Personally I use Jupiter the power management applet to disable the wireless on my laptop as it is controlled by a special button. I don't think is in the main repo I had to add a ppa from Andrew at Webupd8 to get it.

Hope this helps.

share|improve this answer
add comment

The easiest way to disable your wireless card is to right-click on the NetworkManager indicator (small icon on top-right on the panel), and untick the Enable Wireless. This brings down (ifconfig wlan0 down) the interface and it does not perform scanning anymore.

share|improve this answer
1  
Checking this menu item does not affect the default behavior. The next time I turn on the computer, the wireless radio is active again. –  ændrük Jan 31 '11 at 23:22
add comment

You could add

ifconfig wlan0 down

to /etc/rc.local, but first,

ensure that, if you're using NetworkManager (I have version 0.8.4~git.20110319t175609.d14809b-0ubuntu3), you go to menu "Edit Connections" -> "Wireless" tab, click on the connection, click "Edit", and make sure that, in the "Wireless" tab, the "Connect Automatically" checkbox is NOT checked.

share|improve this answer
    
While this will bring the interface down, it won't save as much power as disabling the radio using rfkill. –  gertvdijk Feb 3 '13 at 20:48
add comment

Your Answer

 
discard

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.