# [SOLVED] iwlwifi loads firmware 60 secs after boot (btrfs)

## shouya

Hello,

I installed gentoo and compiled kernel from ck-sources. All goes well except that wifi does not work as expect.

The problems shows as, the wifi interface doesn't load the firmware when the system boots. Therefore the network interface aren't set up, and services related to the network, such as wicd and ntp-client, can't operate normally. However, strangely the firmware were loaded usually about 60 secs after booting, then the interface was created and all comes okay.

This can be shown from dmesg:

```

Ξ ~ → dmesg | grep -C 2 iwl

[    5.152598] Intel(R) Wireless WiFi driver for Linux, in-tree:d

[    5.152601] Copyright(c) 2003- 2014 Intel Corporation

[    5.152626] iwlwifi 0000:03:00.0: enabling device (0000 -> 0002)

[    5.152721] iwlwifi 0000:03:00.0: irq 48 for MSI/MSI-X

[    5.154062] iwlwifi 0000:03:00.0: Direct firmware load failed with error -2

[    5.154065] iwlwifi 0000:03:00.0: Falling back to user helper

[    5.157891] Too many HDMI devices

[    5.157894] Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y

--

[    8.234317] cc1 (2561) used greatest stack depth: 3208 bytes left

[   44.541013] traps: notification-da[3236] trap int3 ip:7f5b7525f1fe sp:7fffd7df0510 error:0

[   65.212633] iwlwifi 0000:03:00.0: loaded firmware version 22.24.8.0 op_mode iwlmvm

[   65.215154] iwlwifi 0000:03:00.0: Detected Intel(R) Wireless N 7260, REV=0x144

[   65.215200] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   65.215418] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   65.408013] cfg80211: Ignoring regulatory request set by core since the driver uses its own custom regulatory domain

[   65.408119] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'

[   65.420020] systemd-udevd[3520]: renamed network interface wlan0 to wlp3s0

[  112.203917] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  112.204145] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  112.215670] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready

[  117.360344] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  117.360578] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  117.372369] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready

[  117.393067] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  117.393289] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[  117.404317] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready

[  120.200726] wlp3s0: authenticate with 60:a4:4c:66:7e:d4

```

Related kernel config:

```

Ξ ~ → cat /usr/src/linux-3.14.4-ck/.config | grep -i iwl

CONFIG_IWLWIFI=m

# CONFIG_IWLDVM is not set

CONFIG_IWLMVM=m

CONFIG_IWLWIFI_OPMODE_MODULAR=y

CONFIG_IWLWIFI_DEBUG=y

CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE=y

CONFIG_IWLWIFI_DEVICE_TRACING=y

# CONFIG_IWL4965 is not set

# CONFIG_IWL3945 is not set

```

Besides, I have the 'sys-kernel/linux-firmware-20140902' installed and which provided the firmware for iwlwifi.

Other info:

```

shou@sy-laptop ~ $ uname -a

Linux sy-laptop 3.14.4-ck #19 SMP Tue Oct 14 06:20:00 CST 2014 x86_64 Intel(R) Core(TM) i7-4760HQ CPU @ 2.10GHz GenuineIntel GNU/Linux

shou@sy-laptop ~ $ lspci -k

00:00.0 Host bridge [0600]: Intel Corporation Crystal Well DRAM Controller [8086:0d04] (rev 08)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

00:02.0 VGA compatible controller [0300]: Intel Corporation Crystal Well Integrated Graphics Controller [8086:0d26] (rev 08)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: i915

00:03.0 Audio device [0403]: Intel Corporation Crystal Well HD Audio Controller [8086:0d0c] (rev 08)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: snd_hda_intel

   Kernel modules: snd_hda_intel

00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: xhci_hcd

00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: mei_me

00:19.0 Ethernet controller [0200]: Intel Corporation Ethernet Connection I217-V [8086:153b] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: e1000e

00:1a.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 [8086:8c2d] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: ehci-pci

00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: snd_hda_intel

   Kernel modules: snd_hda_intel

00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5)

   Kernel driver in use: pcieport

00:1c.1 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #2 [8086:8c12] (rev d5)

   Kernel driver in use: pcieport

00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d5)

   Kernel driver in use: pcieport

00:1d.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 [8086:8c26] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: ehci-pci

00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller [8086:8c4b] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: lpc_ich

00:1f.2 SATA controller [0106]: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [8086:8c03] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: ahci

00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader [10ec:5229] (rev 01)

   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]

   Kernel driver in use: rtsx_pci

03:00.0 Network controller [0280]: Intel Corporation Wireless 7260 [8086:08b1] (rev 73)

   Subsystem: Intel Corporation Wireless-N 7260 [8086:4062]

   Kernel driver in use: iwlwifi

   Kernel modules: iwlwifi

shou@sy-laptop ~ $ cat /etc/conf.d/modules | grep -v '^#'

modules="iwlwifi snd_hda_intel"

module_iwlwifi_args="11n_disable=1 bt_coex_active=0 debug=0 fw_restart=0 led_mode=3 power_level=5 power_save=1 swcrypto=1 wd_disable=1"

```

Just reminded, it was the first time I use btrfs as root fs, will that be the factor? My /etc/fstab (truncated):

```
/dev/sdb2          /                 btrfs   noatime,nodiratime,subvol=SVroot,ssd   0 1

/dev/sdb2        /home       btrfs   noatime,nodiratime,subvol=SVhome,ssd   0 1

/dev/sdb1        /boot       vfat    noauto,noatime,auto   0 0

```

I want to have the firmware loaded correctly just after the iwlwifi module is loaded, how can I achieve this? Thanks  :Smile: Last edited by shouya on Tue Oct 14, 2014 6:09 pm; edited 2 times in total

----------

## DawgG

if you are certain that that is the reason try to compile the firmware-file directly into the kernel as a binary blob or use an initrd with everything inside it.

In the kernel menuconfig:

```
Device Drivers

  ->Generic Driver Options

    -> External firmware blobs to build into the kernel binary (put sth. here)

      ->Firmware blobs root dir (it only appears after you put sth. in the line above this)

```

Or you could change the order of the initscripts.

GOOD LUCK!

----------

## shouya

 *DawgG wrote:*   

> if you are certain that that is the reason try to compile the firmware-file directly into the kernel as a binary blob or use an initrd with everything inside it.
> 
> In the kernel menuconfig:
> 
> ```
> ...

 

Thank you for your ardent answer DawgG!

I have tried compile the firmware built-in but it doesn't help very much. I guess there wasn't the problem of *locating* the firmware but *what time* to load it.

Will changing the order of initscripts help? It seems that the OS boot within 15 secs while the wifi works at about 50 secs later. I think the event that activate the wifi might be triggered by a delayed run script or something, but I don't know how to figure that script out.

----------

## DawgG

it takes some (i guess too much) time for the wireless-network to initialize; first initialize the hardware, then authenticate the connection, then configure the network params; and this is done in the background so the system can continue booting. since the service net is available while the connection itself is still not up the services that depend on it start and fail.

you could change the initscripts so that the services that really depend on the network being fully available wait till it is really up (can't tell you exactly how right now but you can look here: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4 ) or the really cheap and easy hack would be just to (re)start the services that do not work correctly via 

```
/etc/local.d/NN_<SCRIPT>.start
```

 in this script you can put a condition that checks if the net is really up and only then (re)start the services.

GOOD LUCK!

----------

## shouya

Thank you DawgG! But I'm still confused on what to do. If it operates as what you said, It seems the greatest part of time were spent on hardware initialization, because before which even the network interface didn't appear. Below are the services started on boot:

```
shou@sy-laptop ~ $ rc-update -a

             bootmisc | boot                         

                devfs |                       sysinit

                dmesg |                       sysinit

                 fsck | boot                         

             hostname | boot                         

              hwclock | boot                         

              keymaps | boot                         

            killprocs |              shutdown        

    kmod-static-nodes |                       sysinit

           lm_sensors |      default                 

                local |      default                 

           localmount | boot                         

             loopback | boot                         

              modules | boot                         

             mount-ro |              shutdown        

                 mtab | boot                         

             netmount |      default                 

           ntp-client |      default                 

       postgresql-9.4 |      default                 

               procfs | boot                         

                  psd |      default                 

                redis |      default                 

                 root | boot                         

            savecache |              shutdown        

                 sshd |      default                 

                 swap | boot                         

            swapfiles | boot                         

               sysctl | boot                         

                sysfs |                       sysinit

            syslog-ng |      default                 

         termencoding | boot                         

         tmpfiles.dev |                       sysinit

       tmpfiles.setup | boot                         

                 udev |                       sysinit

              urandom | boot                         

           vixie-cron |      default                 

                 wicd |      default                 

                  xdm |      default                 

```

I don't have any scripts about network in `/etc/local.d`.

What should I do in this case? Thanks again!

Besides, I have a windows installed along with the gentoo on the laptop. Windows does not have such problem of wifi slow starting. So I guess it may just be somewhere configured wrongly.

----------

## shouya

Miraculously it just worked! I don't know what happened! The kernel was that one which has the firmware blob built in and I guess that's the cause. However, then it comes strange why the previous trial didn't success.

Below is my guess on what caused the problem, just provide an idea for those who encounter the same problem as me: my root filesystem was btrfs, and this module was loaded during the booting. The kernel loads the modules during the same while, and the module then look for firmwares. However, the firmware files were placed at `/lib/xxx`, which was not available until the file system is mounted. So the module won't be able to find that file during boot, and after a few amount of time the kernel might try reload the failed modules, and till which the filesystem was ready and everything goes well. Therefore, the solution would be compiling the firmware in the kernel. To the reason why I have failed the first trial, I could only guess there was some mistake on the operating that didn't really updated the old kernel.

The normal (current) dmesg should somewhat look like this:

```
shou@sy-laptop ~ $ dmesg | grep iwl

[    5.376267] iwlwifi 0000:03:00.0: enabling device (0000 -> 0002)

[    5.376890] iwlwifi 0000:03:00.0: irq 48 for MSI/MSI-X

[    5.377434] iwlwifi 0000:03:00.0: loaded firmware version 22.24.8.0 op_mode iwlmvm

[    5.379854] iwlwifi 0000:03:00.0: Detected Intel(R) Wireless N 7260, REV=0x144

[    5.379901] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[    5.380123] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[    5.573507] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'

[    8.522448] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[    8.523123] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   15.049682] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   15.049940] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   15.080949] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

[   15.081175] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

```

Nonetheless the problem is solved, thanks to all! If you encounter the same problem again and looking for more detailed explanation on what I did, feel free to post reply on this thread.

----------

