Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-15 Thread Pascal Hambourg

On 15/12/2023 at 20:27, Carsten Schoenert wrote:


https://salsa.debian.org/tijuca/hw-detect/-/commit/0e94654ca8ed0faa3790a52280342f388be3db9e


I think it would be better to add this stanza outside (before) the "for 
driver" loop. There are two cases, depending on the controller model:


1) iwlmvm is loaded

modprobe -r $module # fail because iwlwifi is used by iwlmvm
modprobe $module # no-op

for driver in $(find /sys/bus/*/drivers -name "$module"); do
if [ "$module" == "iwlwifi" ]; then
modprobe -r iwlmvm # ok, unloads iwlwifi too
modprobe $module # reloads iwlwifi
fi
...

2) iwlmvm is not loaded

modprobe -r $module -> ok
modprobe $module -> ok

for driver in $(find /sys/bus/*/drivers -name "$module"); do
if [ "$module" == "iwlwifi" ]; then
modprobe -r iwlmvm # no-op
modprobe $module # no-op
fi
...

It appears there are fail and/or no-op in both cases. This would be simpler:

if [ "$module" == "iwlwifi" ]; then
modprobe -r iwlmvm # no-op if not loaded
fi
modprobe -r $module # no-op if unloaded with iwlmvm, but safe
modprobe $module

for driver in $(find /sys/bus/*/drivers -name "$module"); do
...



Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-15 Thread Carsten Schoenert

Am 15.12.23 um 20:43 schrieb Cyril Brulebois:

With these small modifications I can currently use the d-i on my X1 G11
without further issues. A small exception, as the firmware-iwlwifi/testing
can't provide the required firmware files right now they need to get
provided on an additional inserted media.


Great, thanks. Do you actual need to modprobe $module at that point? I
thought the block right after that should modprobe -r/modprobe iwlwifi
on its own? (But it wasn't sufficient before you starting unloading
iwlmvm.)


The code block above is already still trying to do this removal and 
loading of iwlwifi, but is of course not working due module deps. So 
this not working call are still visible in the logs. I'd say it's not 
nice at the moment but in the end nothing more.



-%<- line 408++
# remove and reload modules so they see the new firmware
for module in $modules; do
if ! nic_is_configured $module; then
log "removing and loading kernel module $module"
log_output modprobe -r $module || true
log_output modprobe $module || true
->%


That's something I was not able to catch nicely for the iwlwifi 
module/driver, but my understanding of the code and the functions calls 
isn't good enough right now. For more diving in I'd need to build up a 
better testing environment. I'm not able to do this at the moment.


I guess over time we will see more of such corner cases with a required 
dedicated module reload behavior. Means we need to add more code that is 
able to handle this. I haven't a good approach how a generic code for 
this could look like.


...

If you are fine I can raise a MR for easy pulling in. Otherwise feel free to
comment on my changes.


I know mixed stuff isn't too nice, and unifying might be appealing, but
that makes cherry-picking stuff harder, so I tend to only unify things
when I'm actually changing code… Others might feel differently.


This is quite always depending on the POV :-) , but I'm emotionless on 
this, the maintainers decide how to deal with such things as it's their 
time and responsibility in the end.

So I'll drop this patch.


Well spotted, for the typo.


Naaa, the spelling correction was highlighting the misspelled word. :-)

---
Regards
Carsten



Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-15 Thread Cyril Brulebois
Carsten Schoenert  (2023-12-15):
> thank you very much for pointing me!
> 
> I did play around a bit and was adding and testing the mentioned approach.
> 
> https://salsa.debian.org/tijuca/hw-detect/-/commit/0e94654ca8ed0faa3790a52280342f388be3db9e
> 
> With these small modifications I can currently use the d-i on my X1 G11
> without further issues. A small exception, as the firmware-iwlwifi/testing
> can't provide the required firmware files right now they need to get
> provided on an additional inserted media.

Great, thanks. Do you actual need to modprobe $module at that point? I
thought the block right after that should modprobe -r/modprobe iwlwifi
on its own? (But it wasn't sufficient before you starting unloading
iwlmvm.)

> I did also same small s/space/tab modifications with no code changes
> afterwards in check-missing firmware.sh so the indentations are now unified
> to use tabs again and fixing also a small typo.
> 
> https://salsa.debian.org/tijuca/hw-detect/-/commit/2a3c045a72b4f31fc818b7f639daf5c08b7e2e5a
> 
> If you are fine I can raise a MR for easy pulling in. Otherwise feel free to
> comment on my changes.

I know mixed stuff isn't too nice, and unifying might be appealing, but
that makes cherry-picking stuff harder, so I tend to only unify things
when I'm actually changing code… Others might feel differently.

Well spotted, for the typo.


Cheers,
-- 
Cyril Brulebois (k...@debian.org)
D-I release manager -- Release team member -- Freelance Consultant


signature.asc
Description: PGP signature


Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-15 Thread Carsten Schoenert

Hello Cyril,

Am 13.12.23 um 20:16 schrieb Cyril Brulebois:

Carsten Schoenert  (2023-12-13):

The "trick" is to unload the iwlmvm module instead and load afterwards
the module iwlwifi again.


See the very bottom of check-missing-firmware.sh (hw-detect repository),
the loop over $modules. You could try intercepting $module = iwlwifi,
and adding a modprobe -r theotherone beforehand.


thank you very much for pointing me!

I did play around a bit and was adding and testing the mentioned approach.

https://salsa.debian.org/tijuca/hw-detect/-/commit/0e94654ca8ed0faa3790a52280342f388be3db9e

With these small modifications I can currently use the d-i on my X1 G11 
without further issues. A small exception, as the 
firmware-iwlwifi/testing can't provide the required firmware files right 
now they need to get provided on an additional inserted media.


I did also same small s/space/tab modifications with no code changes 
afterwards in check-missing firmware.sh so the indentations are now 
unified to use tabs again and fixing also a small typo.


https://salsa.debian.org/tijuca/hw-detect/-/commit/2a3c045a72b4f31fc818b7f639daf5c08b7e2e5a

If you are fine I can raise a MR for easy pulling in. Otherwise feel 
free to comment on my changes.


--
Regards
Carsten



Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-13 Thread Cyril Brulebois
Pascal Hambourg  (2023-12-13):
> Wouldn't it be more generic to check /sys/module/${module}/holders
> like is done for mhi ?

I was suggesting a quick and dirty way to get away with this, to see if
it helps, answering the question regarding where in the code one might
want to try something.


Cheers,
-- 
Cyril Brulebois (k...@debian.org)
D-I release manager -- Release team member -- Freelance Consultant


signature.asc
Description: PGP signature


Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-13 Thread Pascal Hambourg

Hello,

Le 13/12/2023 à 20:16, Cyril Brulebois a écrit :

Carsten Schoenert  (2023-12-13):

The "trick" is to unload the iwlmvm module instead and load afterwards
the module iwlwifi again.


See the very bottom of check-missing-firmware.sh (hw-detect repository),
the loop over $modules. You could try intercepting $module = iwlwifi,
and adding a modprobe -r theotherone beforehand.


Wouldn't it be more generic to check /sys/module/${module}/holders like 
is done for mhi ?


Note: iwldvm is also loaded by iwlwifi (for older hardware I guess) and 
depends on it, but AFAICS it is not loaded when the requested firmware 
is missing, so there is no need to unload it. Is it expected that the 
behaviour is different with hardware using iwlmvm ?




Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-13 Thread Cyril Brulebois
Carsten Schoenert  (2023-12-13):
> The "trick" is to unload the iwlmvm module instead and load afterwards
> the module iwlwifi again.

See the very bottom of check-missing-firmware.sh (hw-detect repository),
the loop over $modules. You could try intercepting $module = iwlwifi,
and adding a modprobe -r theotherone beforehand.


Cheers,
-- 
Cyril Brulebois (k...@debian.org)
D-I release manager -- Release team member -- Freelance Consultant


signature.asc
Description: PGP signature


Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2023-12-13 Thread Carsten Schoenert
Hi,

Am Thu, Mar 03, 2022 at 10:04:55AM +0700 schrieb Arnaud Rebillout:
> A Kali Linux user reported a fail install on a Dell XPS 9510. For the
> background, the Kali Linux installer is a super lightweight fork of the
> Debian installer, kept in sync with Debian.

I experience the same issue with a shiny new Lenovo Thinkpad X1 Carbon
X11 using the net-installer from 2023-12-07.
This model is using a Intel Wi-Fi® 6E AX211, 802.11ax 2x2 Wi-Fi +
Bluetooth 5.3 hardware.

The full specs is availabe here:

https://psref.lenovo.com/syspool/Sys/PDF/ThinkPad/ThinkPad_X1_Carbon_Gen_11/ThinkPad_X1_Carbon_Gen_11_Spec.pdf

...
> The reason I'm opening this bug against Debian is because, while looking
> at the logs, a few lines caught my eyes. This is in the screenshot #3 in
> the imgur.com link above:
> 
>   check-missing-firmware: removing-and-loading kernel module iwlwifi
>   check-missing-firmware: modprobe: FATAL: Module iwlwifi is in use.
> 
> I wonder if those lines are harmless, or if it really indicates that the
> iwlwifi module can't be reloaded, therefore the wifi is not functional.
> Since someone documented on the Debian wiki that the firmware-iwlwifi is
> needed, and then the WiFi works, it seems that either those lines are
> harmless, or the iwlwifi is not always successfully reloaded.

No, these lines of course not harmless as they indicate that the iwlwifi
module couldn't be removed as the module is still in use. This happens
as this modul has dependencies as it's used by iwlmvm.

# lsmod | grep iwl
iwlmvm  589824  0
mac80211   1392640  1 iwlmvm
iwlwifi 544768  1 iwlmvm
cfg80211   1343488  3 iwlmvm,iwlwifi,mac80211
rfkill   40960  2 iwlmvm,cfg80211

The "trick" is to unload the iwlmvm module instead and load afterwards
the module iwlwifi again.

Doing so I was able to bring up a WLAN based interface on my X1 G11
after I provided the required firmware files for this chipset within the
installer was running.

I basically understand whats going on in check-missing-firmware.sh, I'm
not able to come up with a patch, if someone has some lines of code
where I can start with to dig deeper into I'm willing to work on this.

My guess is that once the needed firmware for the AX211 chipset is
included in the net-installer images the issue I currently see will not
be happen anymore. But in fact more users in the future will see this
issue as the unloading and new loading of the modules needs to be
handled differently to the current implementation.

Note: The needed firmware files for the X1 G11 are available by the
release of upstream linux-firmware 2023 

Regards
Carsten



Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)

2022-03-02 Thread Arnaud Rebillout
Source: hw-detect
Version: 1.147
Severity: normal
User: de...@kali.org
Usertags: origin-kali

Dear Maintainer,

A Kali Linux user reported a fail install on a Dell XPS 9510. For the
background, the Kali Linux installer is a super lightweight fork of the
Debian installer, kept in sync with Debian.

For additional references:

* The bug report against Kali Linux is at:
  https://gitlab.com/kalilinux/build-scripts/live-build-config/-/issues/47

* The user provided screenshots of the installer logs, available at:
  https://imgur.com/a/QMDMWug. The 3 first screenshots are with an
  unmodified installer, while for the later screenshots, the user
  disabled /bin/check-missing-firmware with a 'exit 0'.

* The Debian installer is expected to work with this particular model of
  laptop: https://wiki.debian.org/InstallingDebianOn/Dell/Dell_XPS_15_9510

I don't want to discuss the bug reported in Kali here, that is not the
intent.

The reason I'm opening this bug against Debian is because, while looking
at the logs, a few lines caught my eyes. This is in the screenshot #3 in
the imgur.com link above:

  check-missing-firmware: removing-and-loading kernel module iwlwifi
  check-missing-firmware: modprobe: FATAL: Module iwlwifi is in use.

I wonder if those lines are harmless, or if it really indicates that the
iwlwifi module can't be reloaded, therefore the wifi is not functional.
Since someone documented on the Debian wiki that the firmware-iwlwifi is
needed, and then the WiFi works, it seems that either those lines are
harmless, or the iwlwifi is not always successfully reloaded.

Thanks!

  Arnaud