LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Loading ndiswrapper at boot (https://www.linuxquestions.org/questions/linux-wireless-networking-41/loading-ndiswrapper-at-boot-534644/)

saturndude 03-05-2007 12:20 AM

Atheros chip with ndiswrapper, Mandriva 2006
 
I'm confused, perhaps from trying to do too much all at the same time. I'm trying to get a D-link DWL-G520 (rev. B3) to work with D-link DI-524 router (firmware E or E1 IIRC).

I'm following Sourceforge's ndiswrapper install instructions.

Ndiswrapper has installed the Windows driver in the /etc/ndiswrapper/drivername directory. The ndiswrapper module loads at boot.

When I type:

"iwlist wlan0 scan"

The machine says the wlan0 interface doesn't support scanning. Why is this?

But when I type "iwlist scan | less" I do get a listing.
What is this listing? I think it is a list of APs whether I am connected to them or not. Is this true? What does the output mean? I need to know to correct whatever problems I have.

Thanks in advance for all your time and attention.

jschiwal 03-05-2007 04:55 PM

Look at the output of "lsmod" and make sure "ndiswrapper" is listed. I'm betting that it is. Make sure you ran "ndiswrapper -m" to write your modprobe.conf alias.
( It may create a /etc/modprobe.d/ndiswrapper file instead for more recent versions. )

iwlist scan will try to scan on all devices. Which device did it say performed the scan?

saturndude 03-05-2007 08:21 PM

More information
 
Thanks for responding!

Someone in another thread (Mandriva 2006, or other "close" Mandriva version) suggested (to somebody) to put stuff in /etc/modules.preload, so that is what I did, and it works. I don't have any /etc/modprobe.d directory.

Yes, I did the "ndiswrapper -m".

I'm not sure about using iwlist. It seems like a way to list a config, but iwconfig (by itself) can do that too, correct? I'll have to study the commands more.


Here is the output of iwconfig:

lo
no wireless extensions
ath0
IEEE 802.11b ESSID:"Mikes-Network" Nickname:"localhost"
Mode:Managed Frequency:2.437 GHz Access Point: 00:00:00:00:00:00
Bit Rate=108 Mb/s
Encryption key: [snip]
Security mode:open
Power Management:off
Link Quality:46/100 Signal level:-57 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
eth0
no wireless extensions

The stuff that follows "lo", "ath0" and "eth0" is supposed to be on the same line, but I couldn't get the formatting correct.


When I type "iwconfig ath0 ap router-mac-address" (entered as 00:13:46: and so forth) to force an association with the router, then type "iwconfig ath0" to list the new configuration, all zeros are listed (just as before). More evidence that it's not working.

I removed the encryption today to make it easier. I'll turn it back on (for security) after it is working.


Here is all of modprobe.conf:
alias eth0 via-rhine
alias sound-slot-0 snd-via82xx
install scsi_hostadapter /sbin/modprobe sata_via; /bin/true
remove snd-via82xx /sbin/modprobe -r snd-pcm-oss; /sbin/modprobe --first-time -r --ignore-remove snd-via82xx
install snd-via82xx /sbin/modprobe --first-time --ignore-install snd-via82xx && { /sbin/modprobe snd-pcm-oss; /bin/true; }
install usb-interface /sbin/modprobe uhci-hcd; /sbin/modprobe ehci-hcd; /bin/true
alias ath0 ath_pci
alias wlan0 ndiswrapper

I did NOT INSTALL the card until after the Mandriva system was installed. IIRC, Mandriva inserted the "alias ath0 ath_pci" line, probably the first time I booted after inserting the PCI card.

Also, when I shut down, I see some errors (some surrounding lines also shown):
Stopping portmap services:
Shutting down interface eth0:
Shutting down interface ath0: ndiswrapper (NdisAllocateMemory:239): Windows driver allocating too big a block at DISPATCH_LEVEL: 156816
Shutting down loopback interface:
Stopping wlandetect:
Any thoughts? I noticed madwifi kernels on the Mandriva 2006 DVD. I'm a home user, behind a router, with no special security needs. Also, I haven't built a kernel in years (it's a big process). Would a madwifi solution be a reasonably easy way to use the D-link? Another idea is to stick with ndiswrapper, but use the D-link in Windows and a CompUSA PCI wireless card for Mandriva (Realtek 8185, I've tried it before, it might work)?

I'd like to see if I can get the D-link to work first however.

Please let me know any thoughts you have.

Thanks in advance,

saturndude 03-05-2007 09:54 PM

More results
 
When I type "iwlist ath0 scan" I get the following:

ath0 Scan completed :
Cell 01 - Address: 00:13:46:[snip the rest]
ESSID:"Mikes-Network"
Protocol:IEEE 802.11g
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality:0/100 Signal level:-51 dBm Noise level:-256 dBm
Encryption key:off
Bit Rate:1 Mb/s
Bit Rate:2 Mb/s
Bit Rate:5.5 Mb/s
Bit Rate:6 Mb/s
Bit Rate:9 Mb/s
Bit Rate:11 Mb/s
Bit Rate:12 Mb/s
Bit Rate:18 Mb/s
Bit Rate:24 Mb/s
Bit Rate:36 Mb/s
Bit Rate:48 Mb/s
Bit Rate:54 Mb/s
Extra:bcn_int=100
Extra:atim=0
(Unknown Wireless Token 0x8C05)


My router's MAC address is listed. Does the PC listen and pick up my router's MAC address, or is this because I typed it in in a previous post ("iwconfig ath0 ap router-mac-address")?

In an earlier post, I mentioned that I disabled encryption (for now). When I type "iwconfig | less", the key is still listed. How do I remove it?

I really do appreciate your help.

2Gnu 03-05-2007 10:28 PM

iwconfig ath0 key off

jschiwal 03-06-2007 06:28 PM

It looks like you have two drivers for your wireless. Look at the "lsmod" listing. Is one of them ath_pci?

You might try shutting down wlan0, removing the ndiswrapper module, and commenting out the /etc/modprobe.conf entry with ndiswrapper.

See if you can configure wireless with the atheros driver (ath0). Also do a google search. I'm not familiar with this driver. Some don't have full interfaces for wireless tools and you need to use something else. But since iwlist worked with it, it may be OK, and you simply need to configure wpa or wep encryption to match the router, so that the router gives you an IP address via DHCP.

( However, I don't like the look of "unknown token". It does say that your router is in managed mode. That means either wep or wpa. )

saturndude 03-06-2007 08:48 PM

Managed mode?
 
Thanks!

You say I should try the ath0 driver? Well, a year ago I had linux working wirelessly (same equipment, same computer) with the ndiswrapper (and a windows driver) on an old 20 Gig hard drive. The connection dropped randomly, so I went back to wired but kept the setup. I flashed the router's firmware a week ago. I am using the old drive right now to type this, and with the new router firmware, the connection is ROCK SOLID. I am trying to look at this configuration, and seeing how it differs from my current drive (160 GB) drive, in hopes that I can make the 160 GB work.

First of all, I see that the "ifup" and "ifdown" files in /etc/sysconfig/network-scripts have old dates (2002 to 2005, before I bought Mandriva 06). Those old files work "out of the box" on my 20 GB drive, so I'm smart enough to leave them alone.


Earlier, when I inserted inserted the PCI card and booted (with the "bad" 160 GB), the module ath_pci was loaded. You are entirely correct, this is a problem. After I removed the card and rebooted a couple of times, I reinserted the card. It is not listed in lsmod anymore. I can always put ndiswrapper in /etc/modules.preload and BLACKLIST the ath_pci module.


My old 20 GB drive (the one that works) has a text file here:

/etc/sysconfig/network-scripts/wireless.d/Mikes-Network

and one line of that config file is "WIRELESS_MODE=Managed".

So I think managed mode can work. There are other files in the wireless.d directory (from other attempts at wireless), but "Mikes-Network" is the ESSID of the router. Also, the file "Mikes-Network" has a date stamp of today, about one hour ago, when I booted with the 20 GB to start writing this.


My "new" 160 GB drive (wireless doesn't work) has an interesting problem, and I think it goes to the heart of the matter. When I type 'iwconfig' by itself, all of the information is listed beside "ath0" and not "wlan0". The ESSID is listed correctly. The channel used by the card is incorrect and cannot be changed by typing "iwconfig ath0 Channel 6" at the command line. The MAC address is all zeros, so it doesn't see the router (of course it doesn't, the card is on the wrong channel!). If you use "iwconfig ap 00:13:46 etc.", then type "iwconfig" by itself, the MAC address is not changed.

If I can make the computer associate all the wireless info with the "wlan0" interface instead of "ath0", any config script that expects hardware to appear at wlan0 will automatically be fixed. Any idea how to change this?

Also, when I go into Mandriva Control Center and input "2.437 GHz" as the frequency to use, this is not reflected in /etc/sysconfig/network-scripts/wireless.d/Mikes-Network.

So clearly something is not right here.

I see "alias wlan0 ndiswrapper" as the last line of the file /etc/modprobe.conf on the 20 GB drive, so I made sure that was the last line of the file on the 160 GB as well.

How do I make the machine see "wlan0" instead of "ath0"?

Thanks in advance for all your help,

jschiwal 03-07-2007 02:45 AM

I think you are close but you have dueling drivers.

Look at the output of "sudo /sbin/lspci -v" and do some searching on Google based on the device listed. Double check on what drivers can be used. If you used ndiswrapper before and it worked, you could blacklist the other one. You don't want both drivers (kernel modules) however.

I suggested using the other because it is the one that seems to be working.
It would be easy to comment out the ndiswrapper lines from /etc/modprobe.conf. (and the preload list) For insurance, backup the modprobe.conf file. Also check in /etc/modprobe.d/ndiswrapper if it exists as well as /etc/modprob.conf.local if it exists as well. ( Maybe not, but I am trying to cover the bases )
You can also add the line "blacklist ndiswrapper". If it doesn't work you can restore your old files from backup. Then blacklist the atheros driver if you want to use ndiswrapper and comment out the line that looks like
install ath0 /bin/true
if it exists.

===

Did you perform a fresh install in the process of adding a new drive. If it is the same version of Mandriva, you could use the old one as a model. If it is a new version of Mandriva, or a different kernel, it may have added native support for the device. Examine both modprobe.conf files and compare the differences.


===

Are you certain which drive you are using as the root device. Is it possible that you are still booting to the old partition.

===
Another thought is that with changing modprobe.conf, this is one case where you may want to reboot after making changes. Trying to remove a live module (i.e. ndiswrapper if wlan0 is up) can lock up your machine. Also, you will be verifying which modules will load when you reboot.

saturndude 03-07-2007 08:04 PM

Did that. Eventually got it fixed.
 
Using the old drive as a model for the new one is exactly what I was doing. Sorry I couldn't make it work.

I ended up reinstalling. I saved a master list of RPMs on a floppy, so you can "replay" the installation. Mandriva could not read my floppy, but I did not learn this until after I 'blew away' the old install. I had a floppy of the install from my old 20 Gig drive, so I used that "replay disk" and tweaked it to my taste (added a few packages, deleted a few).

I made SEVERAL "replay install" disks this time, believe me! I'll troubleshoot my floppy drive unit in a day or two.

Now that I have my "replay disks" matched to the retail DVD, I am free to get security updates, the latest OpenOffice, stuff that wasn't on the 2006 Retail DVD. (and reset the KDE "look and feel" items, and other things.)

I used Partition Magic 8.01 to back up my /home directory before reinstalling (always on a separate partition, so PM can preserve it, in case of exactly this type of emergency). There will be a few issues as I copy things back (pointing Thunderbird to my pre-existing mail messages and so forth), but all should go well.

The wireless works just splendidly. When using iwconfig, all the "stuff" is listed for wlan0. The old 160 GB listed wireless info for ath0. Wlan0 wasn't even detected by iwconfig, and it wasn't mentioned in the startup items that scroll up the screen. Now, everything is like the old 20 GB. Perfect!

Sorry it had to come to a reinstall. I can't know the inner workings of everything. And I guess the install routines can still do things I cannot. Part of being "nimble" and versatile is being able to recover from a disaster quickly (while losing essentially nothing).

It turns out that I MIGHT have been able to boot from the retail DVD and repair things, but I didn't do too badly.

Thanks for trying.

saturndude 03-08-2007 08:52 PM

Here's your answer
 
In Mandriva 2006 (possibly others), the file /etc/iftab lists the interfaces (eth0, wlan0, ath0) and the MAC address that each is associated with.

I found this out too late, but I put the information here for others. Now you know.

Thanks for helping out.


All times are GMT -5. The time now is 10:09 AM.