Sam Hooke

Troubleshooting wifi driver crashing (part 2)

Going to attempt upgrading to a more recent iwlwifi firmware version to see if that fixes my wifi issues. Using the Debian testing distribution instead of stable allows me to upgrade from iwlwifi -22 to -29:

$ sudo apt install firmware-iwlwifi -t testing
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  firmware-iwlwifi
1 upgraded, 0 newly installed, 0 to remove and 1378 not upgraded.
Need to get 5,027 kB of archives.
After this operation, 6,874 kB disk space will be freed.
Get:1 http://ftp.uk.debian.org/debian testing/non-free amd64 firmware-iwlwifi all 20180825+dfsg-1 [5,027 kB]
Fetched 5,027 kB in 0s (5,630 kB/s)           
Reading changelogs... Done
(Reading database ... 145072 files and directories currently installed.)
Preparing to unpack .../firmware-iwlwifi_20180825+dfsg-1_all.deb ...
Unpacking firmware-iwlwifi (20180825+dfsg-1) over (20161130-3) ...
Setting up firmware-iwlwifi (20180825+dfsg-1) ...
$ ls -al /lib/firmware | grep 7265
-rw-r--r--  1 root root 1180412 Aug 29 21:14 iwlwifi-7265-17.ucode
-rw-r--r--  1 root root  697828 Aug 29 21:14 iwlwifi-7265-9.ucode
-rw-r--r--  1 root root 1028376 Aug 29 21:14 iwlwifi-7265D-22.ucode
-rw-r--r--  1 root root 1036432 Aug 29 21:14 iwlwifi-7265D-29.ucode

Even though the above shows that the new firmware is installed, it does not appear to be being used, even after a reboot:

$ sudo modinfo iwlwifi | grep "\-26"
firmware:       iwlwifi-7265D-26.ucode
firmware:       iwlwifi-3168-26.ucode
firmware:       iwlwifi-8265-26.ucode
firmware:       iwlwifi-8000C-26.ucode
firmware:       iwlwifi-9000-pu-a0-lc-a0--26.ucode
firmware:       iwlwifi-9260-th-a0-jf-a0--26.ucode
firmware:       iwlwifi-9000-pu-a0-jf-a0--26.ucode
firmware:       iwlwifi-Qu-a0-jf-b0--26.ucode
sam@cpe1704tks:~$ sudo modinfo iwlwifi | grep "\-29"

(Note how grepping for -26 finds a firmware, but -29 returns nothing).

Also note how dmesg shows that the kernel starts searching at 26 and counts down, even though 29 is present in /lib/firmware:

$ sudo dmesg | grep 7265D
[    2.560711] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-26.ucode (-2)
[    2.560809] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-26.ucode failed with error -2
[    2.560838] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-25.ucode (-2)
[    2.560926] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-25.ucode failed with error -2
[    2.560949] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-24.ucode (-2)
[    2.561034] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-24.ucode failed with error -2
[    2.561056] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-23.ucode (-2)
[    2.561134] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-23.ucode failed with error -2
[    2.598990] iwlwifi 0000:02:00.0: firmware: direct-loading firmware iwlwifi-7265D-22.ucode

This behaviour is perhaps because the iwlwifi driver chooses which firmware to load based upon the kernel version.

My kernel version is 4.9.0:

$ uname -r
4.9.0-8-amd64

My wifi chipset is a 7265D. The last version of iwlwifi to support the 7265D is v29. A 7265D device can be distringuished from a plain old 7265 (without D) in dmesg by the presence of 0x210 in this line:

Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210

Going to manually install.

First download the drivers from the website. I chose iwlwifi-7265-ucode-16.242414.0.tgz because it is for kernels v4.3+ (mine is v4.9.0) and it is compatible with the 7265 chipset (no mention of 7265D, but hopefully this is the right one).

Then remove the iwlwifi driver installed through apt:

$ sudo apt remove firmware-iwlwifi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  firmware-iwlwifi
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 39.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 145066 files and directories currently installed.)
Removing firmware-iwlwifi (20180825+dfsg-1) ...

Extracting the .tgz file reveals it does contain the 7265D firmware, and a rather helpful README file!

$ ls -l
total 2524
-rw-rw-r-- 1 sam sam 1180356 Dec 23  2015 iwlwifi-7265-16.ucode
-rw-rw-r-- 1 sam sam 1384500 Dec 23  2015 iwlwifi-7265D-16.ucode
-rw-r--r-- 1 sam sam    2041 Dec 29  2013 LICENSE.iwlwifi-7265-ucode
-rw-r--r-- 1 sam sam    4899 Dec 23  2015 README.iwlwifi-7265-ucode

Following the instructions I install the firmware manually:

$ sudo cp iwlwifi-7265D-16.ucode /lib/firmware/

Now let’s reboot and see if I am now using -16


The kernel only searched from -26 to -22 so I am now without wifi again. I must have chosen the wrong version.

As a hack, let’s try seeing what happens if we trick it into loading the -16 firmware:

$ cd /lib/firmware
sudo mv iwlwifi-7265D-16.ucode iwlwifi-7265D-26.ucode 

And now let’s reboot again…


Perhaps no surprise, it did not like the hack:

[    2.322343] iwlwifi 0000:02:00.0: firmware: direct-loading firmware iwlwifi-7265D-26.ucode
[    2.322364] iwlwifi 0000:02:00.0: Driver unable to support your firmware API. Driver supports v26, firmware is v16.
[    2.322595] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-25.ucode (-2)
[    2.322685] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-25.ucode failed with error -2
[    2.322709] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-24.ucode (-2)
[    2.322795] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-24.ucode failed with error -2
[    2.322823] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-23.ucode (-2)
[    2.322906] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-23.ucode failed with error -2
[    2.322929] iwlwifi 0000:02:00.0: firmware: failed to load iwlwifi-7265D-22.ucode (-2)
[    2.323012] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-22.ucode failed with error -2

Dodgy wifi is better than no wifi, so let’s reinstall the old firmware which has the issue. Fortunately aptitude has a local cache so I can reinstall firmware-iwlwifi without any internet:

sudo apt install firmware-iwlwifi

Now let’s try a different approach. We’ll change the iwlwifi configuration a bit, specifically to disable power saving amongst other things:

$ cat /etc/modprobe.d/iwlwifi.conf 
options iwlwifi bt_coex_active=0 swcrypto=0 11n_disable=8 power_save=0

Let’s leave it at that for now and see if it helps.