Mailing List Archive

using Wifi in a new machine
Thanks again for the advice recently + earlier re my new machine (ANB6).

I've got the hardware working properly with Mageia (installed on HDD).
I've partitioned the drives ( NVMe M2 SSD + HDD ).
I've copied Stage 3 to the appropriate partition on the SSD.
I'm following the notes I made when I built the present machine (ANB5) 2015.

I'm going to have to have the I/net connected as I install stuff.
For that I have a choice of landline via 'dhcpcd' or Wifi,
which is available via System Rescue (10.00) & which is faster here.

Can anyone explain how I can get Wifi working at this early point
in the installation process ?
-- it's present on the Mobo, which is a Gigabyte X570S AERO G .

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On Wed, 10 May 2023 21:42:16 -0400, Philip Webb wrote:

> Can anyone explain how I can get Wifi working at this early point
> in the installation process ?

There's an example of using WPA from the command line at

https://nixos.org/manual/nixos/stable/#sec-installation-manual-networking

--
Neil Bothwick

I'm not anti-social, I'm just not user friendly
Re: using Wifi in a new machine [ In reply to ]
On Thursday, 11 May 2023 08:22:58 BST Neil Bothwick wrote:
> On Wed, 10 May 2023 21:42:16 -0400, Philip Webb wrote:
> > Can anyone explain how I can get Wifi working at this early point
> > in the installation process ?
>
> There's an example of using WPA from the command line at
>
> https://nixos.org/manual/nixos/stable/#sec-installation-manual-networking

It used to be a simple matter of configuring the authentication credentials
with the AP in /etc/wpa_supplicant/wpa_supplicant.conf and running 'dhcpcd
wlan0' to obtain an IP address from the router, but things have gotten more
complicated over the years.

Today you need to follow these stages:

1. Check if the appropriate firmware is available, otherwise fetch it from
here and untar it in /lib/firmware:

https://www.intel.co.uk/content/www/uk/en/support/articles/000005511/
wireless.html

I think you'll need "iwlwifi-cc-46.3cfab8da.0.tgz"?

2. Load the appropriate kernel module for your hardware.

3. Configure /etc/conf.d/net with some appropriate settings; e.g.

modules="wpa_supplicant"
wpa_supplicant_wlan0="-Dnl80211"
mac_wlan0="A1:B2:C3:D4:E5:F6"
config_wlan0="dhcp"

Substitute wlan0 with whatever your wireless NIC is identified as in 'ip link
show'.

4. Configure /etc/wpa_supplicant/wpa_supplicant.conf with suitable
authentication credentials for your AP:

network={
ssid="My_AP"
bssid=AA:BB:CC:DD:EE:FF
proto=RSN
key_mgmt=WPA-PSK (for WPA3, try key_mgmt=WPA-PSK-SHA256)
pairwise=CCMP
auth_alg=OPEN
group=CCMP
psk="Very_Secret_Shared_Key"
ieee80211w=2 (1 is for PMF 'enabled', or 2 for 'required')
priority=5
}

5. Then start the wpa_supplicant service:

rc-service -v wpa_supplicant start


This way you won't have reassociate manually with wpa_cli each time and as
long as you add your wpa_supplicant service to default runlevel it will come
up when you boot into your system.
Re: using Wifi in a new machine [ In reply to ]
Thanks for both replies. 5 min after I sent my request last night,
I realised that I sb able to access Wifi thro'out installation
simply via the System Rescue connection, which finds the service easily
& needs only the password to finish the job. I do have a landline via DHCP,
but Wifi here is 6 times faster & there sb a lot of downloading to do.

I will add the details to my info files.

There is another related question : is there a way
to make both connections simultaneously & switch between them ?

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On Thursday, 11 May 2023 15:01:51 BST Philip Webb wrote:
> Thanks for both replies. 5 min after I sent my request last night,
> I realised that I sb able to access Wifi thro'out installation
> simply via the System Rescue connection, which finds the service easily
> & needs only the password to finish the job. I do have a landline via DHCP,
> but Wifi here is 6 times faster & there sb a lot of downloading to do.
>
> I will add the details to my info files.
>
> There is another related question : is there a way
> to make both connections simultaneously & switch between them ?

If you configure them both in /etc/conf.d/net with different priorities, both
will come up and obtain routes and IP addresses. Use a different metric for
each to specify which NIC will take priority in your network stack, e.g.:

metric_enp2s0=20
metric_wlp4s0=30

In the above example the wireless is acting as a fallback when the wired
enp2s0 fails. Using arpwatch or ip-monitor can automate the fallback by
monitoring a particular IP address/route, but to manually switch between them
I think you'll have to shut down the one you don't want.

Using iproute's 'metric' option to change priorities will also work. However,
I think established connections will continue to use the previous NIC and
route.

There may be more sophisticated ways to achieve what you want, other
contributors may have better ideas.
Re: using Wifi in a new machine [ In reply to ]
230511 Michael wrote:
> On Thursday, 11 May 2023 15:01:51 BST Philip Webb wrote:
>> There is another related question : is there a way
>> to make both connections simultaneously & switch between them ?
> If you configure them both in /etc/conf.d/net with different priorities, both
> will come up and obtain routes and IP addresses. Use a different metric for
> each to specify which NIC will take priority in your network stack, e.g.:
>
> metric_enp2s0=20
> metric_wlp4s0=30
>
> In the above example the wireless is acting as a fallback when the wired
> enp2s0 fails. Using arpwatch or ip-monitor can automate the fallback by
> monitoring a particular IP address/route, but to manually switch between them
> I think you'll have to shut down the one you don't want.
>
> Using iproute's 'metric' option to change priorities will also work. However,
> I think established connections will continue to use the previous NIC and
> route.
>
> There may be more sophisticated ways to achieve what you want, other
> contributors may have better ideas.

Thanks : I'll save this among my notes.

Any further advice in this area is very welcome.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
230511 Michael wrote:
> On Wed, 10 May 2023 21:42:16 -0400, Philip Webb wrote:
>> Can anyone explain how I can get Wifi working
>> at this early point in the installation process ?
> 1. Check if the appropriate firmware is available,
> otherwise fetch it from here and untar it in /lib/firmware:
> https://www.intel.co.uk/content/www/uk/en/support/articles/000005511/wireless.html
> I think you'll need "iwlwifi-cc-46.3cfab8da.0.tgz" ?

My Mobo manual (Gigabyte X570S Aero G) says :
"Wireless Module : Intel Wifi 6 AX200 ; AMD Wifi 6E RZ608 (MT7921K)".
The Intel firmware site says the firmware you name above is correct for it.
(I don't understand why they give separate specs for Intel/AMD :
my CPU is AMD)

> 2. Load the appropriate kernel module for your hardware.

I've compiled several modules for the kernel : which do you mean ?

> 3. Configure /etc/conf.d/net with some appropriate settings; e.g.
> modules="wpa_supplicant"
> wpa_supplicant_wlan0="-Dnl80211"
> mac_wlan0="A1:B2:C3:D4:E5:F6"
> config_wlan0="dhcp"

'net' didn't exist in /etc/conf.d , so i created it with your content.

> Substitute wlan0 with whatever your wireless NIC is identified as
> in 'ip link show'.

'ip a' + 'ip link show' both list 3 interfaces :
(1) lo ; (2) enp6so (my landline) ; (3) sit0@NONE <noarp> mtu1480 ... .

With SR + Mint, the interface is shown as 'wlp5s0' (see below),
which I've written in 'net' in place of 'wlan0' (3 times),
eg 'config_wlp5s0="dhcp"'.

(The landline interface works correctly)

> 4. Configure /etc/wpa_supplicant/wpa_supplicant.conf
> with suitable authentication credentials for your AP :
>
> network={
> ssid="My_AP"
> bssid=AA:BB:CC:DD:EE:FF
> proto=RSN
> key_mgmt=WPA-PSK (for WPA3, try key_mgmt=WPA-PSK-SHA256)
> pairwise=CCMP
> auth_alg=OPEN
> group=CCMP
> psk="Very_Secret_Shared_Key"
> ieee80211w=2 (1 is for PMF 'enabled', or 2 for 'required')
> priority=5
> }

I've done that.

> 5. Then start the wpa_supplicant service :
> 'rc-service -v wpa_supplicant start'.

I've added it to start-up services with 'rc-update add wpa_supplicant',
then rebooted & it shows up as "started". 'dhcpcd' also starts at boot.

When I boot, the messages say 2 relevant things :

"Caching service dependencies ...
Successfully initialised wpa_supplicant ... "

"INIT : Entering Runlevel 3
could not find wireless interface
ERROR : wpa_supplicant failed to start
Starting DHCP client Daemon ... [ok] "

The problem isn't in the new machine's hardware :
System Rescue + Mint both offer to start Wifi & succeed ;
'ip a' for both shows an extra line for "wlp5s0",
which appears to be the wireless interface the new Gentoo can't find ;
it shows 'no carrier' before they start Wifi, which disappears afterwards.

I've looked at their /lib/modules/ /lib/firmware/ /etc dirs,
but don't see anything to help (both use Systemd ; I use Openrc).

So for some reason my embryonic Gentoo system can't find the interface,
a very basic problem.

Tnanks to Michael, whose advice helped upto a point.
Can anyone suggest how I can get Gentoo to find the wireless interface ?

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On Tuesday, 30 May 2023 11:21:21 BST Philip Webb wrote:
> 230511 Michael wrote:
> > On Wed, 10 May 2023 21:42:16 -0400, Philip Webb wrote:
> >> Can anyone explain how I can get Wifi working
> >> at this early point in the installation process ?
> >
> > 1. Check if the appropriate firmware is available,
> > otherwise fetch it from here and untar it in /lib/firmware:
> > https://www.intel.co.uk/content/www/uk/en/support/articles/000005511/wirel
> > ess.html I think you'll need "iwlwifi-cc-46.3cfab8da.0.tgz" ?
>
> My Mobo manual (Gigabyte X570S Aero G) says :
> "Wireless Module : Intel Wifi 6 AX200 ; AMD Wifi 6E RZ608 (MT7921K)".
> The Intel firmware site says the firmware you name above is correct for it.
> (I don't understand why they give separate specs for Intel/AMD :
> my CPU is AMD)

These two separate specs correspond to two different versions of the Gigabyte
X570S Aero G MoBo. You need to confirm which card your MoBo came with.
Easiest would be to check the output of dmesg and 'lshw -short -class network'
after you boot with Mint.

If you run 'lshw -class network', you will additionally see what driver is
loaded my Mint and what firmware files are needed.


> > 2. Load the appropriate kernel module for your hardware.
>
> I've compiled several modules for the kernel : which do you mean ?

The driver corresponding to your hardware. The MoBo manual is listing two
different wireless NICs depending on the version of your MoBo:

https://www.gigabyte.com/Motherboard/X570S-AERO-G-rev-1x/sp#sp

If your wireless card is Intel, the kernel driver is iwlwifi.

If your wireless card is MediaTek's MT7921K (rebranded by AMD) then your
kernel driver is mt7921.

You can confirm with lshw which of these is loaded when you boot with Mint,
alternatively you can also note what firmware files are being used by the
card:

lsmod

and

modinfo <name of loaded module>
[snip ...]

firmware: ....
firmware: ....

Then when you boot with Gentoo, check in /lib/firmware the above listed
firmware files are already there.


> > 3. Configure /etc/conf.d/net with some appropriate settings; e.g.
> >
> > modules="wpa_supplicant"
> > wpa_supplicant_wlan0="-Dnl80211"
> > mac_wlan0="A1:B2:C3:D4:E5:F6"
> > config_wlan0="dhcp"
>
> 'net' didn't exist in /etc/conf.d , so i created it with your content.

For an exhaustive list of network options you could configure in /etc/conf.d/
net, you may want to explore the content of /usr/share/doc/netifrc-*/
net.example.bz2


> > Substitute wlan0 with whatever your wireless NIC is identified as
> > in 'ip link show'.
>
> 'ip a' + 'ip link show' both list 3 interfaces :
> (1) lo ; (2) enp6so (my landline) ; (3) sit0@NONE <noarp> mtu1480 ... .

OK, this is because you the required wireless card driver is not installed/
loaded in your kernel and therefore the interface is not initialised by the
kernel.


> With SR + Mint, the interface is shown as 'wlp5s0' (see below),
> which I've written in 'net' in place of 'wlan0' (3 times),
> eg 'config_wlp5s0="dhcp"'.
>
> (The landline interface works correctly)
>
> > 4. Configure /etc/wpa_supplicant/wpa_supplicant.conf
> >
> > with suitable authentication credentials for your AP :
> > network={
> >
> > ssid="My_AP"
> > bssid=AA:BB:CC:DD:EE:FF
> > proto=RSN
> >
> > key_mgmt=WPA-PSK (for WPA3, try key_mgmt=WPA-PSK-SHA256)
> >
> > pairwise=CCMP
> >
> > auth_alg=OPEN
> >
> > group=CCMP
> >
> > psk="Very_Secret_Shared_Key"
> >
> > ieee80211w=2 (1 is for PMF 'enabled', or 2 for 'required')
> > priority=5
> >
> > }
>
> I've done that.
>
> > 5. Then start the wpa_supplicant service :
> > 'rc-service -v wpa_supplicant start'.
>
> I've added it to start-up services with 'rc-update add wpa_supplicant',
> then rebooted & it shows up as "started". 'dhcpcd' also starts at boot.
>
> When I boot, the messages say 2 relevant things :
>
> "Caching service dependencies ...
> Successfully initialised wpa_supplicant ... "
>
> "INIT : Entering Runlevel 3
> could not find wireless interface
[snip ...]

Right, as I mentioned above the kernel requires the relevant driver either
configured in or as a module to be able to initialise the wireless card.

Once you configure and reboot your Gentoo kernel with the necessary wireless
driver, it will pick up the card, load any corresponding firmware files, or
complain in dmesg if these are missing, then start the wpa_supplicant and
dhcpcd services to configure your network connection.

It appears but for a missing kernel driver you're almost there. :-)
Re: using Wifi in a new machine [ In reply to ]
Thanks to Michael for his helpful advice.
I've narrowed the problem down somewhat,
but Wifi still doesn't work on Gentoo, tho' it does on Mint + SR.

The difference seems to be that when I enter 'lshw -class network' in Mint,
I get "network | description : Wireless interface ... ",
but in Gentoo it says "network | description : Network controller ... ".
Also, under "configuration:", Mint says "broadcast=yes, driver=nt7921e,
driver_version=5.15.0-generic, firmware=______919999-20220209 150915,
latency=0, multicast=yes, wireless=IEEE 802.11",
whereas Gentoo says only "driver=mt7921e, latency=0".

'lsmod' gives the same result on both systems, incl firmware.

It looks as if modules + firmware are all installed,
but for some reason Gentoo isn't recognising the device as Wifi.

What might be missing ?

BTW there appears to be a pkg 'rfkill' :
on Mint 'rfkill' reports "Bluetooth hci0 | wlan phy0", both unblocked.

Any further advice wb most welcome (smile).

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On 5/31/23 12:30, Philip Webb wrote:
> Thanks to Michael for his helpful advice.
> I've narrowed the problem down somewhat,
> but Wifi still doesn't work on Gentoo, tho' it does on Mint + SR.
>
> The difference seems to be that when I enter 'lshw -class network' in Mint,
> I get "network | description : Wireless interface ... ",
> but in Gentoo it says "network | description : Network controller ... ".
> Also, under "configuration:", Mint says "broadcast=yes, driver=nt7921e,
Is there a typo?  Above says driver nt7921e (first letter N)
> driver_version=5.15.0-generic, firmware=______919999-20220209 150915,
> latency=0, multicast=yes, wireless=IEEE 802.11",
> whereas Gentoo says only "driver=mt7921e, latency=0".
Driver here is mt7921e (first letter M)  If it's not a copy/paste error,
is it wrong in some config file?
>
> 'lsmod' gives the same result on both systems, incl firmware.
>
> It looks as if modules + firmware are all installed,
> but for some reason Gentoo isn't recognising the device as Wifi.
>
> What might be missing ?
>
> BTW there appears to be a pkg 'rfkill' :
> on Mint 'rfkill' reports "Bluetooth hci0 | wlan phy0", both unblocked.
>
> Any further advice wb most welcome (smile).
>
Re: using Wifi in a new machine [ In reply to ]
are you installing gentoo or is this on a running system? because the minimal installer only uses wpa_supplicant i couldn’t get wi-fi to work when i was installing gentoo. once i had everything installed though it worked.

On Wed, May 31, 2023, at 12:30 PM, Philip Webb wrote:
> Thanks to Michael for his helpful advice.
> I've narrowed the problem down somewhat,
> but Wifi still doesn't work on Gentoo, tho' it does on Mint + SR.
>
> The difference seems to be that when I enter 'lshw -class network' in Mint,
> I get "network | description : Wireless interface ... ",
> but in Gentoo it says "network | description : Network controller ... ".
> Also, under "configuration:", Mint says "broadcast=yes, driver=nt7921e,
> driver_version=5.15.0-generic, firmware=______919999-20220209 150915,
> latency=0, multicast=yes, wireless=IEEE 802.11",
> whereas Gentoo says only "driver=mt7921e, latency=0".
>
> 'lsmod' gives the same result on both systems, incl firmware.
>
> It looks as if modules + firmware are all installed,
> but for some reason Gentoo isn't recognising the device as Wifi.
>
> What might be missing ?
>
> BTW there appears to be a pkg 'rfkill' :
> on Mint 'rfkill' reports "Bluetooth hci0 | wlan phy0", both unblocked.
>
> Any further advice wb most welcome (smile).
>
> --
> ========================,,============================================
> SUPPORT ___________//___, Philip Webb
> ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
> TRANSIT `-O----------O---' purslowatchassdotutorontodotca
>
>
>
Re: using Wifi in a new machine [ In reply to ]
230531 Jack wrote:
> On 5/31/23 12:30, Philip Webb wrote:
>> Also, under "configuration:", Mint says "broadcast=yes, driver=nt7921e,
> Is there a typo?? Above says driver nt7921e (first letter N)
>> driver_version=5.15.0-generic, firmware=______919999-20220209 150915,
>> latency=0, multicast=yes, wireless=IEEE 802.11",
>> whereas Gentoo says only "driver=mt7921e, latency=0".
> Driver here is mt7921e (first letter M).
> If it's not a copy/paste error, is it wrong in some config file ?

sorry, it's been a long day. yes, it's a typo : the driver is 'mt7921e'.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
230531 Mark Dymek wrote:
> are you installing Gentoo or is this on a running system ?
> because the minimal installer only uses wpa_supplicant .
> i couldn’t get wi-fi to work when i was installing Gentoo.
> once i had everything installed though it worked.

That's interesting, but it doesn't take me much further (smile).
Yes, this is in the early stage of installing in a new machine.
Wifi works easily with System Rescue + Mint (running from USB stick).
The minimal installer -- presumably you mean Stage 3 --
didn't include 'wpa_supplicant' & I emerged it later.

Your experience suggests there mb some pkg missing, which I need.
Do you -- or anyone else -- have any idea what it might be ?

Perhaps there's still some firmware missing,
but I'm having difficulty identifying what it could be
or where I would find it.

Any more substantial advice is very welcome.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
Hi Philip,

On Wednesday, 31 May 2023 18:06:19 BST Philip Webb wrote:
> 230531 Mark Dymek wrote:
> > are you installing Gentoo or is this on a running system ?
> > because the minimal installer only uses wpa_supplicant .
> > i couldn’t get wi-fi to work when i was installing Gentoo.
> > once i had everything installed though it worked.
>
> That's interesting, but it doesn't take me much further (smile).
> Yes, this is in the early stage of installing in a new machine.
> Wifi works easily with System Rescue + Mint (running from USB stick).
> The minimal installer -- presumably you mean Stage 3 --
> didn't include 'wpa_supplicant' & I emerged it later.
>
> Your experience suggests there mb some pkg missing, which I need.
> Do you -- or anyone else -- have any idea what it might be ?
>
> Perhaps there's still some firmware missing,
> but I'm having difficulty identifying what it could be
> or where I would find it.
>
> Any more substantial advice is very welcome.

It seems you have the correct module for the mediatek driver installed, since
lshw on gentoo shows it being used. What is not shown is the firmware.

Do you see now the wireless link when you run 'ip link show', or is it still
absent?

The 'rfkill list' command (from sys-apps/util-linux) will list if by mistake
you have left your wireless adapter switched off - laptops have a hardware
button on the keyboard for this; e.g.

~ # rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes

If so, press the keyboard button to unblock it.

Now, to bottom out the firmware issue. You need to specify the firmware path
in your kernel, as explained here. By default this would be under /lib/
firmware:

https://wiki.gentoo.org/wiki/Linux_firmware

Hopefully, the requisite firmware file blobs will be present in the latest
stable 'sys-kernel/linux-firmware' package once you install it. dmesg will
reveal if these are/not being loaded. For example, this is what I get on an
old laptop with Intel wireless:

[ 13.276068] Loading firmware: iwlwifi-5000-5.ucode
[ 13.519131] iwlwifi 0000:04:00.0: loaded firmware version 8.83.5.1 build
33692 5000-5.ucode op_mode iwldvm
[ 13.622473] iwlwifi 0000:04:00.0: CONFIG_IWLWIFI_DEBUG disabled
[ 13.622483] iwlwifi 0000:04:00.0: CONFIG_IWLWIFI_DEBUGFS disabled
[ 13.622486] iwlwifi 0000:04:00.0: CONFIG_IWLWIFI_DEVICE_TRACING disabled
[ 13.622489] iwlwifi 0000:04:00.0: Detected Intel(R) WiFi Link 5100 AGN,
REV=0x54
[ 13.664327] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'
[ 13.730477] iwlwifi 0000:04:00.0 wlp4s0: renamed from wlan0

What do you do if the latest linux-firmware package does not have the firmware
blob(s) your wireless card requires, because it is rather new hardware? Well,
you could keyword the trunk version hoping it contains what you need:

** 99999999 *l^bstd [compress-xz compress-zstd initramfs
+redistributable savedconfig unknown-license] ["initramfs? ( redistributable )
?? ( compress-xz compress-zstd )"]

Or, you could compare what firmware files are loaded in Mint/SR ISOs and copy
these over to your Gentoo system for now, or you could fish around the
mediatek website for appropriate firmware files.

Finally, set up a symlink from '/etc.init.d/net.wlp5s0' to '/etc/init.d/
net.lo', (or whatever your card is detected as if not wlp5s0) - see here:

https://wiki.gentoo.org/wiki/Handbook:AMD64/Networking/Introduction

and bring up your wireless network service:

rc-service -v net.wlp5s0 start

NOTE: Besides wpa_supplicant, other packages required like 'net-misc/netifrc',
'net-misc/dhcpcd' should be installed, if they have not been brought in as
dependencies already.

Please post back your dmesg and any terminal output if you are still having
problems bringing up this wireless interface.

PS. I saw this page which may or may not be still relevant with the latest
stable kernels, but you may want to take a look either way:

https://wiki.gentoo.org/wiki/User:Chess/MT7921e
Re: using Wifi in a new machine [ In reply to ]
230531 Michael wrote:
> It seems you have the correct module for the mediatek driver installed,
> since lshw on gentoo shows it being used. What is not shown is the firmware.
> Now, to bottom out the firmware issue.
> You need to specify the firmware path in your kernel, as explained here.
> By default this would be under /lib/firmware/ :
> https://wiki.gentoo.org/wiki/Linux_firmware

/lib/firmware/ is the dir with firmware files.

> Hopefully, the requisite firmware file blobs will be present
> in the latest stable 'sys-kernel/linux-firmware' package,
> once you install it.

It is already installed (230404) , presumably as part of Stage 3.
That date shouldn't be too old.

> dmesg will reveal if these are/not being loaded.

'dmesg | grep firmware' shows 10 identical lines :

Loading firmware : mediatek/WIFI_MT7921_patch_mcu_1_2_hdr.bin :
failed with error-2 .

> you could keyword the trunk version hoping it contains what you need:
>
> ** 99999999 *l^bstd [compress-xz compress-zstd initramfs
> +redistributable savedconfig unknown-license] ["initramfs? ( redistributable )
> ?? ( compress-xz compress-zstd )"]

I don't understand these lines (smile).

> Or, you could compare what firmware files are loaded in Mint/SR ISOs
> and copy these over to your Gentoo system for now

SR shows no record of loading via 'dmesg' ;
Mint ends with a lot of Bluetooth + mt7921e references.
Mint mentions a firmware " ____010000 " ( 4 underlines ).

> or you could fish around the Mediatek website for approp firmware files.

no sign of firmware files.

> Finally, set up a symlink from '/etc.init.d/net.wlp5s0'
> to '/etc/init.d/net.lo' or whatever your card is detected, if not wlp5s0.

i've created that link, but how is it supposed to help ?

> https://wiki.gentoo.org/wiki/Handbook:AMD64/Networking/Introduction

> and bring up your wireless network service:
> 'rc-service -v net.wlp5s0 start'

it gives "ERROR : fails to start".

> Besides wpa_supplicant, other packages required like 'net-misc/netifrc',
> 'net-misc/dhcpcd' should be installed,
> if they have not been brought in as dependencies already.

I've installed 'netifrc' ; 'dhcpcd' was installed long ago.

> Please post back your dmesg and any terminal output,
> if you are still having problems bringing up this wireless interface.
> PS. This page which may or may not be still relevant
> with the latest stable kernels, but you may want to take a look either way:
> https://wiki.gentoo.org/wiki/User:Chess/MT7921e

So no progress today. I can try copying the firmware files from SR/Mint
-- everything under /lib/firmware/ in SR/Mint & see if it helps.

Your final note was a link to someone's pains using mt7921e,
which he sad in the end was defective software.

Further advice is still very welcome (smile).

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On Thursday, 1 June 2023 19:54:08 BST Philip Webb wrote:
> 230531 Michael wrote:
> > It seems you have the correct module for the mediatek driver installed,
> > since lshw on gentoo shows it being used. What is not shown is the
> > firmware. Now, to bottom out the firmware issue.
> > You need to specify the firmware path in your kernel, as explained here.
> > By default this would be under /lib/firmware/ :
> > https://wiki.gentoo.org/wiki/Linux_firmware
>
> /lib/firmware/ is the dir with firmware files.
>
> > Hopefully, the requisite firmware file blobs will be present
> > in the latest stable 'sys-kernel/linux-firmware' package,
> > once you install it.
>
> It is already installed (230404) , presumably as part of Stage 3.
> That date shouldn't be too old.

The current stable version is:

sys-kernel/linux-firmware-20230515

I suggest you run an update to fetch this version - see below.


> > dmesg will reveal if these are/not being loaded.
>
> 'dmesg | grep firmware' shows 10 identical lines :
>
> Loading firmware : mediatek/WIFI_MT7921_patch_mcu_1_2_hdr.bin :
> failed with error-2 .

Oops! This is rather ominous and the cause of your problems - see below.


> > you could keyword the trunk version hoping it contains what you need:
> > ** 99999999 *l^bstd [compress-xz compress-zstd initramfs
> >
> > +redistributable savedconfig unknown-license] [."initramfs? (
> > redistributable ) ?? ( compress-xz compress-zstd )"]
>
> I don't understand these lines (smile).

This is the bleeding edge version of the package, but you may not need to
install it (yet).


> > Or, you could compare what firmware files are loaded in Mint/SR ISOs
> > and copy these over to your Gentoo system for now
>
> SR shows no record of loading via 'dmesg' ;
> Mint ends with a lot of Bluetooth + mt7921e references.
> Mint mentions a firmware " ____010000 " ( 4 underlines ).

Hmm ... Mint seems to be using an older version, which according to this post
has since been patched:

https://lore.kernel.org/lkml/3198471.FQF0JACdhR@ripper/


> > or you could fish around the Mediatek website for approp firmware files.
>
> no sign of firmware files.

OK.

I had a look in the latest stable version sys-kernel/linux-firmware-20230515
for the file you reported an error on:

$ find /lib/firmware -iname WIFI_MT7961_patch_mcu_1_2_hdr.bin
/lib/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin
$ ls -la /lib/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin
-rw-r--r-- 1 root root 92192 May 18 16:16 /lib/firmware/mediatek/
WIFI_MT7961_patch_mcu_1_2_hdr.bin

Do you get the same result? I'd update to the latest linux-firmware version
first, just in case.

> > Finally, set up a symlink from '/etc.init.d/net.wlp5s0'
> > to '/etc/init.d/net.lo' or whatever your card is detected, if not wlp5s0.
>
> i've created that link, but how is it supposed to help ?

This is merely to bring up the interface and establish your wireless network
service at boot time, if you add it to the default run level:

rc-update add net.wlp5s0 default

but until you get it working, you can use this service to start/stop your
wireless connection manually.


> > https://wiki.gentoo.org/wiki/Handbook:AMD64/Networking/Introduction
> >
> > and bring up your wireless network service:
> > 'rc-service -v net.wlp5s0 start'
>
> it gives "ERROR : fails to start".

Yes, because there is the previous problem with the firmware.


> > Besides wpa_supplicant, other packages required like 'net-misc/netifrc',
> > 'net-misc/dhcpcd' should be installed,
> > if they have not been brought in as dependencies already.
>
> I've installed 'netifrc' ; 'dhcpcd' was installed long ago.
>
> > Please post back your dmesg and any terminal output,
> > if you are still having problems bringing up this wireless interface.
> > PS. This page which may or may not be still relevant
> > with the latest stable kernels, but you may want to take a look either
> > way:
> > https://wiki.gentoo.org/wiki/User:Chess/MT7921e
>
> So no progress today. I can try copying the firmware files from SR/Mint
> -- everything under /lib/firmware/ in SR/Mint & see if it helps.

Not yet, let's see if the missing firmware file is available in your /lib/
firmware first.
Re: using Wifi in a new machine : progress [ In reply to ]
Thanks for all the help so far.

I've solved the firmware problem.
The needed files weren't in the latest stable version of linux-firmware
nor in the masked version (after much hassle unmasking it),
but they are in both System Rescue + Mint /lib/firmware/mediatek .
They are versions 7922 and 7961 with corresponding RAM_CODE files.

I copied them into the new machine in the same-named dir, 'unxz' them
& after reboot 'dmesg' announced that it had loaded 7961
& 'ip a' showed a 4th interface 'wlp5s0'. So far, so good.

What is still not good is that that interface has "NO-CARRIER".
Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.

'rc-service -v wpa_supplicant start' gets it STARTED,
but 'ip a' still shows "NO-CARRIER".
I tried 'ip link set wlp5s0 carrier on',
but was told "operation not supported".

w_s seems to be finding its conf file
at /etc/wpa_supplicant/wpa_supplicant.conf ,
but 'wpa_cli' continues to say "can't link to wpa_supplicant".

I have checked the service name + password are correct in the conf file.

It's approaching supper time & I've run out of ideas for today anyway.

Any further advice is most welcome (smile).

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine : progress [ In reply to ]
On Thu, Jun 01, 2023 at 11:09:50PM -0400, Philip Webb wrote:
> Thanks for all the help so far.
>
> I've solved the firmware problem.
> The needed files weren't in the latest stable version of linux-firmware
> nor in the masked version (after much hassle unmasking it),
> but they are in both System Rescue + Mint /lib/firmware/mediatek .
> They are versions 7922 and 7961 with corresponding RAM_CODE files.
>
> I copied them into the new machine in the same-named dir, 'unxz' them
> & after reboot 'dmesg' announced that it had loaded 7961
> & 'ip a' showed a 4th interface 'wlp5s0'. So far, so good.
>
> What is still not good is that that interface has "NO-CARRIER".
> Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.
>
> 'rc-service -v wpa_supplicant start' gets it STARTED,
> but 'ip a' still shows "NO-CARRIER".
> I tried 'ip link set wlp5s0 carrier on',
> but was told "operation not supported".
>
> w_s seems to be finding its conf file
> at /etc/wpa_supplicant/wpa_supplicant.conf ,
> but 'wpa_cli' continues to say "can't link to wpa_supplicant".
>
> I have checked the service name + password are correct in the conf file.
>
> It's approaching supper time & I've run out of ideas for today anyway.
>
> Any further advice is most welcome (smile).
>
> --
> ========================,,============================================
> SUPPORT ___________//___, Philip Webb
> ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
> TRANSIT `-O----------O---' purslowatchassdotutorontodotca
>
>

I don't know if you've already done so, but if not, can you post the
contents of wpa_supplicant.conf..?

--
Lee
Re: using Wifi in a new machine : progress [ In reply to ]
230601 Lee K wrote:
> On Thu, Jun 01, 2023 at 11:09:50PM -0400, Philip Webb wrote:
> > Thanks for all the help so far.
> >
> > I've solved the firmware problem.
> > The needed files weren't in the latest stable version of linux-firmware
> > nor in the masked version (after much hassle unmasking it),
> > but they are in both System Rescue + Mint /lib/firmware/mediatek .
> > They are versions 7922 and 7961 with corresponding RAM_CODE files.
> >
> > I copied them into the new machine in the same-named dir, 'unxz' them
> > & after reboot 'dmesg' announced that it had loaded 7961
> > & 'ip a' showed a 4th interface 'wlp5s0'. So far, so good.
> >
> > What is still not good is that that interface has "NO-CARRIER".
> > Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.
> >
> > 'rc-service -v wpa_supplicant start' gets it STARTED,
> > but 'ip a' still shows "NO-CARRIER".
> > I tried 'ip link set wlp5s0 carrier on',
> > but was told "operation not supported".
> >
> > w_s seems to be finding its conf file
> > at /etc/wpa_supplicant/wpa_supplicant.conf ,
> > but 'wpa_cli' continues to say "can't link to wpa_supplicant".
> >
> > I have checked the service name + password are correct in the conf file.
> >
> > It's approaching supper time & I've run out of ideas for today anyway.
> >
> > Any further advice is most welcome (smile).
> >
> > --
> > ========================,,============================================
> > SUPPORT ___________//___, Philip Webb
> > ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
> > TRANSIT `-O----------O---' purslowatchassdotutorontodotca
> >
> >
>
> I don't know if you've already done so, but if not, can you post the
> contents of wpa_supplicant.conf..?
>
> --
> Lee

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine : progress [ In reply to ]
230601 Lee K wrote:
> On Thu, Jun 01, 2023 at 11:09:50PM -0400, Philip Webb wrote:
>> What is still not good is that that interface has "NO-CARRIER".
>> Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.
>>
>> 'rc-service -v wpa_supplicant start' gets it STARTED,
>> but 'ip a' still shows "NO-CARRIER".
>> I tried 'ip link set wlp5s0 carrier on',
>> but was told "operation not supported".
>>
>> w_s seems to be finding its conf file
>> at /etc/wpa_supplicant/wpa_supplicant.conf ,
>> but 'wpa_cli' continues to say "can't link to wpa_supplicant".
>>
>> I have checked the service name + password are correct in the conf file.

> Can you post the contents of wpa_supplicant.conf..?

#wpa_supplicant.conf 230601

network={
ssid="<Wifi service provider>"
bssid=AA:BB:CC:DD:EE:FF
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
group=CCMP
psk="<Wifi password>"
ieee80211w=2
priority=5
}

I have put wpa_supplicant in the default services started at boot.

There was also a suggestion to create a symlink net.wlp5s0
pointing to net.lo both in /etc/init.d ; it's not there now.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine : progress [ In reply to ]
On Friday, 2 June 2023 04:09:50 BST Philip Webb wrote:
> Thanks for all the help so far.
>
> I've solved the firmware problem.
> The needed files weren't in the latest stable version of linux-firmware
> nor in the masked version (after much hassle unmasking it),
> but they are in both System Rescue + Mint /lib/firmware/mediatek .
> They are versions 7922 and 7961 with corresponding RAM_CODE files.

Are you sure? These are all the mediatek files I have here:

$ ls -la /lib/firmware/mediatek
total 24648
drwxr-xr-x 9 root root 4096 May 18 16:17 .
drwxr-xr-x 80 root root 20480 May 18 16:17 ..
-rw-r--r-- 1 root root 511830 May 18 16:16 BT_RAM_CODE_MT7922_1_1_hdr.bin
-rw-r--r-- 1 root root 532590 May 18 16:16 BT_RAM_CODE_MT7961_1_2_hdr.bin
-rw-r--r-- 1 root root 137632 May 18 16:16 WIFI_MT7922_patch_mcu_1_1_hdr.bin
-rw-r--r-- 1 root root 92192 May 18 16:16 WIFI_MT7961_patch_mcu_1_2_hdr.bin
-rw-r--r-- 1 root root 827124 May 18 16:16 WIFI_RAM_CODE_MT7922_1.bin
-rw-r--r-- 1 root root 719348 May 18 16:16 WIFI_RAM_CODE_MT7961_1.bin
-rw-r--r-- 1 root root 45412 May 18 16:15 mt7601u.bin
-rw-r--r-- 1 root root 80680 May 18 16:16 mt7610e.bin
-rw-r--r-- 1 root root 80288 May 18 16:16 mt7610u.bin
-rw-r--r-- 1 root root 122644 May 18 16:16 mt7615_cr4.bin
-rw-r--r-- 1 root root 457992 May 18 16:16 mt7615_n9.bin
-rw-r--r-- 1 root root 11102 May 18 16:16 mt7615_rom_patch.bin
-rw-r--r-- 1 root root 300376 May 18 16:16 mt7622_n9.bin
-rw-r--r-- 1 root root 82110 May 18 16:16 mt7622_rom_patch.bin
-rw-r--r-- 1 root root 78158 May 18 16:16 mt7622pr2h.bin
-rw-r--r-- 1 root root 368220 May 18 16:15 mt7650.bin
-rw-r--r-- 1 root root 382212 May 18 16:16 mt7650e.bin
-rw-r--r-- 1 root root 81908 May 18 16:16 mt7662.bin
-rw-r--r-- 1 root root 26350 May 18 16:16 mt7662_rom_patch.bin
-rw-r--r-- 1 root root 91412 May 18 16:16 mt7662u.bin
-rw-r--r-- 1 root root 20686 May 18 16:16 mt7662u_rom_patch.bin
-rw-r--r-- 1 root root 335072 May 18 16:16 mt7663_n9_rebb.bin
-rw-r--r-- 1 root root 441688 May 18 16:16 mt7663_n9_v3.bin
-rw-r--r-- 1 root root 278558 May 18 16:16 mt7663pr2h.bin
-rw-r--r-- 1 root root 209230 May 18 16:16 mt7663pr2h_rebb.bin
-rw-r--r-- 1 root root 170990 May 18 16:16 mt7668pr2h.bin
-rw-r--r-- 1 root root 3584 May 18 16:16 mt7915_eeprom.bin
-rw-r--r-- 1 root root 3584 May 18 16:16 mt7915_eeprom_dbdc.bin
-rw-r--r-- 1 root root 144544 May 18 16:16 mt7915_rom_patch.bin
-rw-r--r-- 1 root root 116160 May 18 16:16 mt7915_wa.bin
-rw-r--r-- 1 root root 1260960 May 18 16:16 mt7915_wm.bin
-rw-r--r-- 1 root root 4096 May 18 16:16 mt7916_eeprom.bin
-rw-r--r-- 1 root root 8672 May 18 16:16 mt7916_rom_patch.bin
-rw-r--r-- 1 root root 507856 May 18 16:16 mt7916_wa.bin
-rw-r--r-- 1 root root 1710304 May 18 16:16 mt7916_wm.bin
-rw-r--r-- 1 root root 8736 May 18 16:16 mt7981_rom_patch.bin
-rw-r--r-- 1 root root 492336 May 18 16:16 mt7981_wa.bin
-rw-r--r-- 1 root root 2052592 May 18 16:16 mt7981_wm.bin
-rw-r--r-- 1 root root 2427600 May 18 16:16 mt7981_wo.bin
-rw-r--r-- 1 root root 4096 May 18 16:16 mt7986_eeprom_mt7975_dual.bin
-rw-r--r-- 1 root root 4096 May 18 16:16 mt7986_eeprom_mt7976.bin
-rw-r--r-- 1 root root 4096 May 18 16:16 mt7986_eeprom_mt7976_dbdc.bin
-rw-r--r-- 1 root root 4096 May 18 16:16 mt7986_eeprom_mt7976_dual.bin
-rw-r--r-- 1 root root 12768 May 18 16:16 mt7986_rom_patch.bin
-rw-r--r-- 1 root root 12768 May 18 16:16 mt7986_rom_patch_mt7975.bin
-rw-r--r-- 1 root root 518784 May 18 16:16 mt7986_wa.bin
-rw-r--r-- 1 root root 2226016 May 18 16:16 mt7986_wm.bin
-rw-r--r-- 1 root root 2226016 May 18 16:16 mt7986_wm_mt7975.bin
-rw-r--r-- 1 root root 2428032 May 18 16:16 mt7986_wo_0.bin
-rw-r--r-- 1 root root 2428032 May 18 16:16 mt7986_wo_1.bin
drwxr-xr-x 2 root root 4096 May 18 16:17 mt8173
drwxr-xr-x 2 root root 4096 May 18 16:17 mt8183
drwxr-xr-x 2 root root 4096 May 18 16:17 mt8186
drwxr-xr-x 2 root root 4096 May 18 16:17 mt8192
drwxr-xr-x 2 root root 4096 May 18 16:17 mt8195
drwxr-xr-x 2 root root 4096 May 18 16:17 sof
drwxr-xr-x 2 root root 4096 May 18 16:17 sof-tplg


> I copied them into the new machine in the same-named dir, 'unxz' them
> & after reboot 'dmesg' announced that it had loaded 7961
> & 'ip a' showed a 4th interface 'wlp5s0'. So far, so good.

I suggest you have another look at what files portage installed with the
linux-firmware package to understand why these were missing. However, if the
interface is now initialised by the kernel, you can at least move on to the
next step. :-)


> What is still not good is that that interface has "NO-CARRIER".

What is the full output please? Does it show the interface is "UP"?


> Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.

This may mean the interface is not up yet. Does running the rc-service
command I provided previously, or '/etc/init.d/net.wlp5s0 -v start' bring it
up? Can you stop it, start it, check its status with either of these two
commands?


> 'rc-service -v wpa_supplicant start' gets it STARTED,
> but 'ip a' still shows "NO-CARRIER".
> I tried 'ip link set wlp5s0 carrier on',
> but was told "operation not supported".

You need to run:

ip link set dev wlp5s0 up


> w_s seems to be finding its conf file
> at /etc/wpa_supplicant/wpa_supplicant.conf ,
> but 'wpa_cli' continues to say "can't link to wpa_supplicant".



> I have checked the service name + password are correct in the conf file.
>
> It's approaching supper time & I've run out of ideas for today anyway.
>
> Any further advice is most welcome (smile).

I can think of four options to manage your wireless NIC.

1. With netifrc scripts, as per the /etc/init.d/net.wlp5s0 symlink. When this
service starts it will parse your /etc/conf.d/net file, find the section for
wlp5s0 and configure it accordingly, bringing in wpa_supplicant to execute the
authentication with the AP. This is useful if you have particular settings
e.g. static IP address(es) and convoluted gateways with one or more APs and
require a more granular IP configurations.

2. With wpa_supplicant only, in which case add your wpa_service service script
to the rc default level.

3. With ifplugd, which is more useful for laptops, when the wired/wireless
connections are intermittent and you don't want to have to start/stop them
manually.

4. Manually, e.g. with ip commands.

Any of the above will be able to bring your interface up and down, as long as
the kernel driver and NIC firmware files are available.
Re: using Wifi in a new machine : progress [ In reply to ]
On Friday, 2 June 2023 07:16:41 BST Philip Webb wrote:
> 230601 Lee K wrote:
> > On Thu, Jun 01, 2023 at 11:09:50PM -0400, Philip Webb wrote:
> >> What is still not good is that that interface has "NO-CARRIER".
> >> Also, 'rc-status' after a reboot shows wpa_supplicant as STOPPED.
> >>
> >> 'rc-service -v wpa_supplicant start' gets it STARTED,
> >> but 'ip a' still shows "NO-CARRIER".
> >> I tried 'ip link set wlp5s0 carrier on',
> >> but was told "operation not supported".
> >>
> >> w_s seems to be finding its conf file
> >> at /etc/wpa_supplicant/wpa_supplicant.conf ,
> >> but 'wpa_cli' continues to say "can't link to wpa_supplicant".
> >>
> >> I have checked the service name + password are correct in the conf file.
> >
> > Can you post the contents of wpa_supplicant.conf..?
>
> #wpa_supplicant.conf 230601
>
> network={
> ssid="<Wifi service provider>"
> bssid=AA:BB:CC:DD:EE:FF
> proto=RSN
> key_mgmt=WPA-PSK
> pairwise=CCMP
> auth_alg=OPEN
> group=CCMP
> psk="<Wifi password>"
> ieee80211w=2
> priority=5
> }

Have a look at your /usr/share/doc/wpa_supplicant-2.10-r1/
wpa_supplicant.conf.bz2, or whatever is the version of your installed
wpa_supplicant package.

If you define ieee80211w=2 for obligatory 'management frame protection', I
understand you'll need:

key_mgmt=WPA-PSK WPA-PSK-SHA256 (for WPA2)

or,

key_mgmt=SAE (Simultaneous Authentication of Equals for WPA3 only)

Meanwhile, PSK stands for "Pre-Shared Key". This is meant to be either 64
hex-digits (32 bytes), or an ASCII passphrase which will be used to generate
the PSK with the SSID, when the configuration file is processed by
wpa_supplicant. Typically a passphrase is used with domestic WiFi routers.
Either way, look at 'man wpa_passphrase' if you ever want to generate a key.


> I have put wpa_supplicant in the default services started at boot.

Good.


> There was also a suggestion to create a symlink net.wlp5s0
> pointing to net.lo both in /etc/init.d ; it's not there now.

This would be needed for more granular network configuration - it depends on
your particular use case requirements (different NICs, APs, gateways, static
IPs, etc.). If you have added wpa_supplicant in your default level rc scripts
then you don't need both.
Re: using Wifi in a new machine [ In reply to ]
230602 Michael wrote:
> On Friday, 2 June 2023 07:16:41 BST Philip Webb wrote:
>> #wpa_supplicant.conf 230601
>>
>> network={
>> ssid="<Wifi service provider>"
>> bssid=AA:BB:CC:DD:EE:FF
>> proto=RSN
>> key_mgmt=WPA-PSK
>> pairwise=CCMP
>> auth_alg=OPEN
>> group=CCMP
>> psk="<Wifi password>"
>> ieee80211w=2
>> priority=5
>> }
>
> Have a look at your
> /usr/share/doc/wpa_supplicant-2.10-r1/wpa_supplicant.conf.bz2

Thanx : I tend to look at 'man' & forget the dox in /usr/share .
I've copied it all into this regular machine & will look thro' it ;
there's an awful lot of info, but some tiny note mb the solution (grin).

> If you define ieee80211w=2 for obligatory 'management frame protection',
> I understand you'll need :
> key_mgmt=WPA-PSK WPA-PSK-SHA256 (for WPA2)
> or
> key_mgmt=SAE (Simultaneous Authentication of Equals for WPA3 only)

I tried both, but no change.

> Meanwhile, PSK stands for "Pre-Shared Key".
> This is meant to be either 64 hex-digits (32 bytes)
> or an ASCII passphrase which will be used to generate the PSK with the SSID,
> when the configuration file is processed by wpa_supplicant .
> Typically a passphrase is used with domestic WiFi routers.

This Wifi belongs to my landlord & is just over my head in the house.
IIRC it runs on Ubuntu (he uses Mac for his home-office).
He's amiable, but no tech specialist (he distributes movies for a living).

> Either way, look at 'man wpa_passphrase' if you ever want to generate a key.

The password looks like 'M343477M' (all different characters).
It works with SR + Mint.

Today's investigations :

(1) I copied the BT- firmware ( 2 files) from SR
into /lib/firmware/mediatek on the new machine : no change.

'dmesg | grsp firmware' gives

Spectre V2 : Enabling Restricted Speculation for firmware calls.
Loading firmware : regulatory.db
Loading firmware : regulatory.db.p7s
mediatek /WIFI_MT7961_patch_mcu_1_2_hdr.bin
mediatek /WIFI_RAM_CODE_MT7961_1.bin [repeated once]

At the end of dmesg it says :

mt7921e : renamed from wlan0

(2) w_s dox : one suggested conf file has simply :

network {
ssid="simple"
psk="<password>"
priority=5
}

This makes no difference.

(3) You didn't comment on the failure of w-s to start in default runlevel.
The final lines before login are :

INIT : Entering runlevel : 3
Waiting for uevents to be processed ...
[RED] Could not find a wireless interface
[RED] ERROR : wpa_supplicant failed to start
starting DHCP client Daemon
Mounting network filesystems
Starting local

The first red msg is from the w-s script in /etc/init.d .
I wonder whether w-s sb trying to start before the DHCP deamon ?
It has no difficulty starting via 'rc-service' after login.

Unfortunately, I can't explore how SF + Mint handle this,
as they both use Systemd, not Openrc, which I am using.

I'll look thro' the /usr/share dox as carefully as I can.
Your comment on my final query wb very welcome
or any other thoughts you might have.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Re: using Wifi in a new machine [ In reply to ]
On Saturday, 3 June 2023 01:17:08 BST Philip Webb wrote:

> The password looks like 'M343477M' (all different characters).
> It works with SR + Mint.

Yes, this will work with wpa_supplicant.


> Today's investigations :
>
> (1) I copied the BT- firmware ( 2 files) from SR
> into /lib/firmware/mediatek on the new machine : no change.
>
> 'dmesg | grsp firmware' gives
>
> Spectre V2 : Enabling Restricted Speculation for firmware calls.
> Loading firmware : regulatory.db
> Loading firmware : regulatory.db.p7s
> mediatek /WIFI_MT7961_patch_mcu_1_2_hdr.bin
> mediatek /WIFI_RAM_CODE_MT7961_1.bin [repeated once]
>
> At the end of dmesg it says :
>
> mt7921e : renamed from wlan0

This is expected, as the NIC name as identified by the kernel is replaced by
udev following a reliably predictable convention. From what you have reported
so far, your wlan0 is renamed to wlp5s0.


> (2) w_s dox : one suggested conf file has simply :
>
> network {
> ssid="simple"
> psk="<password>"
> priority=5
> }
>
> This makes no difference.

By leaving out any directives for algorithms and encryption options, the
wpa_supplicant will try them one at time until one hopefully succeeds.


> (3) You didn't comment on the failure of w-s to start in default runlevel.
> The final lines before login are :
>
> INIT : Entering runlevel : 3
> Waiting for uevents to be processed ...
> [RED] Could not find a wireless interface
> [RED] ERROR : wpa_supplicant failed to start
> starting DHCP client Daemon
> Mounting network filesystems
> Starting local

I may have missed this in previous messages. wpa_supplicant cannot start your
wireless interface because it is not yet initialised. However, if the kernel
has picked it up further up and udev renamed it, it ought to be available -
see below.


> The first red msg is from the w-s script in /etc/init.d .
> I wonder whether w-s sb trying to start before the DHCP deamon ?
> It has no difficulty starting via 'rc-service' after login.

wpa_supplicant will have to bring up the interface and authenticate with an
AP, before IP layer negotiations can start on DHCP for an IP address.


> Unfortunately, I can't explore how SF + Mint handle this,
> as they both use Systemd, not Openrc, which I am using.

It might be a matter of slowing down the start of the wpa_supplicant service
until the NIC initialisation by the kernel and its renaming by udev has
completed. NICs connected to USB as opposed to PCI bus often tend to be a bit
sluggish. You can uncomment this line in '/etc/conf.d/wpa_supplicant' openrc
configuration:

# uncomment this if wpa_supplicant starts up before your network interface
# is ready and it causes issues
rc_want="dev-settle"


> I'll look thro' the /usr/share dox as carefully as I can.
> Your comment on my final query wb very welcome
> or any other thoughts you might have.

Your wpa_supplicant configuration may be OK, if the only problem is
wpa_supplicant rc service fails to start. If however, the logs show the
interface comes up and then authentication with the AP fails, then tweaking
the wpa_supplicant configuration will be necessary.

Generally, I troubleshoot such problems by methodically configuring, enabling
and monitoring an interface as I manually tweak things:

1. Configure the kernel for NIC drivers. I run 'dmesg -W' and then 'modprobe
-v' the relevant module until I can see in the output the driver is loaded,
any module dependencies are also loaded and the interface is initialised. 'ip
link show' should list the NIC. For permanent interfaces I tend to build the
driver in the kernel, for temporary interfaces I tend to build the driver as
modules. These days firmware files are generally available for linux, but
sometimes in the past they had to be downloaded and extracted from the
manufacturers binary blobs.

2. Configure the netifrc script, if I use netifrc to manage more complicated
network configurations for an interface. Alternatively, I only add dhcpcd to
the default runlevel instead and leave it to do its thing. For wireless NICs
I may just use the wpa_supplicant service instead, which deals with AP
authentication too. As I start/stop any of these services manually, I check
the log output to see if there are any problems and tweak the configuration to
resolve them. For wpa_supplicant I may increase verbosity and also check the
output of wpa_cli/wpa_gui, if pairing negotiations with an AP are not
successful and authentication fails. I've used NetworkManager and ConnMan
too, but only with binary distros.

3. Once everything works manually, I add the required service to the default
run level and reboot. If things do not work as expected, I enable rc logging
and check its output.

Usually, after a couple of iterations I end up with a working network
connection.

See how the above suggestions go and post back with your results.
Re: using Wifi in a new machine : solved [ In reply to ]
After much investigation, I've finally got Wifi working in my new machine.

There were 2 serious problems :
the firmware had been updated to a new version number (7961 from 7921),
which I was able to find in System Rescue /lib/firmware
(it wasn't in the latest Gentoo firmware pkg).

Then many tries failed to get Wpa-supplicant to start via RC :
every time, it failed to start because it couldn't find an interface
(the failure seems to be due to Udev/Dhcpcd/W-S tripping over one another).
Finally, I removed it from the default runlevel
& started it after boot + login via 'rc-service ... start'.
There's a 15 sec delay, then 'ip a' shows carrier + IP numbers
(it doesn't change the name from 'wlan0', but that doesn't matter).
I've aliased the start command as 'wifi' in /root/.bashrc ,
which allows an easy start-up after every reboot
(I insist on long-standing UNIX procedure
& do all system management in a root console).

The w-p conf file I'm using is as simple as cb ,
showing only SSID PSK priority .

This is a desktop system in the basement of a downtown house :
the Wifi server is upstairs over my head.

FYI for anyone else who finds her/himself stuck in this way.

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca