Mailing List Archive

Lenovo T400 wifi scan and connect questions
1) the output of "dmesg | grep iwlwifi" is...

[ 0.640780] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[ 0.641112] Loading firmware: iwlwifi-5000-5.ucode
[ 0.641332] iwlwifi 0000:03:00.0: loaded firmware version 8.83.5.1 build 33692 5000-5.ucode op_mode iwldvm
[ 0.641360] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUG disabled
[ 0.641364] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUGFS disabled
[ 0.641367] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEVICE_TRACING disabled
[ 0.641370] iwlwifi 0000:03:00.0: Detected Intel(R) WiFi Link 5100 AGN, REV=0x54
[ 17.311014] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[ 17.424989] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0

Nice to see that it detects the 5100 AGN just like lspci. As the old
saying goes, "use it or lose it"; I used to be able to run wifi on this
machine manually (command line) in the past, but now I've completely
forgotten how. I've emerged "iw" and "wpa_supplicant". "iw dev" shows

phy#0
Interface wlan0
ifindex 3
wdev 0x1
addr 00:26:c6:4a:b4:92
type managed
txpower 15.00 dBm

Questions...
1) what do I do to scan and get a list of available networks?
2) how do I connect to one of the listed networks (assuming either
it's public, or I have the password) ?
3) minor detail... The Google hits I've found all show both DVM and
MVM support enabled. Given that dmesg output shows "op_mode iwldvm",
can I safely get rid of MVM support ?

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Lenovo T400 wifi scan and connect questions [ In reply to ]
On Monday, 29 August 2022 22:23:00 BST Walter Dnes wrote:
> 1) the output of "dmesg | grep iwlwifi" is...
>
> [ 0.640780] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have
> ASPM control [ 0.641112] Loading firmware: iwlwifi-5000-5.ucode
> [ 0.641332] iwlwifi 0000:03:00.0: loaded firmware version 8.83.5.1 build
> 33692 5000-5.ucode op_mode iwldvm [ 0.641360] iwlwifi 0000:03:00.0:
> CONFIG_IWLWIFI_DEBUG disabled [ 0.641364] iwlwifi 0000:03:00.0:
> CONFIG_IWLWIFI_DEBUGFS disabled [ 0.641367] iwlwifi 0000:03:00.0:
> CONFIG_IWLWIFI_DEVICE_TRACING disabled [ 0.641370] iwlwifi 0000:03:00.0:
> Detected Intel(R) WiFi Link 5100 AGN, REV=0x54 [ 17.311014] iwlwifi
> 0000:03:00.0: Radio type=0x1-0x2-0x0
> [ 17.424989] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
>
> Nice to see that it detects the 5100 AGN just like lspci. As the old
> saying goes, "use it or lose it"; I used to be able to run wifi on this
> machine manually (command line) in the past, but now I've completely
> forgotten how. I've emerged "iw" and "wpa_supplicant". "iw dev" shows
>
> phy#0
> Interface wlan0
> ifindex 3
> wdev 0x1
> addr 00:26:c6:4a:b4:92
> type managed
> txpower 15.00 dBm
>
> Questions...
> 1) what do I do to scan and get a list of available networks?

If you have emerged wpa_supplicant with USE="qt5" you will have a GUI to
launch its client and click on Scan to find and select a desired AP.

If not, you can run wpa_cli in a terminal. Something like 'wpa_cli scan' and
'wpa_cli scan_results' should show you what's available. If you run just
'wpa_cli' it will launch an interactive shell from which you can run:

> scan
> scan_results

'wpa_cli --help' for more subcommands and options.


> 2) how do I connect to one of the listed networks (assuming either
> it's public, or I have the password) ?

With wpa_supplicant's GUI, or with wpa_cli, but the latter is more tedious.

Run wpa_cli to get an interactive shell. Then,

> scan
> scan_results

> add_network
0 (if there is no other network yet configured)
> set_network 0 ssid "My_blah_AP" <== From the results
> set_network 0 psk "My_secret_passphrase"
> enable_network 0
0K

If you managed to authenticate and get an IP address you may want to save your
settings - assuming you have enabled 'update_config=1' in your
wpa_supplicant.conf:

> save config
OK

For permanent associations you can add BSSID and authentication credentials
into /etc/wpa_supplicant/wpa_supplicant.conf. Have a look at '/usr/share/doc/
wpa_supplicant-*/wpa_supplicant.conf.bz2' for examples.


> 3) minor detail... The Google hits I've found all show both DVM and
> MVM support enabled. Given that dmesg output shows "op_mode iwldvm",
> can I safely get rid of MVM support ?

I don't know what works with your wireless adaptor, but I tend to experiment
initially by building such options as modules and see what is loaded or not
and any warnings in dmesg.
Re: Lenovo T400 wifi scan and connect questions [ In reply to ]
I'm having problems, even running as root. As per the previous
message, the system is detecting the hardware, but wpa_aupplicant cannot
get going. I have a minimal /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
update_config=1

From https://wiki.gentoo.org/wiki/Wpa_supplicant#Using_wpa_cli the
command for debugging is...

wpa_supplicant -Dnl80211 -iwlan0 -C/var/run/wpa_supplicant/ -c/etc/wpa_supplicant/wpa_supplicant.conf -dd

...to which I appended ">>logfile.txt 2>&1" to grab all output. I
waited for a minute or so, and got the logfile which I've attached. Any
ideas?

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Lenovo T400 wifi scan and connect questions [ In reply to ]
On Tuesday, 30 August 2022 23:26:00 BST Walter Dnes wrote:
> I'm having problems, even running as root. As per the previous
> message, the system is detecting the hardware, but wpa_aupplicant cannot
> get going. I have a minimal /etc/wpa_supplicant/wpa_supplicant.conf
>
> ctrl_interface=/var/run/wpa_supplicant
> update_config=1

If you have enabled the wheel group and your user is a member of this group,
then you won't need to run things as root:

DIR=/var/run/wpa_supplicant GROUP=wheel
DIR=/var/run/wpa_supplicant GROUP=0
# (group can be either group name or gid)

Alternatively, you can add your users gid instead.


> From https://wiki.gentoo.org/wiki/Wpa_supplicant#Using_wpa_cli the
> command for debugging is...
>
> wpa_supplicant -Dnl80211 -iwlan0 -C/var/run/wpa_supplicant/
> -c/etc/wpa_supplicant/wpa_supplicant.conf -dd
>
> ...to which I appended ">>logfile.txt 2>&1" to grab all output. I
> waited for a minute or so, and got the logfile which I've attached. Any
> ideas?

To state the obvious, this shows your key is not accepted:

nl80211: set_key failed; err=-22 Invalid argument

Also I can see:

key_len=0

Does this message mean you are using no passwd authentication? If so you have
to state explicitly:

set_network 0 key_mgmt NONE

in wpa_cli when you try to authenticate with your AP, or in /etc/
wpa_supplicant/wpa_supplicant.conf add a fall back configuration at the end of
the file for all open APs:

network={
key_mgmt=NONE
}

You can add BSSID, SSID to the above if you only want to use no authentication
with a specific AP rather than anything which might be within range.

BTW, key and passphrase are not the same thing. A passphrase must be entered
in quotations, or use wpa_passphrase to generate the preshared key from it:

~ $ wpa_passphrase MY_SSID "My secret passphrase"
network={
ssid="MY_SSID"
#psk="My secret passphrase"
psk=f90ff73cefa452385366f5278f64914fa832b61a5225d3c78dcd4291061b56a1
}
Re: Lenovo T400 wifi scan and connect questions [ In reply to ]
During launch, wpa_supplicant blows up on...

DIR=/var/run/wpa_supplicant GROUP=wheel
DIR=/var/run/wpa_supplicant GROUP=0

https://wiki.gentoo.org/wiki/Wpa_supplicant#Configuration recommends...

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

The 3 lines in my wpa_supplicant.conf that are not commented out are...

ctrl_interface_group=0
ap_scan=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

Thank you for your help. It works. I live in a condo building. As
a regular user "wpa_cli scan" followed by "wpa_cli scan_result" shows
approximately a couple of dozen machines. BTW I've disabled MVM and
wifi still works.

One last question; I occasionally see signs in various places saying

Our network name is "foo" and password is "bar".

My reading of the wpa_cli man page indicates I should use...

wpa_cli password foo bar

...to log on. Is that correct?

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Lenovo T400 wifi scan and connect questions [ In reply to ]
On Wednesday, 31 August 2022 20:15:41 BST Walter Dnes wrote:
> During launch, wpa_supplicant blows up on...
>
> DIR=/var/run/wpa_supplicant GROUP=wheel
> DIR=/var/run/wpa_supplicant GROUP=0

Hmm ... so the example page syntax is wrong. I wonder if I came across this
too in the distant past. :-/

I have this in my config and it works:

ctrl_interface_group=wheel
ctrl_interface=/var/run/wpa_supplicant


> https://wiki.gentoo.org/wiki/Wpa_supplicant#Configuration recommends...
>
> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
>
> The 3 lines in my wpa_supplicant.conf that are not commented out are...
>
> ctrl_interface_group=0
> ap_scan=1
> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
>
> Thank you for your help. It works.

Cool. :-)


> I live in a condo building. As
> a regular user "wpa_cli scan" followed by "wpa_cli scan_result" shows
> approximately a couple of dozen machines. BTW I've disabled MVM and
> wifi still works.
>
> One last question; I occasionally see signs in various places saying
>
> Our network name is "foo" and password is "bar".
>
> My reading of the wpa_cli man page indicates I should use...
>
> wpa_cli password foo bar
>
> ...to log on. Is that correct?

The wpa_cli command syntax is:

password <network id> <password>
configure password for an SSID

However, I'm not sure <network id> == SSID. When you add a network in
interactive mode with:

add_network

the shell outputs a network id number; e.g. 3, which you are meant to use
thereafter to set up variables for the AP; e.g.:

set_network 3 ssid "starvebux"
set_network 3 psk "Not Free"
enable_network 3

In addition, I understand the wpa_cli command 'password', as opposed to
variable 'psk' which is used in the interactive shell, to be for a EAP-PEAP
authentication scheme. For a pre-shared key you'll use interactively:

set_network 3 psk 0f0fbfdadff6271a5107a49cfb5db9e921138ee74a66b0.....

or if it is a passphrase you'll enclose it in double quotes "Not Free" as
above.

This is the reason I use the wpa_supplicant GUI when not restricted to working
in a console, because the qt5 wpa_supplicant GUI makes it easier to click and
fill in a PSK, compared to the multiple commands required in a terminal.