Ndiswrapper the easy Debian way...

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

Ndiswrapper the easy Debian way...

#1 Post by hkoster1 »

Are people still using Ndiswrapper?

Here's a quick recipe that works for Debian old stable (Squeeze) and newer, based on DKMS. Open a root terminal and give the command

Code: Select all

# aptitude install ndiswrapper-dkms
That will compile/install the kernel module. People still using an older release (like Lenny) or those who don't like the automatic DKMS code, must do this by hand (see later).
Next, locate the Windows XP driver for your device (it has an .inf extension), and (still in the same root terminal session) use the commands

Code: Select all

# ndiswrapper -i /full/path/to/WinXP/Driver/driver.inf
# ndiswrapper -m
# modprobe ndiswrapper
where you should substitute for driver name and location. That's it! With a bit of luck you should now be able to configure the resulting wireless interface.

Read on if the above doesn't work, or if you're interested in the long story...

First off, let's admit that all is not well with Ndiswrapper. Closed-source drivers ("binary blobs") in Linux are under fire, and so is the Ndiswrapper programme that uses them. Some newer wireless adapters use the 802.11n (draft) protocol and/or the 5GHz band; these either don't yet work in Ndiswrapper or have only unsuitable drivers for Windows Vista, Windows 7 or (heaven forbid) Windows 8. There have also been problems getting WPA/WPA2 personal security to work with Ndiswrapper.

Fortunately, Ndiswrapper is needed less and less, as new and improved open source drivers become available for devices with popular chipsets like Atheros (ath5k, ath9k), Ralink (rt2x00, 2810) and Broadcom (wl for recent 43xx devices). This alone is worth an upgrade to a recent kernel, e.g. from backports. Alternatively, a wireless bridge or game adapter (they're the same thing) may be a cost-effective way to connect a (desktop) computer to a wireless network via the Ethernet port, without having to worry about Linux-compatible wireless modules.

But if you must install Ndiswrapper, consult Documents/Wiki on http://ndiswrapper.sourceforge.net/joomla/ for a list of supported devices. Even if your wireless device is not listed there, it may still have a chipset that is supported; you'll only know for sure by trying...

All commands to follow must be given in a terminal with root privileges; the order of the commands is crucial, so don't skip a step!
  • 1. First, install/compile the Ndiswrapper kernel module.
    Starting with Debian old stable (Squeeze), DKMS can do the work for you

    Code: Select all

    # aptitude install ndiswrapper-dkms
    which will pull in all needed sources and dependencies in the process.
    Alternatively, if you're still using old-old-stable (Lenny) or when you don't want to use the DKMS scripts, you must install/compile by hand

    Code: Select all

    # aptitude install module-assistant ndiswrapper-source ndiswrapper-utils
    # m-a prepare
    # m-a a-i ndiswrapper
    Either way, you should now have the ndiswrapper.ko kernel module available in the /lib/modules/... tree for your current kernel. DKMS automatically reacts when installing a new kernel version; the manual procedure must be redone in that case.
  • 2. Mount the CD that came with your device, or log in at the manufacturer's website, and preferably find the Windows XP driver for it (Windows Vista, Windows 7 or 8 drivers may not work).

    Important: if you're running a 64-bit system ("AMD64" kernel) then you'll need a 64-bit Windows driver; a 32-bit version of the driver will not work in a 64-bit OS (even though it appears to install OK in Ndiswrapper).

    The driver will be called something like <name>.inf; there may also be a companion .sys file in the same or the parent directory. If you're getting the driver from somewhere else, make sure to also get that companion file (when present) and put it in a directory that retains the relationship with the directory the .inf file is in (e.g. its parent directory, when appropriate). Write down the full path to the driver, like /media/cdrom/Driver/WINXP/<name>.inf.
  • 3. Install the driver (still as root) into Ndiswrapper with

    Code: Select all

    # ndiswrapper -i /media/cdrom/Driver/WINXP/<name>.inf
    # ndiswrapper -m
    # ndiswrapper -l
    
    of course substituting the path in your own setup. That last command may also show an alternative driver, like ssb or b43. This poses a bit of a problem that we deal with in item 5. Assuming that you don't have this problem, continue with the next item.
  • 4. Insert the module (still as root) with

    Code: Select all

    # modprobe ndiswrapper
    There should be no error messages from the modprobe command. If necessary, add ndiswrapper to /etc/modules for automatic insertion at boot. Next insert the wireless device, if you haven't already, and watch what happens with one or more of the commands

    Code: Select all

    # iwconfig
    # iwlist scan
    # ifconfig
    These commands should show the presence of the new wireless interface, like wlan0 (or ra0, etc), although not yet configured... but that's another story.
  • 5. But what if that new wireless interface of the previous step doesn't show? This could happen when the ndiswrapper module isn't loaded early enough in the boot sequence, allowing another kernel module like ssb or b43 to take over. What to do?

    Well, it could be that one of those additional modules is in fact a driver for your wireless device! This could be true for b43, in which case you wouldn't need ndiswrapper... but often the b43 driver doesn't work, so you do need ndiswrapper. If there is no other device using that module, then blacklisting it in /etc/modprobe.d/blacklist(.conf) could be tried: just add the module name, like ssb to the blacklist file with an editor. Note that blacklisting only takes effect after the command (as root)

    Code: Select all

    # update-initramfs -u
    If blacklisting is no option (only experience will tell) then putting ndiswrapper in /etc/modules may cause it to load earlier, but it may also be necessary to force that alternative driver (and drivers dependent on it) to load after the ndiswrapper driver. Using ssb as an example, make a little script /usr/local/bin/wireless

    Code: Select all

    #!/bin/sh
    rmmod ssb ndiswrapper
    modprobe ndiswrapper
    modprobe ssb
    and make this script executable (as root) with the command

    Code: Select all

    # chmod a+x /usr/local/bin/wireless
    then call for it to be executed in /etc/rc.local or (if that's too late in the boot sequence) in a file like /etc/init.d/bootmisc.sh. In both cases, just add a line like

    Code: Select all

    /usr/local/bin/wireless
    to that file. You may have to experiment a bit until it works; for an example see the 11 May 2008 post by hellfire[bg] in this thread.

    For those of you living on the bleeding edge of experimental kernels, have a look at this August 2012 post, http://forums.debian.net/viewtopic.php? ... 60#p449757, by mushroomboy for another way of getting rid of that pesky ssb module.
Finally, this all may not work whatever you try. In that case, assuming that you aren't mixing 32-bit and 64-bit stuff, you may just be out of luck. That could be the case with devices using the newer wireless 802.11n protocol, for which often only Windows drivers are available for Windows Vista or Windows 7 or 8. Ndiswrapper development doesn't seem very active anymore, so don't hold your breath while waiting for the developers to address the chipset in your particular wireless device. Yes, life is hard sometimes, consider getting a wireless bridge or game adapter instead -- I'm using one myself.

Have fun!

This HOWTO has benefited from numerous suggestions by Debian users, especially the comments by mzilikazi are appreciated. Thx :D
Last edited by hkoster1 on 2013-10-13 09:49, edited 55 times in total.

User avatar
the
Posts: 175
Joined: 2007-07-29 20:28

#2 Post by the »

Fixed
Last edited by the on 2007-08-03 23:00, edited 2 times in total.

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

#3 Post by hkoster1 »

the wrote:ndiswrapper -m doesn't give me ra0 or wlan0
It will if you carry out the recipe from start to finish and in the order given, as it clearly states. In your case, you've already been given the advice (by rickh) to install Debian Etch (or Lenny, Sid) afresh, since right now your system is probably all messed up by compiling with the wrong version of gcc, etc. My advice: learn to read carefully...

Edit: Another bit of advice: get yourself a cat-5 cable, then reinstall Etch and follow my Ndiswrapper recipe while hooked up to a friend's router/modem, or in an Internet shop, or wherever there's wired Internet access.

User avatar
penpen
Posts: 286
Joined: 2007-03-20 13:38

#4 Post by penpen »

If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

#5 Post by hkoster1 »

Ah yes, a problem of what comes first: the chicken or the egg... You need an installed system and all sorts of packages to compile ndiswrapper, but how do you get those packages if you can't download them via a network connection...

One way to do it is to order a set of CDs or DVDs with the required packages, perhaps even the full set -- look at the Debian.org homepage for vendors near you. Also check the package lists and the dependencies.

Or you could install a base system off CD-1, then get the additionally required packages to compile ndiswrapper via old-fashioned telephone modem -- buy or borrow a 56K modem for that (or get one for 10 bucks at a swap meet). Once you get wireless going you're home free installing desktop stuff, etc.

There may be live-CDs around that have the requisite packages, like Knoppix. You could even install Knoppix first, then dist-upgrade to Debian Sid afterwards.

Enough ideas for now, I guess. :wink:

User avatar
penpen
Posts: 286
Joined: 2007-03-20 13:38

#6 Post by penpen »

is there a way to find out which packages are on which cds? (i.e. being able to download/buy only a couple cds vs dvds or all cds)

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#7 Post by mzilikazi »

Thanks for taking the time to write this up. Might I make a suggestion though? It would be far easier to read and follow your howto if it's done using

Code: Select all

code tags
instead of bold
For example, if I were writing the following paragraph:
1. INSTALL the Ndiswrapper packages ndiswrapper-common, -source and -utils-1.x from the Debian repositories. It may be wise to install from the unstable (Sid) repository, since Ndiswrapper is still a moving target. Also install the module-assistant package (if you haven't already) and prepare it with the command m-a prepare (this and all following commands with root privileges).
I'd do it like this:

Code: Select all

su
apt-get update
apt-get install module-assistant ndiswrapper-utils ndiswrapper-common
m-a prepare
m-a a-i ndiswrapper
Now the reader is perfectly clear on what needs to be installed and how to do it. It's copy/paste easy.

Try to avoid statements like
It may be wise to install from the unstable (Sid) repository, since Ndiswrapper is still a moving target.
Who is this howto aimed at? Stable users or Sid users? A Debian Stable user has no need or intention of upgrading to Sid and suggesting they get some packages from unstable repos is not the best advice.

BTW - there is no need to specifically install a source package for module-assistant since invoking m-a gets the source for you. ;)
hkoster1 wrote: You could even install Knoppix first, then dist-upgrade to Debian Sid afterwards.
That's not a good idea at all. Knoppix was never meant to be installed to hdd and upgrading it does not automatically mean that you have a Sid installation. It means you have Knoppix w/ some packages from Sid. If you want Sid, install Debian Etch and upgrade.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#8 Post by mzilikazi »

penpen wrote:If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)
Possible but difficult. It might be possible to use a live cd that supports your wireless device (e.g. Sidux) and do a bootstrap of Debian from the live cd. With this installation method you have a GUI to work from and can build your modules with ease and resolve dependencies. We have just discussed this very thing right here.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
e1even1
Posts: 267
Joined: 2007-03-09 19:18

#9 Post by e1even1 »

penpen wrote:If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)
http://forums.debian.net/viewtopic.php?p=74182#74182

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

#10 Post by hkoster1 »

mzilikazi wrote:
hkoster1 wrote: You could even install Knoppix first, then dist-upgrade to Debian Sid afterwards.
That's not a good idea at all. Knoppix was never meant to be installed to hdd and upgrading it does not automatically mean that you have a Sid installation. It means you have Knoppix w/ some packages from Sid. If you want Sid, install Debian Etch and upgrade.
We're talking about a desperate situation here... no Ethernet and no recourse to a wired connection. Of course, installing Debian via Knoppix is not ideal, but it isn't a disaster either. I've done it myself in the past (just for kicks, when stable was still Sarge), and it worked OK when dist-upgrading to unstable. So, I'll stick to my suggestion if you don't mind. 8)

User avatar
penpen
Posts: 286
Joined: 2007-03-20 13:38

#11 Post by penpen »

e1even1 wrote:
penpen wrote:If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)
http://forums.debian.net/viewtopic.php?p=74182#74182
thanks a bunch :D

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#12 Post by mzilikazi »

hkoster1 wrote: We're talking about a desperate situation here... no Ethernet and no recourse to a wired connection. Of course, installing Debian via Knoppix is not ideal, but it isn't a disaster either. I've done it myself in the past (just for kicks, when stable was still Sarge), and it worked OK when dist-upgrading to unstable. So, I'll stick to my suggestion if you don't mind. 8)
Allow me to quote from the Knoppix Wiki
The main strength of Knoppix is its ability to be run from memory as a Live Linux CD. The advantage to this is that you can take the CD with you. However, some users have worked out how to install Knoppix on a hard drive. Hard drive install of Knoppix is not recommended for the new user and one should understand that there are problems associated with a hard drive install of Knoppix, particularly if you try to install more software or update your current software. Users are encouraged to look at a Debian ( www.debian.org ) install before trying to "install" Knoppix.
You seem to be missing a critical point here. You do not install Debian when you install Knoppix, you install a distro based on Debian but not Debian. A wiser choice would be to do a bootstrap from the Knoppix disc if that is what gets you wireless connectivity.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

#13 Post by hkoster1 »

mzilikazi wrote:You seem to be missing a critical point here. You do not install Debian when you install Knoppix, you install a distro based on Debian but not Debian.
Rule 1 from Debating 101: The other party must be missing a critical point.
Rule 2: Argue to something the other party didn't actually say.

Look, if someone is (perhaps) faced with not being able to install Debian at all, then doing it (or something similar) via an upgrade from Knoppix is an option that could be considered. At least, I have experience with that and it wasn't all bad, I can tell you.

I am grateful for your comments on my OP (and I have edited it as per your suggestions). And I have already agreed that the Knoppix way is not an ideal way to Debian. Cut a guy some room for an own opinion... readers can make up their own minds.

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#14 Post by mzilikazi »

hkoster1 wrote:Look, if someone is (perhaps) faced with not being able to install Debian at all, then doing it (or something similar) via an upgrade from Knoppix is an option that could be considered. At least, I have experience with that and it wasn't all bad, I can tell you.
I have done it too and it worked fine for me as well. Howto looks nice BTW.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

plugwash
Posts: 2507
Joined: 2006-09-17 01:10
Contact:

#15 Post by plugwash »

penpen wrote:If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)
possible but painfull, you will spend a lot of time hunting down dependencies.

if you have access to a debian system on a fast connection it should be possible to use debmirror to download a copy of contrib and non-free and burn it to DVD (note: such a DVD is almost certainly illegal to distribute). Using that as a local repositry combined with the first DVD for free stuff it should be fairly easy to set up wireless and the like.

User avatar
penpen
Posts: 286
Joined: 2007-03-20 13:38

#16 Post by penpen »

plugwash wrote:
penpen wrote:If you don't have an ethernet connection, just wireless (unlikely, but it could happen), could one just download all the .deb files for those packages, burn them to a disc, install them and still use module-assistant to compile the module? (I guess you'd have to download all the dependencies too)
possible but painfull, you will spend a lot of time hunting down dependencies.

if you have access to a debian system on a fast connection it should be possible to use debmirror to download a copy of contrib and non-free and burn it to DVD (note: such a DVD is almost certainly illegal to distribute). Using that as a local repositry combined with the first DVD for free stuff it should be fairly easy to set up wireless and the like.
actually, this is what i ended up doing on my last debian install (manually downloading the packages)..it was a pain, but once I had them all on my usb drive I was good to go. I have a decent connection, but I just wanted to download the packages I needed to get the base system to be able to connect to the internet so I would be able to upgrade things from there.

josh821
Posts: 3
Joined: 2008-01-03 16:40

Re: Ndiswrapper the easy Debian way...

#17 Post by josh821 »

I got up to here:

"4. Insert the module (still as root) with

Code: Select all

modprobe ndiswrapper
There should be no error messages from the modprobe command. If necessary, add ndiswrapper to /etc/modules for automatic insertion at boot. Next insert the wireless device, if you haven't already, and watch what happens with one or more of the commands"

At this point I got the message "FATAL: Module ndiswrapper not found."

I'm new to Linux but not to command prompts and whatnot. Still, I don't know what this command should be doing, what the error means, or if you're saying there is an ndiswrapper file (or directory) that I need to move to /etc/modules so that it loads when I boot up to fix this error. Any help is greatly appreciated.

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

Re: Ndiswrapper the easy Debian way...

#18 Post by hkoster1 »

josh821 wrote:...
At this point I got the message "FATAL: Module ndiswrapper not found."
....
The error message is self-explanatory: the ndiswrapper.ko module is not found in the /lib/modules/2.6.../... tree for your running kernel. This module should have been compiled and installed (again for the running kernel) at step 1 of the HOWTO, so you should investigate why this didn't happen. A recent kernel upgrade perhaps? In that case you should repeat step 1.
Real Debian users don't do chat...

josh821
Posts: 3
Joined: 2008-01-03 16:40

Re: Ndiswrapper the easy Debian way...

#19 Post by josh821 »

hkoster1 wrote:
josh821 wrote:...
At this point I got the message "FATAL: Module ndiswrapper not found."
....
The error message is self-explanatory: the ndiswrapper.ko module is not found in the /lib/modules/2.6.../... tree for your running kernel. This module should have been compiled and installed (again for the running kernel) at step 1 of the HOWTO, so you should investigate why this didn't happen. A recent kernel upgrade perhaps? In that case you should repeat step 1.
Ah, it appears i did miss the two m-a commands. I didn't get the same error when I went through it all again but the only one of the 4 commands at the end that seems to do anything is dmesg. I tried unplugging my ethernet cable, deactivating my ethernet connection under Networking and restarting my computer (there is an ndiswrapper folder under /etc so I'm assuming [hoping] that it loads when the computer boots) but I still get nothing out of the iwconfig, ifconfig, and iwlist scan commands.

Sorry if this is all common sense but like I said I'm net to Linux as in I've been playing around with it for all of three days.

hkoster1
Posts: 1264
Joined: 2006-12-18 10:10

#20 Post by hkoster1 »

The HOWTO should be followed "in order, without skipping a step"; those commands in Step 4 should be run with root privileges; the ndiswrapper module will load automatically when added to /etc/modules -- why am I repeating all of this? Learn to read carefully... :roll:
Real Debian users don't do chat...

Post Reply