2007-06-23 trying to get wlan working under Kubuntu 7.04

Intro
I've patchily updated these notes from things I learned on 2007-06-28 from reading the Ubuntu wifi troubleshooting wiki page (WifiDocs: WiFiTroubleshooting), which was suggested by the research bot (ubotu) on #kubuntu (@freenode) when someone helpfully typed "!wifi".
 * Main reference: wireless network cards in Linux
 * Notes originally taken by Woozle.

What Has to Happen for wifi to work
root@scooter:~# dhclient There is already a pid file /var/run/dhclient.pid with pid 5362 killed old client process, removed PID file Internet Systems Consortium DHCP Client V3.0.4 Copyright 2004-2006 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ Listening on LPF/eth0/00:18:39:bd:52:38 Sending on  LPF/eth0/00:18:39:bd:52:38 Sending on  Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 DHCPOFFER from 192.168.0.254 DHCPREQUEST on eth0 to 255.255.255.255 port 67 DHCPACK from 192.168.0.254 bound to 192.168.0.117 -- renewal in 17464 seconds.
 * Wifi card must be initialized (how is this done?)
 * You can find out if it has been initialized properly by removing and reinserting the card, then checking the results of this command:
 * tail -f /var/log/messages
 * Good result: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
 * Ungood result: ADDRCONF(NETDEV_UP): eth0: link is not ready
 * If you get the ungood result, next check this file:
 * /etc/network/interfaces
 * Look for any hard-configured ESSID names; removing them made the card initialize properly for me.
 * Wifi card must be set to proper SSID
 * iwconfig dev essid accesspt
 * ...where dev is the wlan device name (e.g. wlan0) and accesspt is the access point's ESSID (name)
 * e.g. iwconfig wlan0 essid NETGEAR
 * Wifi card must have an IP address set; I always use DHCP even though Tenebram says DHCP is stupid and unreliable:
 * dhclient dev

Unanswered Questions
How can you tell from the command line whether or not the wireless is working, and if not why not? (Does iwconfig give enough info?) (This isn't a very clear question and I should probably rephrase it...)

Why does "iwconfig wlan essid NETGEAR" fail, and then cause input devices (kbd/mouse) to be all laggy (until you pull out the wireless card)? Probably because "wlan" isn't a device.

Why are there now two wireless devices (wifi0, wlan1)? Why is this different for different wireless cards? What do the names signify?

Why do both of the interfaces always show "test" as the SSID when the card has just been plugged in? (Did I set this somewhere?) (Possible answer: this may have gotten set in the /etc/network/interfaces file; check that if this happens again.)

What is the "wlan1:ava" device which sometimes appears in ifconfig?

"ifup eth0" says "interface eth0 already configured", but dhclient eth0 gets no returns (although KWirelessThingy on Ubuntu 6.10 is able to connect) -- what does it mean when this happens?

"iwlist eth0 scanning" reports lots of cells with good signals; what is necessary and sufficient for connecting to one of them? (Possible lead on this: try iwconfig dev ap MAC ID )

How can iwconfig report a good signal and yet dhclient can't fetch an IP address? (Is the card being initialized successfully?)

How can the following results from dhclient result in a working connection?? (They did.) Listening on LPF/eth0/00:18:39:bd:52:38 Sending on  LPF/eth0/00:18:39:bd:52:38 Sending on  Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10 No DHCPOFFERS received. No working leases in persistent database - sleeping.

Are the various wireless/network utilities just wrappers on various CLI commands, or do they call libraries directly? What CLI commands or what libraries?

Are there any other relevant commands?
 * iwlist
 * iwconfig
 * ifconfig
 * ifup/ifdown
 * non-wlan-specific:
 * tail -f /var/log/messages
 * /etc/network/interfaces

What does it take to "turn on" a wireless card so that at least it thinks it is connected (lights flashing in a connected-looking way)?

Different Cards

 * OLD Linksys: wifi0, wlan1
 * scanning not supported
 * dhclient only works on wlan1
 * dhclient wifi0 says "unknown hardware address type 801", even though:
 * it does try DHCPDISCOVER
 * "dhclient wlan1" returns this error message too, even though it does succeed in fetching an IP address
 * NEW Linksys: eth0
 * returns list of several cells
 * TRENDnet: wmaster0, wlan0
 * wmaster0 doesn't support scanning
 * wlan0 does return one cell (sometimes more)

2007-06-28 working
What finally worked for the "new Linksys" card was to remove all the fixed ESSIDs from /etc/network/interfaces, reinsert the card, and then run dhclient. The card also started working properly at boot time after this, which it wasn't doing before. Have not been able to get others to dependably start working on command.