UBUNTU : NDISWRAPPER TROUBLESHOOTING GUIDE

There are plenty of good how-tos on ndiswrapper out there, but many of them lack thorough troubleshooting sections or omit important information. This guide is intended to diagnose and solve the most common issues that prevent ndiswrapper from working, even after it appears to be successfully installed and configured.



This guide assumes that you've followed ndiswrapper instructions somewhere and as far as you know completed all steps successfully, but still are unable either to see wireless networks (using the "iwlist scan" command) or make your system detect your wireless interface at all. (If you can see networks but can't manage to connect for some reason, steps 5 and up may be useful, although they were not written specifically for your situation.) If that describes your troubles, start at the top of this guide and work your way down; hopefully you'll discover the source of your problem and be able to resolve it.

Please note that this is not intended to be another guide to installing and setting up ndiswrapper, as that would be redundant. If you need help getting started with ndiswrapper, refer to the community documentation or do a Google search.

1. check whether ndiswrapper recognizes your wireless card

ndiswrapper won't work until it thinks that your Windows drivers have been properly installed and that they are the appropriate ones for your wireless card. You can run the command:

Code:
ndiswrapper -l
(that's a lowercase L, not a 1) to find out whether it recognizes your card properly (make sure your wireless card is plugged in and turned on before running that command). If you get a message like:
Code:
netwg111 : driver installed
 device (0846:4240) present (alternate driver: p54usb)
then ndiswrapper detects your card correctly and believes that you have installed the appropriate Windows drivers for it. In that case, go on to check #2 below. If ndiswrapper mentions an "alternate driver" (p54usb in the example above) and you haven't already blacklisted it, you may want to do so now; see check #3 below for instructions on how to blacklist modules that may interfere with ndiswrapper. (Note that the "alternate driver" message doesn't necessarily mean that a conflicting driver is causing ndiswrapper not to work. To determine for sure whether a conflicting driver is the problem, you need to look at the output of lshw -C Network; see check #3 below for details.)

'invalid driver!' message

If ndiswrapper -l complains about an invalid driver, it most likely means that it was unable to find a .sys file corresponding to the .inf file that you loaded into ndiswrapper. The .sys file (which usually, but not always, has the same name as the .inf file) needs to be in the same directory as the .inf when you install the Windows driver. So if ndiswrapper is telling you that an invalid driver is installed, try installing your Windows driver again, and make sure that the .sys file is in the same folder as the .inf that you install into ndiswrapper.

finding the right drivers: Note: the ndiswrapper database is currently down; please see the notice below for more information

If the output of 'ndiswrapper -l' says that a driver is installed but doesn't mention either device XXXX:XXXX present or invalid driver, then something's wrong: most likely you installed the wrong Windows driver.

The most reliable way to locate the appropriate Windows drivers for your wireless device is to search the ndiswrapper site for your wireless card's device ID and chipset model. To get the device ID and chipset model of your card, run the command:
Code:
lspci -nn
or, if your wireless card is an external USB stick, use:
Code:
lsusb
The output of the 'lspci' or 'lsusb' command should include a line describing your wireless card (note that the relevant line may not necessarily include the word "wireless"; it may mention only "ethernet" or "network communications device" or something similar), including its device ID. For example, here is a line for an Atheros PCI wireless card, with the important information in bold:
Code:
01:01.0 Ethernet controller [0200]: Atheros Communications Inc. AR2413 802.11bg NIC [168c:001a] (rev 01)
and here's the line for a Netgear WG111v2 USB wireless card (in this example, the chipset model is not mentioned...but you should always at least see the device ID number):
Code:
Bus 001 Device 003: ID 0846:4240 NetGear, Inc. WG111 WiFi (v2)
Once you've determined the device ID of your wireless card, use Google to search the ndiswrapper site (the built-in search function of the site doesn't work very well). Search for site:ndiswrapper.sourceforge.net [device ID] or site:ndiswrapper.sourceforge.net [chipset name], e.g.:
or:

IMPORTANT NOTE: as of early October, the ndiswrapper database has been broken for some time--it returns blank pages when you try to access it. It's not clear when this is going to be resolved. As a result, I copied Google's cache of the database pages to my personal website. You can access them here. Put your wireless card's name or device ID into the search function of that site, and any relevant pages in the database will be brought up.

The result should return a link to the ndiswrapper wiki with information on where to find good Windows drivers for your card. For instance, the search above (for device ID 168c:001a) leads to a page with this information:

Quote:
* Chipset: Atheros AR5007EG (rev 01)
* PCI ID: 168c:001c
* Driver: ftp://ftp.work.acer-euro.com/noteboo...s_v5_1_1_9.zip
* ndiswraper version : > 1.45
* other : need to uninstall all madwifi kernel module before use ndiswrapper
* other : if you can’t get any AP signal, try to enable wifi radio through wlan switch (it’s look like nothing happened when you try to enable through wifi, because the LED is not compatible with linux(i’m using ubuntu 7.04), but if you try ‘iwlist wlan0 scan’ you’ll see some AP information
* other : 64-bit XP driver is available at http://www.giga-byte.com.tw/Support/...Name=GN-WI01GT
which nicely outlines where to find Windows drivers for the card in question, and special tweaks that may be required to make the card work.

If your wireless card is very new, you may not find any references to it on the ndiswrapper site. If that's the case, try using the Windows drivers that came on a CD with your wireless card, or download drivers from the manufacturer's site. You may have to try a few different versions of the Windows drivers before you get one that works.

what if the Windows drivers are inside a .exe file?


Increasingly, wireless-card vendors are releasing Windows drivers in .exe format, making it difficult to extract the .inf and .sys files that you need to load into ndiswrapper (loading the whole exe. won't work). On Linux, you can sometimes extract .exe packages using the commands 'unzip' or 'cabextract' (needs to be installed first with sudo apt-get install cabextract), or use 7-zip in Windows to break the .exe open. If that doesn't work, try running the .exe installer using wine; it should extract the driver files to a directory at some point, at which time you can copy them over elsewhere, then kill the installer (the Windows installer will not make your wireless card work on Linux, even if it appears to install everything properly; don't bother trying). In a worst case, install the .exe package on a Windows machine, and the .inf and .sys files that you need should be copied into c:\windows\system32 (or system64), from whither you can copy them to your Linux system.

forcing device recognition:

In rare cases, ndiswrapper doesn't recognize wireless cards even when the correct Windows drivers are installed. If this happens, you can force ndiswrapper to try to use a certain driver for a given device with the command sudo ndiswrapper -a device-id driver, e.g.:
Code:
sudo ndiswrapper -a 0846:4240 netwg111
Note that there is a small chance that forcing ndiswrapper to use the wrong driver can cause physical damage to your wireless card, so you should not use the -a argument unless you have a good reason to believe that the Windows driver that you're selecting is the right one for your card, even though ndiswrapper disagrees.

2. check machine architecture


An important caveat to ndiswrapper, and one that many tutorials fail to mention, is that the architecture of the Windows drivers that you use with ndiswrapper needs to match that of your Linux kernel--no exceptions. In other words, if you're running 64-bit Ubuntu, the Windows drivers that you use need to be built for 64-bit Windows. If ndiswrapper -l reports "device present" but you still can't get your wireless card to work, this is the likely culprit--ndiswrapper will still report "device present" even if the Windows drivers are not the right architecture.

If you don't know whether your kernel is 32 or 64-bit, run the command:
Code:
uname -m
If the output is 'i686' (or possibly 'i586' or 'i486' on older machines), you have a 32-bit kernel; if it's 'x86_64,' you're using 64-bit. If the output is anything else, you don't have an x86-compatible processor and you can't use ndiswrapper (because Windows doesn't support platforms other than x86).

If you installed Windows drivers built for the wrong architecture, find the appropriate ones and install them (you will need to remove the bad ones first with the sudo ndiswrapper -r driver-name command). Refer to check #1 above for information on locating good Windows drivers.

Keep in mind that for some wireless cards, 64-bit Windows drivers were never released. If this is the case for your device and you want to use a 64-bit Linux kernel, you're probably out of luck. You could complain to your wireless-card vendor and demand 64-bit Windows drivers, or you could check to see if any native Linux driver will support your card. Otherwise, your only option is to switch to a 32-bit kernel.


3. resolve conflicts with competing wireless drivers


If ndiswrapper -l looks good and you're sure that your Windows drivers are built for the right architecture, but you still can't get the system to recognize your wireless device, it could be because another wireless driver is trying to control the card. Some native Linux wireless drivers (many of which are built into the Ubuntu Linux kernel by default) will claim a device even though they're not capable of driving it successfully.

To check whether another driver is trying to claim your device, use the command lshw -C Network. Here's an example of the output:
Code:
*-network:0             
       description: Wireless interface
       product: AR2413 802.11bg NIC
       vendor: Atheros Communications Inc.
       physical id: 1
       bus info: pci@0000:01:01.0
       logical name: wifi0
       version: 01
       serial: 00:19:e0:67:8a:f1
       width: 32 bits
       clock: 33MHz
       capabilities: pm bus_master cap_list logical ethernet physical wireless
       configuration: broadcast=yes driver=ath_pci ip=192.168.1.3 latency=168 maxlatency=28 mingnt=10 module=ath_pci multicast=yes wireless=IEEE 802.11g
In bold is information about which driver (module) is controlling the device in question (if you don't see any drivers or modules mentioned and the first line of lshw mentions UNCLAIMED, move on to check #4). In the example above, the driver is ath_pci, which is a native Linux driver for Atheros-based wireless cards. Other common drivers that may conflict with ndiswrapper are 'b43' (Broadcom chipsets), 'ssb' (Broadcom), 'bcm43xx' (Broadcom), 'iwl3945' (Intel), 'iwl4965' (Intel) and 'rt2x00' (Ralink).

ndiswrapper won't work until you tell the system not to use the module that's trying to claim the card. You can prevent the system from loading modules by adding them to '/etc/modprobe.d/blacklist' (in Ubuntu 9.04 and later, this file is named /etc/modprobe.d/blacklist.conf' instead of just 'blacklist'). Open up the blacklist file with:
Code:
sudo gedit /etc/modprobe.d/blacklist
(or 'sudo gedit /etc/modprobe.d/blacklist.conf' if you're using Ubuntu 9.04 or later) and add to the bottom of the file a line to blacklist each module that you want the system to ignore. For example, to blacklist 'ath_pci,' add the line:
Code:
blacklist ath_pci
Then save the file and run this command:

Code:
sudo update-initramfs -k all -u
Now reboot. Thereafter, the system will not load ath_pci until you remove it from the blacklist, and ndiswrapper should be free to claim the wireless card.

module-dependency issues:


Once in a while, the system will load a module even though it's on the blacklist. This happens because the module is a dependency of another module that's not on the blacklist--for example, 'b44,' an ethernet driver, requires the 'ssb' module and won't allow it to be unloaded, so you have to also add 'b44' to the blacklist in order to force the system to ignore 'ssb.'

If after a reboot lshw -C Network still shows a module other than ndiswrapper claiming your wireless card, use the rmmod command to remove the module. For example, to remove 'ssb,':
Code:
sudo rmmod ssb
If the system doesn't want to unload the module because of dependency issues, it will tell you which modules are at the root of the dependency, so that you can blacklist them too. If 'ssb' cannot be unloaded because of 'b44,' for example, then the command above would output:
Code:
ERROR: Module ssb is in use by b44
Then you could blacklist 'b44' as per the instructions above (don't forget to run update-initramfs -k all -u after editing your /etc/modprobe.d/blacklist file) and everything would be great (except your ethernet may not work, but that's another issue).

module-alias problems:

If you still find the conflicting module being loaded and you're sure that module-dependency issues are not the problem, it's probably because an alias of the module in question needs also to be blacklisted (thanks to caljohnsmith for pointing this out). To find out if the module that you want to blacklist has aliases, run the command:

Code:
depmod -n | grep alias | grep -v ':' | grep -i [module name]
e.g.:

Code:
depmod -n | grep alias | grep -v ':' | grep -i p54usb
would list aliases for the module p54usb, a driver for Prism-based USB wireless cards. The output from the example above would tell you that p54usb has the alias prism54usb, so in order to blacklist p54usb effectively, you would need also to add the line blacklist prism54usb to your /etc/modprobe.d/blacklist file.

*many thanks to nightmarelord for pointing out the bit about running sudo update-initramfs -k all -u after updating the blacklist file.


4. check that the ndiswrapper module is loaded


If the lshw -C Network output for your wireless card looks like:
Code:

  *-network:0 UNCLAIMED
       description: Ethernet controller
       product: AR2413 802.11bg NIC
       vendor: Atheros Communications Inc.
       physical id: 1
       bus info: pci@0000:01:01.0
       version: 01
       width: 32 bits
       clock: 33MHz
       capabilities: pm cap_list
       configuration: latency=168 maxlatency=28 mingnt=10
then no driver, including ndiswrapper, is trying to claim the card. This is bad, because you want ndiswrapper to claim it.

If you've run through all of the checks above but lshw -C Network still reports your wireless card as unclaimed, the most likely cause is that the ndiswrapper module is not being loaded by the system. To check whether it's present, run the command:
Code:
lsmod | grep ndis
If the output returns nothing, the ndiswrapper module is not being loaded for some reason. Try running this command to load it:
Code:
sudo modprobe ndiswrapper
Then wait a few seconds and see if your wireless card is detected. If so, great; keep reading for steps on making the system load ndiswrapper automatically. Otherwise, move on to check #5.

Loading ndiswrapper automatically at boot:

In modern versions of Ubuntu, ndiswrapper is supposed to be loaded automatically at boot. Sometimes for various reasons that fails to happen, however. If this appears to be your problem, run this command:

Code:
echo 'ndiswrapper' | sudo tee -a /etc/modules
and the problem should be resolved. This command tells the system explicitly to load the ndiswrapper module while booting, no matter what.


5. check dmesg output


dmesg prints messages from the kernel. If you've run through all of the stuff above but still can't get ndiswrapper to work, it may be because something weird is going on (e.g., a bug in ndiswrapper or the Windows driver); dmesg should provide some insight into the problem. You can get dmesg information related to ndiswrapper with the command:
Code:
dmesg | grep -e ndis -e wlan
Normal output for a working ndiswrapper configuration should look similar to:
Code:
[  507.517874] ndiswrapper version 1.52 loaded (smp=yes, preempt=no)
[  507.555668] ndiswrapper: driver net5211 (,05/02/2007,5.3.0.45) loaded
[  507.969072] ndiswrapper: using IRQ 20
[  508.055020] wlan0: ethernet device 00:1f:3a:8f:13:96 using serialized NDIS driver: net5211, version: 0x50003, NDIS version: 0x501, vendor: 'NDIS Network Adapter', 168C:001C.5.conf
[  508.060224] wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK
[  508.060642] usbcore: registered new interface driver ndiswrapper
[  508.139154] ADDRCONF(NETDEV_UP): wlan0: link is not ready
If dmesg doesn't mention ndiswrapper at all, run sudo modprobe ndiswrapper and then try dmesg | grep -e ndis -e wlan again, or go back to check #4 to verify that the ndiswrapper module is being loaded by the system.

If your dmesg output contains error messages related to ndiswrapper, try googling them (leave out the numbers in brackets at the beginning of each line, which are timestamps and will throw off your Google search) to see if you can figure out a fix. Unfortunately, it's impossible here to cover every kind of strange problem with ndiswrapper that dmesg may reveal, but Google may be able to help.

In addition, below are some of the most common error messages that you may encounter in dmesg, and their meaning:

If dmesg complains about "bad magic," you probably installed drivers for the wrong architecture (e.g., 32-bit Windows drivers on 64-bit Linux). Refer back to check #2.

If dmesg mentions something like "radio disabled by hardware," you probably need to turn your wireless card on; see check #6 below.

If dmesg contains a lot of errors that begin with "unknown symbol," it probably means that the Windows driver that you installed is either corrupted or that ndiswrapper doesn't like it for some reason. It may help to reinstall the Windows driver, or choose a different version of it (e.g., try the Windows 2000 driver instead of the XP one, or try version 1.0 of the driver instead of 2.0). Sometimes it's the case that a certain release of the Windows driver doesn't agree with ndiswrapper, even though it should. It can also happen that the Windows drivers that you downloaded were corrupted in transit, so downloading them a second time (and checking the md5 sum if possible) may help.

Again, if your error message is not listed above, remember: Google (and, failing that, the Ubuntu forums) is your friend.

6. make sure the wireless is turned on

Some computers, particularly laptops, have switches for enabling and disabling wireless cards. Usually this is either a physical button on the outside of the computer, or a software switch that you toggle using key combinations, like function+F2. More often than you might think, wireless issues come down to the card being physically disabled, so if nothing above has helped you yet, make sure that your wireless is turned on.

In rare cases, your wireless card (or the PCI bus holding it) may be disabled in your computer's BIOS for some reason, so if you can't seem to get the system to detect a wireless device at all (even an unclaimed one in the output of lshw -C Network), check BIOS.

7. reinstall ndiswrapper from source


Most people use the Ubuntu repositories (Synaptic or "apt-get") to install ndiswrapper using a Debian package. Sometimes, it's helpful to compile the program from source, which will ensure that the build of ndiswrapper that you're using matches your system's characteristics as exactly as possible. Compiling from source also usually gives you a more up-to-date version of ndiswrapper than the one available in the repositories. To compile ndiswrapper from source, follow these steps:

First, remove Ubuntu's version of ndiswrapper by typing:
Code:
sudo apt-get remove --purge ndiswrapper-common
Next, download the latest stable release of the ndiswrapper source code from the ndiswrapper site and save it to your desktop (if you don't have a wired Internet connection available for this step, download the ndiswrapper .tar.gz file on another computer and transfer it over via a USB stick or CD). Note: Ubuntu 8.10 (Intrepid) users should download ndiswrapper version 1.54 or later, as earlier versions won't compile on Intrepid.

Finally, extract the source and compile it (these commands assume that the ndiswrapper .tar.gz file is saved on your desktop):
Code:
cd ~/Desktop
sudo -s
apt-get install build-essential
tar -xzvf ndiswrapper*
cd ndiswrapper*
make
make install
After that, you will need to reinstall the appropriate Windows drivers into ndiswrapper, and then reboot for good measure. Your wireless will then hopefully be working.

8. none of the above helped

If you've gone through all of the checks above and still have no idea why ndiswrapper won't work, the first thing to do is google a lot for ndiswrapper + ubuntu + [your wireless card name] or ndiswrapper + ubuntu + [your wireless card device ID]. In many cases, this will lead to a solution: remember, you're probably not the first person in the world to run into trouble with ndiswrapper with your particular wireless card (although it's possible if your card is really new). There may be some special hacking required to get it to work, and that should be documented somewhere on the Internet.

If you're still at a total loss, start a new thread in the Networking and Wireless subforum of this site, or post below. Include results from the checks above, and hopefully someone will be able to help you figure out what's wrong and make your wireless work.

---

This is a working guide. If you have suggestions for improvement, please tell me. If this guide helps you, I would also be grateful if you'd let me know.

Tidak ada komentar:

Posting Komentar