Before we get started...
This is a guide on how to get ndiswrapper working on the newest Debian Sarge without having to compile anything at all. I've done it on two different machines so far, and it worked fine on both. This isn't ment to be a slacker's easy way out, but it works just as well as a genuine compile, and takes about 1/4 the time or effort.
Originally, I was trying to get the ndiswrapper source to compile with the stock Debian Sarge kernel. This didn't work because the kernel headers were absent. Even after installing them, compile failed with obscure errors. Getting the source didn't help either. Still no dice. I read around places and found that the kernel that comes with Debian Sarge has problems with ndiswrapper under certain situations. I made the safe assumption that I somehow had one of these "situations", and set out to get a new kernel.
You need a new kernel, but not to fear. The almighty apt-get has you covered from start to finish.
From this point on are instructions on how to get a new kernel and then get ndiswrapper playing ball with it. If you're unwilling to update your kernel, you can stop reading now. Please note that this kernel upgrade is very easy. There is no compile process and the whole deal takes about fifteen minutes; it isn't the usual kernel compile rigmarole. Also, it's totally safe to do the following. When the new kernel is installed, it makes an
additional entry in your boot loader, it doesn't replace your current one. You're not stuck if it doesn't work.
Do you want 386 or 686?
Before we start, you should know that this guide assumes you're using a 686 CPU. Something like a P4, a P4 based Celeron, Pentium3, a PentiumPro, or similar. AMD Athalon people should be okay as well. Those with 64bit processors can try, but I have no idea if it will work. If your using a 586 or older, just replace every 686 in this guide with a 386. Everything will still work the same.
Let's get it started.
Ready? Let's do it.
Time for a new kernel
First, you need to grab a new kernel. One is compiled and waiting for you in the apt repository. Do...
Code:
apt-get install kernel-image-2.6.8-2-686
It will download the deb containing the kernel and work it's magic. Before you know it a new kernel will be all setup and your boot loader will be configured with a new entry to boot it. Cool, huh? Your previous kernel and boot loader entry are preserved so you can boot it anytime you like.
Reboot and choose your new kernel at the bootmenu.
We need wireless-tool and ndiswrapper binaires
First we'll grab the wireless-tools package. This will let us setup our card once it's working. You guessed it, apt-get has us covered.
Code:
apt-get install wireless-tools
The wireless tools will be downloaded and installed. You can check that they are by typing "iwconfig" and seeing if it gives you any output. It won't tell us anything good now, but it'll come in very handy later. Now we need to grab the ndiswrapper itself. Do...
Code:
apt-get install ndiswrapper-modules-2.6.8-2-686
If it suggests you install additional packages (it should suggest ndiswrapper-utils), type "Y" and hit enter to agree. It will download and install the packages. When it's done, try...
You should get a notice saying that no drivers are installed. This is normal, as we haven't yet given it the WindowsXP drivers to wrap. If you get a command not found error, then the ndiswrapper-utils package either wasn't suggested during the ndiswrapper-module install, or it failed for some reason. If it wasn't suggested (it was suggested to me), you can just get it yourself with...
Code:
apt-get install ndiswrapper-utils
Now try the "ndiswrapper -l" again. You should get the no drivers notice.
Now it's time to fix that no drivers notice. Get ahold of the WindowsXP drivers for your card. Don't use drivers included on the CD that came with your card, they won't work 99% of the time, and sometimes they cause kernel panics or other nasty things. Best to play it safe and grab the drivers known to work with your card. Go to the official ndiswrapper card list located
here. Once you've got them, extract the driver files someplace (it doesn't matter where) and do the following in that directory.
Hook ndiswrapper up with your drivers
You'll need to run a...
Code:
ndiswrapper -i DRIVER.inf
..for a each .inf file required by your card. Usually you only need one. Your card's entry in the ndiswrapper card listing will tell you if you need more than one. I happen to need three. Once you have all the .inf files you need installed, you should do a...
...and check the output to make sure you see something like:
Code:
Installed ndis drivers:
lsbcmnds driver present
lsipnds driver present, hardware present
wmp11nds driver present
Your drivers will be have different names, and you may have more or less drivers installed. The important thing is that one of them says "hardware present". If you see a "hardware not present" you probably have bad drivers. If you see "cant see hardware", then you don't have wireless-tools. You should have downloaded them earlier in this guide, but if for some reason you didn't, just...
Code:
apt-get install wireless-tools
...and try "ndiswrapper -l" again. If all is well, move on.
Load up the module...sorta
It's time to load the module. Well, sorta. Remember installing the ndiswrapper-module package? It didn't actually install a module, but it did give us an ndiswrapper.ko, and that will work just as well.
You'll do this the old-school way...
Code:
insmod lib/modules/`uname -r`/misc/ndiswrapper.ko
The " ` " marks around "uname -r" aren't the " ' " next to your enter key, they're next to the " 1 " key, at the top left.
Doing this command probably won't give you any output, but it will give you the functionality of the ndiswrapper module. Now try...
You should now have an entry called "wlan0", and a bunch of information about it. If you see something like this...
Code:
wlan0 IEEE 802.11b ESSID:off/any
Mode:Managed Frequency:2.437 GHz Access Point: 00:40:05:C5:4E:03
Bit Rate:11 Mb/s Tx-Power:17 dBm
RTS thr:2347 B Fragment thr:2346 B
Encryption key:off
Power Management:off
Link Quality:100/100 Signal level:-69 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:54 Invalid misc:512 Missed beacon:0
...then you're good to go. You may have additional entires without wireless extensions in the output, but this is normal.
Congratulations! Your card is up and running in Linux! Now to get it configured so you can be on your way. It's is simple enough.
Let's tame this beast
At this point I recommend you turn off the ethernet connection. It can cause problems with the wlan0 interface if it's running when you try to configure the wireless card. Do...
If you've been using an ethernet connection to download the packages we've been installing, it will be lost. If for any reason you want it back, just...
Code:
ifup eth0
dhclient eth0
...and you'll be back to normal.
We'll get your new wireless running post haste. First we should make sure your AP (your wireless router or access point) is configured to have open access. Turn off WEP/WAP in your router or AP's configuration for the time being. Now let's set your SSID on the wireless card. It's simple. Do...
Code:
iwconfig wlan0 essid yourssidgoeshere
That will set the ssid. You won't get any feedback, but this is normal. Now run "iwconfig" again and check the ESSID in the top right of the block of information about your wireless card. It should no longer say "off/any", but the SSID you configured it to use. If it doesn't, try the command a few more times. Move your computer a little, do whatever you would normally do to get better signal. If "off/any" changed to your ssid, then you're good to go.
You don't have to bring up the wlan0 interface, but you do need to get an IP. Do...
A bunch of stuff will go by, and at the end you'll either have errors, a long wait, or an IP on your network. If you get errors, then obviously something is wrong. Check the error and yoursystem logs and hunt down the wrench in the works. If you get a long wait, your card is probably not talking to the router like it should, look in your logs and see if you can find out what's holding things up, it could just be that you aren't getting good signal. If you get no errors, and things finish in a reasonable time, you should be done. Open up a web browser and see if you can get to Google. If it works, then you're cooking with lasers, and everything is kosher. Congratulations!
Making it easy to start
If you want to make bringing up your wireless easy (this guide doesn't configure the ndiswrapper in a way that can be auto-loaded via normal means) dump the following in a text file and name it "loadwireless.sh". (really you can name it anything you want, just keep the .sh at the end) Make sure to put your ssid in place of "yourssidgoeshere"
Code:
#!/bin/sh
ifdown eth0
insmod /lib/modules/`uname -r`/misc/ndiswrapper.ko
sleep 2
iwconfig wlan0 essid yourssidgoeshere
chmod it executable and run it as root to bring your wireless up. After you run the script, you should run "iwconfig" manually a few times to check and see if your SSID is being used. If after several entries of "iwconfig" you still don't get your SSID set, try entering the config command from the script againg manually. Your card may not have started up in time to catch the command in the script. Just enter...
Code:
iwconfig wlan0 essid yourssidgoeshere
Moving your computer a bit (a few inches, not to the other side of the room) helps it get signal with your router, and will make your SSID appear in the "iwconfig" output. After you've got your SSID in, remember to run "dhclient wlan0" or you won't get an IP, and won't have internet.
I'm sure there's a way to get this to be run automatically, but I'm done with my major accomplishments for the day. I'm cool just running this as root once the system is up and running. You don't have to be exclusively logged in as root for it to work, a root console in a normal user session will do fine.
All done!
That's all, folks. Post problems if you have them and I'll try to help you out. I'll do my very best, but keep in mind that I'm not a genius at this, I just happened to discover a correct way via experimentation and research. Like I said, ask and I'll try to help. I'm a nice guy, so don't be afraid to ask, no matter how small or large the question.
Thanks for reading my guide!