Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The guide is part of Chapter 8, which provides a full guide to hardware configuration under Ubuntu (including network devices, printers, scanners, 3D cards, and more).
In addition to detailing how to install/remove NdisWrapper drivers, this massive 3,500 word guide includes the vital steps of precisely matching the correct driver to the hardware, and then extracting the necessary files from Windows driver archive files. These steps are frequently overlooked by other guides and are a brick wall for many users.
The guide is aimed at Ubuntu Edgy Eft (6.10) users, although it should work on other versions of Ubuntu, including Feisty Fawn (7.04). In fact, with the application of some common sense, it should work on most other distros (a modified version of the guide is included in my other recent book, Beginning SUSE Linux, Second Edition).
Without further ado, let's get on with it.
NdisWrapper is effectively an open-source driver (technically described as a kernel module) that allows Linux to use standard Windows XP drivers for wireless network devices. You might describe NdisWrapper as being a translation layer between the Linux kernel and the Windows drivers, which can be installed using NdisWrapper’s configuration tools.
You should only use NdisWrapper in one of two situations:
Your wireless network hardware simply isn’t recognized by Ubuntu, which is to say, no entry for the wireless hardware appears in the list of network devices in the Network Settings configuration dialog.
Your network hardware is recognized by Ubuntu but fails to work correctly when you configure it. Perhaps it is unable to associate with wireless base stations, for example. If this is the case, in addition to installing NdisWrapper, you’ll have to undertake an additional step in order to blacklist the existing Ubuntu driver. This is explained later.
Using NdisWrapper is relatively simple and just a handful of commands are required. However, getting hold of the necessary Windows driver files is harder work because, unfortunately, NdisWrapper isn’t designed to work with the usual method of driver distribution: .exe files. Instead, NdisWrapper needs the specific .inf and .sys files that constitute the driver—effectively, the Windows system files. In many cases, these are contained within the .exe file and must be manually extracted.
NoteOf course, sometimes drivers are distributed as .zip files, in which case the relevant files are easy to get at. Keep your fingers crossed that this will be the case for your particular hardware!
NdisWrapper is far from perfect. Not all wireless devices have been proven to work with it, and it’s not necessarily the case that a driver available for Windows will work under Linux. Sometimes trial and error is required. Annoyingly, Windows drivers sometimes appear to work but then prove unreliable. Some might stop working. Some might even crash your system. The best plan is simply to give it a try.
TipNdisWrapper gets better and better with every new release. This is why it’s a good idea to update your system on a regular basis. I give full details of how this can be done in Chapter 9 of Beginning Ubuntu Linux, Second Edition.
I'm going to explain how to make an Asus 802.11g wireless network device that’s built into an Asus A6R notebook work under Ubuntu using NdisWrapper. The instructions remain essentially the same for all types of wireless network hardware. However, some specific details, such as download addresses, will obviously differ.
First, I explain how to install the NdisWrapper software. Next, I explain how to discover what Windows drivers you need. Following this, I explain how to extract the necessary files from the driver archive, and finally, how to actually install the Windows drivers under Ubuntu. You might also need to blacklist the existing Linux driver, which I also cover.
These steps merely make your wireless network device available under Ubuntu. Once completed, you should use the standard network configuration utilities to associate with your router or base station. This is covered in detail in Chapter 8 of Beginning Ubuntu Linux, Second Edition.
Installing the NdisWrapper Configuration Tools
NdisWrapper consists of two components: a kernel module and configuration tools. The kernel module comes as part of the default kernel package, so is installed by default. Therefore, all you have to do is install the configuration tools. Start Synaptic Package Manager, and search for and install ndiswrapper-utils-1.8. You’ll be told that ndiswrapper-common also needs to be installed. This is fine.
NoteEnsure that you select ndiswrapper-utils-1.8 if you're using Edgy Eft (6.10), and not any other version of NdisWrapper! A packaging bug means that other versions won't work correctly.
Installing the Windows XP Drivers
Once the NdisWrapper configuration software is installed, you can install the Windows XP wireless network device drivers. There are three parts to the procedure:
Identify the wireless network hardware in your computer and then source the appropriate Windows driver.
Extract the necessary .sys and .inf files from the driver archive (and possibly .bin files, although this is rare).
Use the NdisWrapper configuration tools to install the Windows driver, and tweak a configuration file so that the NdisWrapper kernel module loads each time you boot.
All three steps are dealt with separately in the following sections. In later stages, you will need another computer that’s already online to download some files and check the NdisWrapper web site for information. If your computer dual-boots, you can use your Windows setup to do this.
Identifying Your Wireless Network Hardware and Sourcing Drivers
To identify the wireless network hardware for use with NdisWrapper, it’s necessary to discover two pieces of information: the make and model of the hardware, and the PCI ID number.
The former is the make and model of the hardware, as identified by Ubuntu as a result of system probing, rather than what’s quoted on the packaging for the wireless network device or in its documentation. These details discovered by Ubuntu will usually relate to the manufacturer of the underlying components, rather than the company that manufactured the hardware.
The PCI ID is two four-digit hexadecimal numbers used by your computer to identify the device internally. The same PCI ID numbering system is used by both Windows and Ubuntu, which is why it’s so useful in this instance.
Follow these instructions to discover the information you need:
You can find both the PCI ID and the make/model information using the Device Manager tool. Start System -> Administration -> Device Manager.
What you do now depends on whether your wireless hardware is recognized by Ubuntu (which is to say, it appears in Network Settings but doesn’t work properly). If the device isn’t recognized, skip to the next step. If it is recognized, look in the list of hardware that appears, and find the entry that reads WLAN Interface. Then look at the entry immediately above this in the list, where you’ll find listed the make and model of the hardware. Write this down. On my test notebook, containing an ASUS wireless network device, this read BCM4318 [AirForce One 54g] 802.11g Wireless Lan Controller. As anticipated, these details don’t relate to those listed in the wireless network device’s documentation (the notebook’s manual lists the hardware simply as an ASUS 802.11g device). This is because Ubuntu is identifying the hardware generically, reading information from its component hardware. Select the WLAN Interface entry, and click the Advanced tab on the right side of the program window. Then look through the information there for the line that begins net.physical_device. Look at the end of the line, and make a note of the two sets of letters and numbers that are separated by underscore characters and are preceded by pci_. On my test notebook, these were 14e4 and 4318, as shown in the screenshot below, in which the relevant areas are highlighted.
If the wireless hardware isn’t recognized by Ubuntu (which is to say, it doesn’t appear in the Network Settings dialog box), look in the Device Manager list of hardware for an entry mentioning 802.11, WLAN, or possibly simply "wireless". This entry in the list will be the make and model details you need, so write them down. Next, select the wireless device’s entry in the list, and click the Advanced tab on the right side of the window. Look through the information there for a line that reads info.udi. Look at the end of the line, and make a note of the two sets of letters and numbers that are separated by underscore characters and are preceded by pci_. Look at the screenshot below for guidance.
When written alongside each other, the two sets of digits you noted in step 2 or 3 become the PCI ID number. In written form, they’re usually separated by a colon, so in my case, the PCI ID of the wireless network device is 14e4:4318. If either of the sets of letters or numbers is less than four characters long, simply add zeros before them in order to make four characters. For example, on my desktop PC, the end of the net.physical_device line read 1814_201. I added a zero before 201, making the complete PCI ID of 1814:0201. On another of my test PCs, the end of the line read 168c_13. I, therefore, added two zeros before the 13 to make a PCI ID of 168c:0013.
Using the search function of your browser (Ctrl+F within Firefox), look for the PCI ID number you noted earlier, in the format described in step 4. For example, with the PCI ID I discovered on my test notebook, I searched for 14e4:4318. In the list, look to match the following things, presented in order of importance:
- The PCI ID.
- The manufacturer and model name of the wireless hardware, as reported by Device Manager; this will be listed in the Card: part of the entry in the list and/or within the Chipset: section too.
- The manufacturer and model of the notebook, as mentioned on its case or within its documentation. This will be mentioned in the Card: or Chipset: sections or possibly within the Other: section.
It’s likely many entries in the list may match your PCI ID, so search until you find the one that best matches the manufacturer and model of the hardware. If there are still many matches, search until you find an entry that matches the manufacturer and model of the notebook. You might not be lucky enough to find an exact match for the notebook manufacturer and model, however, and you might have to select the most likely choice. Use your common sense and judgment. If your notebook is manufactured by Asus, for example, but you can’t find the drivers for the exact model, then choose drivers for another Asus model.
CautionUnless you're using a 64-bit version of Ubuntu, watch out for any mention of x86_64 in the description of the driver file. If you haven't specifically chosen to use 64-bit Linux, you'll probably be using 32-bit. If you encounter an entry relating to x86_64, keep searching.
Look within the entry in the list for a direct link to the driver file. Sometimes this isn’t given, and a manufacturer web site address will be mentioned, which you can visit and navigate through to the driver download section (usually under the Support section within the web site). Download the Windows XP driver release.
Extracting the Driver Components
Once the drivers are downloaded, you’ll have to extract the .sys and .inf file relevant to your wireless network hardware. These are all that NdisWrapper needs, and the rest of the driver files can be discarded. However, extracting the files can be hard to do, because often they’re contained within an .exe file.
NoteMost driver .exe files are actually self-extracting archive files.
Additionally, the driver file might contain drivers for several different models of hardware, and it’s necessary to identify the particular driver .inf file relevant to your wireless network device:
If the driver you’ve downloaded is a .zip file, then your task will probably be much easier. Simply double-click the downloaded .zip file to look within it for the directory containing the actual driver files. Often this directory is called "driver", or sometimes it’s named after the OS for which it contains files, such as Win_XP. If you’ve ever installed Windows drivers then this will sound familiar. Once you’ve found the relevant directory, click and drag the .inf, .sys, and .bin files to a separate folder (there probably won’t be any .bin files, however). You can ignore any other files, such as .cab and .cat files. Then go to step 4.
If the driver is an .exe file, it’s necessary to extract the files within it. With any luck you might be able to do this using an archive tool like WinZip (www.winzip.com), assuming that you’ve downloaded the file using Windows. Simply open the archive using the File -> Open menu option within WinZip. You may have to select All Files from the File Type drop-down list in order for the .exe file to show up in the file list. However, if you’re using Windows, I recommend an open-source and free of charge program called Universal Extractor, which can be downloaded from http://www.legroom.net/software/uniextract. This program can extract files from virtually every kind of archive, including most driver installation files. Once it is installed, simply right-click the installation .exe file, and select UniExtract to Subdir. This will then create a new folder in the same directory as the downloaded file, containing the contents of the installer file.
As mentioned in step 1, it’s likely the driver files you need will be contained in a folder called something like Driver or Win_XP. Once you’ve found the relevant directory, look for .inf, .sys, and .bin files (although you may not find any .bin files; they’re only used in a handful of drivers). Click and drag the files to a separate folder. You can ignore any other files, such as .cab and .cat files.
The task now is to find the .inf file for your hardware. If there’s only one .inf file, then you can move to the next step. If there’s more than one, you’ll need to search each until you find the one you need. You need to look for text that corresponds to the PCI ID you noted earlier. Open the first .inf file in a text editor (double-clicking will do this in Windows), and using the search tool, search for the first part of the PCI ID, as discovered earlier. For example, I searched for 14e4. If this isn’t found within the file, move on to the next .inf file, and search again. When you get a search match, it will probably be in a long line of text and to the right of the text VEN_. Then, look further along that line to see if the second part of the PCI ID is mentioned, probably to the right of text that reads DEV_. In the case of the driver file I downloaded, the entire line within the .inf file read as follows (I’ve highlighted the two component PCI ID parts in bold):
If you find both component parts of the PCI ID in the line, as in my example, then you’ve found the .inf file you need. (In actual fact, you’ll probably find many lines matching what you need; this is no issue.)
You must now transfer the .inf file, along with the .sys and .bin files (if any .bin files were included with the driver) to the computer on which you want to install the drivers. This can be done by putting them onto a floppy disk, by burning them onto CD, or using a USB memory stick.
Blacklisting Existing Drivers
Your progress from this point onward depends on if Ubuntu recognized your wireless networking device when you first booted but was unable to make it work correctly. If it did then you will have to blacklist the built-in driver, so that NdisWrapper can associate with the hardware. If the device wasn’t recognized, you can skip straight to the “Using NdisWrapper to Install the Drivers” heading.
To blacklist the existing driver, you need to find out the name of the kernel module and then add it to the /etc/modprobe.d/blacklist file. Here are the steps:
Open Device Manager (System -> Administration -> Device Manager), and select the entry in the list for your wireless network device. Click the entry mentioning the make and model of your network hardware.
Click the Advanced tab on the right-hand side of the window, and look for the line that begins info.linux.driver. Then look in the value column, and make a note of what’s there. For example, on my test notebook, the value column read bcm43xx.
Close Device Manager, and open a terminal window (Applications -> Accessories -> Terminal). Type the following to open the blacklist configuration file in the Gedit text editor:
gksu gedit /etc/modprobe.d/blacklist
At the bottom of the file, type the following on a new line:
Replace <modulename> with the name of the module you discovered earlier. For example, on my test system, I typed the following (as shown in the screenshot below):
Save the file, and reboot your computer. You should now find that the wireless network device is no longer visible in the Network Settings program window. This is good, because it means the hardware no longer has a driver attached, and we can now tell NdisWrapper to make use of the hardware.
Using NdisWrapper to Install the Drivers
On the Ubuntu computer on which you wish to install the drivers, you should now have the .inf file from the previous steps, plus the .sys and possibly .bin files that constitute the driver. Copy the files from the removable storage device into an empty folder on the desktop. Name the new folder "driver".
NoteIf you’ve used a USB memory stick to transfer the files, it should appear automatically on the desktop as soon as it’s inserted. When you’ve finished with it, right-click the desktop icon, and select Eject. You must do this before physically removing any kind of USB memory device. I describe how to handle removable storage devices in Chapter 8 of Beginning Ubuntu Linux, Second Edition.
To install the driver using NdisWrapper, follow these instructions:
Open a terminal window (Applications -> Accessories -> Terminal). In the window, type the following to switch to the directory containing the driver files:
Replace <username> with your own username.
To install the driver, type the following:
sudo ndiswrapper –i filename.inf
Replace filename.inf with the name of the .inf file you discovered in the previous steps.
Next, type the following:
sudo ndiswrapper –m
gksu gedit /etc/modules
This will open the modules configuration file for editing. On a new line at the bottom, add the following:
Ensure you press Enter after adding the line.
Save the file, close Gedit, and reboot your computer.
Following this, you should find the network device is available for configuration, such as associating with a wireless base station and configuring WEP/WPA. I explain how to configure both WEP and the newer WPA in Chapter 8 of Beginning Ubuntu Linux, Second Edition.
Removing NdisWrapper Drivers
As mentioned earlier, although NdisWrapper can solve a lot of headaches with nonworking wireless hardware, it isn’t perfect. You might find that the Windows driver you install simply doesn’t work. In such a case, you can download a different version of the driver and try again. But first you’ll need to uninstall the existing driver.
Open a terminal window, and type the following, which will cause NdisWrapper to list currently installed Windows drivers:
sudo ndiswrapper –l
Look for the first component of the line that’s returned. On my test notebook, the line read:
bcmwl5 driver installer, hardware present
The first component of the line will be the name of the driver that you need to remove. To remove it, type the following line:
sudo ndiswrapper –e <drivername>
Replace <drivername> with the name of the driver. For example, I typed the following:
sudo ndiswrapper –e bcmwl5
Now, you can repeat the preceding step discussing sourcing the Windows driver. Note that there’s no need to repeat all of the steps under the “Using NdisWrapper to Install Drivers” heading discussing installing the NdisWrapper modules. All that’s necessary once you grab the new driver file is to issue the "sudo ndiswrapper –i" command, specifying the new driver .inf file.
NoteThe Broadcom BCM4318 wireless device, used as an example here, is extremely common in modern notebooks. Although work is being undertaken to make it work under Ubuntu, at the time of this writing, support is patchy. Therefore, a lot of Ubuntu users with notebooks containing this hardware utilize NdisWrapper to make it work. In fact, a handful of community members got together and created an installation script to make the process a lot easier. The script will automatically blacklist the existing driver and install a new one. You can find more information at the Ubuntu Forums: http://ubuntuforums.org/showthread.php?t=197102.