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.

I use Ubuntu 10.04 and I see, that every time when I start it enables Wireless Connectivity.
I know, that there is a topic about it on Ubuntu forums, but I think I will get old before I get an answer there (if there is one).

I would like to disable it by default, but to have possibility to enable or disable it later.

UPD: I'm looking how to disable Wireless adapter. Something like Fn + ... in Windows, but in windows it remembers the last state. In Ubuntu wireless adapter is always enabled at startup.

Re-UPD: Picture with what I'm talking about:

Image

When I press Fn + F2 it disables those diodes and Wireless + Bluetooth.

share|improve this question
add comment

12 Answers 12

up vote 7 down vote accepted
+25

There are so many ways to disable the card, the simplest i would say would be put a

sudo ifdown wlan0 

in your /etc/rc.local above the exit 0, this should disable the wireless card (replace wlan0 with your wireless interface card)

if you want to enable / disable on a keyboard press reading http://ubuntuforums.org/showthread.php?t=1287673 explains how to link a keyboard event to a script. If you want it to toggle when you push keys you will have to add some logic to the script. Though the simplest might be to have one key to enable and another to disable.

down script

    #!/bin/bash
    IFACE=wlan0
    ifconfig ${IFACE} down

and up script

    #!/bin/bash
    IFACE=wlan0
    ifconfig ${IFACE} up
share|improve this answer
    
Do I understand correctly, that placing this sudo ifdown wlan0 in rc.local will not affect the system anyhow even after reboot? Do I need to call this script somehow? –  Eugene Sep 9 '10 at 16:11
    
That script is called immediately at the end of the boot script. It will effectively turn off the wifi card once the system has finished booting. The only thing that will happen is that the wifi card gets turned off. –  Thomas W. Jul 15 '11 at 13:38
add comment

Bruteforce would be the blacklisting of the wifi-kernel modules:

  1. dmesg | grep atheros (or whatever in your pc) or lsmod
  2. look for that driver/module in /lib/modules//kernel/drivers/wireless/...
  3. create a blacklist file "no-wireless.conf" in dir /etc/modules.d, containing

    # blacklist wifi
    blacklist [a blacklist line for each name of your wifi modules eg. ath...]
    blacklist rfcomm
    blacklist mac80211

--

But you can't enable wifi anymore after boot, except you remove this file from modprobe.b and reboot

PS: Don't forget, before you should backup your system somehow (eg with ubuntu live or whatever)

(Sorry didn't read that post underneath)

share|improve this answer
add comment

Create session on startup application such as:

Settings >> Preference >> Startup Application

Add then fill command :

dbus-send --system --type=method_call --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.DBus.Properties.Set string:org.freedesktop.NetworkManager string:WirelessEnabled variant:boolean:false

false means off but it can be to enable by fn+F2 or something else.

share|improve this answer
add comment

Wireless can be enabled or disabled using rfkill tool. Here is solution based on it, that will allow to save state and restore it at system startup.

Step 00: creation of file to store wifi state

cd /usr/local/etc
sudo touch .wifistate
sudo chmod 666 .wifistate

Step 01: script

    #!/bin/bash
    IFACE="wlan1"
    STATE_FILE="/usr/local/etc/.wifistate"

    STATE="$(iwconfig $IFACE | grep Tx | cut -d '=' -f2 | grep off)"
    if [ "$STATE" ]
    then
       rfkill unblock wifi &&
       echo 1 > "$STATE_FILE" &&
       echo "Wireless enabled"
    else
       rfkill block wifi &&
       echo 0 > "$STATE_FILE" &&
       echo "Wireless disabled"
    fi
    exit 0;

Step 10: making script executable

chmod +x <script name>

Step 11: modifying Ubuntu startup script

open /etc/rc.local in any text editor (must be edited as root) and add following code
before exit 0; line:

    FILE="/usr/local/etc/.wifistate"
    if [ -r "$FILE" ]
    then
       if [ $(cat $FILE) -eq 0 ]
       then
          rfkill block wifi
       fi
    else
       rfkill block wifi
    fi

Done, now script from step 01 may be linked to keyboard event. After first use it will write 0 or 1 in .wifistate file, and on system startup rc.local script will take attempt to read this value and, if it is 0, disable wifi.
If .wifistate file does not exist, by default wifi will be disabled at startup.

share|improve this answer
add comment

Run sudo lshw -c network and look for the name of the driver for your wireless card. Run lsmod | grep DRIVERNAME to show the exact name of the driver. Then add a line to /etc/modprobe.d/blacklist.conf that says blacklist EXACTDRIVERNAME. This will stop the wifi module from being loaded at boot time. Run sudo modprobe EXACTDRIVERNAME at any time to restart the wifi.

This works quite effectively, but is not the best solution. It does not disable the Wireless card. It just prevents the OS from using it, but it may still be on, consuming battery power.

share|improve this answer
add comment

Whatever the reason is for what you're trying to disable it, I'm not sure if it works for every laptop, but it worked for me: with a plugged LAN cable Ubuntu ignores the wi-fi, thus making you able to sorta "turn it off" prior to system loading.

share|improve this answer
add comment

If your FN+F2 do not work in Ubuntu (it should, mine does in an Asus EeePC netbook), then i really reccomend you using Jupiter. Its a sweet, well polished notification area applet.

With it, you can enable and disable Bluetooth and WiFi separately, as well as other nice controls for notebooks and netbooks. It remembers the state after reboot and even remember the state per power source (meaning it can always turn WiFi ON when you plug in power, and automatically turn it OFF when you are on battery). And you can bind all actions to keystrokes.

A nice review, and some screenshots: http://www.webupd8.org/2010/06/jupiter-take-advantage-of-asus-super.html

Official project page: http://www.jupiterapplet.org/

PPA (for automatic updates in APT/Synaptic/Software Center: https://launchpad.net/~webupd8team/+archive/jupiter

Wiki (great thecnical documentation): http://sourceforge.net/apps/mediawiki/jupiter/index.php?title=Main_Page

share|improve this answer
add comment

I use wicd instead of NetworkManager. It remembers wi-fi state after reboot/next boot. Don't know how, but it does. :)

If you don't need some NM features, use wicd. It's easyer to use and control.

share|improve this answer
    
How does it remember wireless network state? I can't even disable it from there. Do you need a screenshot of what I see from there? Maybe some specific tab? –  Eugene Sep 10 '10 at 16:41
    
Sorry for late response. Does Fn+F2 works for you now? If yes WiCD should save wireless adapter state upon next boot. –  PocketSam Oct 10 '10 at 13:27
add comment

Install sysv-rc-conf then run it as root and make sure there is an X at runlevels S 0 1 2 for wpa-ifupdown or simply type sudo sysv-rc-conf --level S012 wpa-ifupdown on after installing.

share|improve this answer
1  
Would you care to elaborate on what will those operations do? –  Eugene Sep 10 '10 at 8:17
    
By the way it didn't disable those diodes, so I guess it didn't help. –  Eugene Sep 10 '10 at 16:40
    
This adds the wpa-ifupdown script to the corresponding runlevels. Maybe you have to add even more runlevels. S012345 should add it to all runlevels except the reboot level (6) –  keyboardsurfer Sep 11 '10 at 15:03
add comment

Try looking under 'System > Preferences > Network Connections > Wireless' and make sure none of the listed wifi spots are set to auto connect. This will not stop wireless starting, but will stop it from making any connections.

share|improve this answer
add comment

try sudo iwconfig wlan0 txpower off

replace wlan0 with eth2 or whatever is your wifi interface.

this will disable your wifi antenna and save power, but it doesn't prevent Network Manager from trying to connect so you might want also to disable network manager's wifi auto connect settings as described by Oli.

share|improve this answer
    
Strange. If it will disable my wifi antenna, then logicaly it will not find any wireless networks and it will not try connect. At least this is how I see it logicaly, but I could be wrong. –  Eugene Sep 6 '10 at 16:06
    
Also, now when I tried it I can say, that this was not the correct solution and I'm adding a picture to question. Maybe, that will help. –  Eugene Sep 6 '10 at 16:41
    
@Eugene, what is your wifi driver and exact laptop model? I suspect that you need a driver specific solution, if you want that the led on your laptop is turned off. –  ithkuil Sep 10 '10 at 17:50
    
@ithkuil You know what. I don't know what is my wifi driver actually, but I have Asus F3T laptop. –  Eugene Sep 11 '10 at 11:42
    
@Eugene, please attach the output of the lspci command ? Probably it's an Atheros 5006EG WLAN card. This guy here personal.inet.fi/koti/vjankala/sf/asus.html says that Fn-F2 works on your laptop with festy. Does it work for you? if yes, please invoke "iwconfig" while the wifi is active, deactivate the wifi with Fn-F2, and then execute iwconfig again (pasting the output here). –  ithkuil Sep 12 '10 at 14:22
show 7 more comments

You can stop it connecting to specific connections automatically quite easily.

  1. Right click the Network Manager notification applet
  2. Click Edit Connections...
  3. Under the Wireless tab, click edit on the connection(s) you want to disable by default and click edit.
  4. Uncheck Connect automatically
  5. Click apply, close the window, rinse and repeat.

When you want to connect, just left click the applet and select an access point.

Note: This doesn't power off the wifi card and it'll still be searching for wireless access points. This might not be what you're looking for. But if it is, great!

Note 2: If your connection drops, it won't automatically reconnect.

share|improve this answer
    
Nope. That's not it. I'm looking how to disable Wireless adapter. Something like Fn + ... in Windows, but in windows it remembers the last state. In Ubuntu wireless adapter is always enabled at startup. –  Eugene Sep 5 '10 at 17:54
    
@Eugene: Add that information to your original question please! –  Jorge Castro Sep 5 '10 at 18:00
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.