# iwn can't load firmware



## MisterStupid (Jan 16, 2017)

Hi, how are you ?

I've installed FreeBSD 11 on my thinkpad t420 yesterday, and when I boot it I have this popping in a loop :

```
iwn6000g2afw: could not load firmware image, error 2
iwn0: iwn_read_firmware: could not read firmware iwn6000g2afw
iwn0: iwn_init_locked: could not read firmware, error 22
iwn: scan timeout
```

So I've been looking around and I figured I should do something along those lines :

```
root@t420:~ # ifconfig wlan0 create wlandev iwn0
root@t420:~ # ifconfig wlan0 up scan
```
But it says that "create" is a "bad command", so I'm stuck.

So I don't know what to do cause I can't install pkg, can't install anything, even Ethernet doesn't work. I've read that maybe I should edit something in the kernel config but I don't even know how to find that, and even if I did I don't seem to have an editor to do any kind of change anywhere.

Maybe you can help me ?

Sorry for the typo in the title : firmware*


----------



## SirDice (Jan 16, 2017)

```
iwn%d: could not load firmware image '%s'  The driver failed to load the
     firmware image using the firmware(9) subsystem.  Verify the iwnfw(4)
     firmware module is present.
```

Does `kldstat` show iwnfw(4)?


----------



## MisterStupid (Jan 16, 2017)

Thanks for your quick answer ; no it doesn't seem so, it only shows "kernel", "zfs.ko", and "opensolaris.ko".
That's what I was referring to when I said I might have to modify something about the kernel config, cause there : 
https://www.freebsd.org/cgi/man.cgi?query=iwnfw&sektion=4&apropos=0&manpath=FreeBSD+9.1-RELEASE
it says to compile the module into the kernel, couldn't figure out how.


----------



## SirDice (Jan 16, 2017)

Please look at the man pages for FreeBSD 11. Not from an old and unsupported version.


```
[b]Alternatively, to load the driver as a module at boot time[/b], place the
     following line in loader.conf(5):

	   iwn1000fw_load="YES"
	   iwn100fw_load="YES"
	   iwn105fw_load="YES"
	   iwn135fw_load="YES"
	   iwn2000fw_load="YES"
	   iwn2030fw_load="YES"
	   iwn4965fw_load="YES"
	   iwn5000fw_load="YES"
	   iwn5150fw_load="YES"
	   iwn6000fw_load="YES"
	   iwn6000g2afw_load="YES"
	   iwn6000g2bfw_load="YES"
	   iwn6050fw_load="YES"
```


----------



## MisterStupid (Jan 16, 2017)

Yes I came across that too, but I didn't figure out how to edit loader.conf(5) (which I couldn't even locate to be honest ......), is there an integrated text editor ? Or am I looking in the wrong direction ?


----------



## SirDice (Jan 16, 2017)

Use vi(1) or ee(1) to edit files. And the file is /boot/loader.conf.


----------



## MisterStupid (Jan 16, 2017)

When I try to save the file, it says there is no such file or directory, although I thought even if it didn't exist then vi would create it ?


----------



## SirDice (Jan 16, 2017)

Make sure you do this as root.


----------



## MisterStupid (Jan 16, 2017)

I'm automatically logged in as root, and for security I typed "su -" (it didn't ask me a password), still can't edit/create the file with vi


----------



## tingo (Jan 17, 2017)

Sure you can; to edit (or create) a file in vi, simply do `# vi /boot/loader.conf`, or `vi ~/somedir/somefile.txt`, you get the idea. Hint: it is a good idea to learn a few basic vi commands before doing this, since vi isn't the same as any common editor you might have used these days.


----------



## MisterStupid (Jan 17, 2017)

Yes I have quite some experience with vim, and I did just that, but when I try to save it with :w, it says that there is no /boot/loader.conf, so it didn't create it


----------



## ASX (Jan 17, 2017)

By any chance, is this a 32bit ZFS install ?  (there was an issue about mounting the boot pool ...)


----------



## MisterStupid (Jan 17, 2017)

Okay so I figured the /boot/ directory didn't exist. 
"ls -l /boot" would return something, but "ls -l /boot/" would not (notice the / after "boot"), so I issued "mkdir /boot/" and created loader.conf in it : http://u.nya.is/pbomtk.jpg
I rebooted and I still get the same errors popping in a loop ... do I need to give it some permissions ?

ASX : it is a ZFS install, I followed that guide to install it : https://www.banym.de/freebsd/install-freebsd-11-on-thinkpad-t420
But it should be 64 bits, since I used this image : FreeBSD-11.0-STABLE-amd64-20170105-r311441-memstick.img


----------



## ASX (Jan 17, 2017)

MisterStupid said:


> Okay so I figured the /boot/ directory didn't exist.
> "ls -l /boot" would return something, but "ls -l /boot/" would not (notice the / after "boot"), so I issued "mkdir /boot/"



That's odd, considering that /boot contain the kernel itself, something your system can't do without.
Most likely explanation is that you used a separate /boot filesystem, but for some reason is not mounted.

try:

```
zpool list
zfs list
```


----------



## MisterStupid (Jan 17, 2017)

zpool returns this : https://u.nya.is/vjgovz.jpg
zfs returns that : https://u.nya.is/uzurqq.jpg


----------



## ASX (Jan 17, 2017)

Your pool layout look fine, there is no separate /boot.


MisterStupid said:


> "ls -l /boot" would return *something*, but "ls -l /boot/" would not


what was that "something" ?

EDIT: also, what return:

```
zpool import
```


----------



## MisterStupid (Jan 17, 2017)

ls -l /boot returns

```
lrwxr-xr-x 1 root wheel 13 Sep 29 03:47 /boot -> bootpool/boot
```
zpool import returns : https://u.nya.is/midlwp.jpg


----------



## ASX (Jan 17, 2017)

bingo!

now, remove the content of /boot, i.e. the newly created /boot/loader.conf, after that do:

```
zpool import bootpool
ls -l /boot
```

If that doesn't work, use:

```
zpool import -f bootpool
ls -l /boot
```


----------



## MisterStupid (Jan 17, 2017)

Ah thanks !
So now "ls -l /boot" still returns the same line, but "ls -l /boot/" returns a whole load of files, including loader.conf, which contains the following :

```
vfs.root.mountfrom"zfs:zroot/root/DEFAULT"
kern.geom.label.disk_indent.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
```
Should I add the lines that SirDice told me to add ?

The error has disappeared, and now I have

```
iwn0: iwn_scan: called whilst scanning!
```
in loop.

I tried to install pkg by issuing pkg update, it says there was an error fetching it because "No address record". A pre-built version could not be found on my system.


----------



## ASX (Jan 17, 2017)

I realize that I asked the wrong question about "32 bit ZFS install", instead of "MBR based ZFS install".

About the iwn firmware, after the bootpool is imported, the firmware probably is loaded automatically, pulled in from the iwn.ko module, so no need to add it to loader.conf.

"No address record" means you don't have an active connection or that the dns is not setup properly.


----------



## ASX (Jan 17, 2017)

MisterStupid said:


> The error has disappeared, and now I have
> 
> ```
> iwn0: iwn_scan: called whilst scanning!
> ...



always post the relevant commands and the results, that will make easier to understand what's going on.


----------



## MisterStupid (Jan 17, 2017)

My DNS is probably not set up correctly because in the Network Configuration tool I didn't know what to put in the field "Search", cause I don't really have a domain name. Also I have nothing to put in DNS #2 but I've read that that's not a problem.
https://u.nya.is/dpwdup.jpg


----------



## ASX (Jan 17, 2017)

Are you sure your connection is up ?
can you ping some external IP address, say:

```
ping 8.8.8.8
```


----------



## MisterStupid (Jan 17, 2017)

I think it's not, it says 
	
	



```
ping: sendto: No route to host
```

EDIT : just realized ... when I reboot I have to do "zpool import -f bootpool" again, cause I get the errors from the beginning.


----------



## ASX (Jan 17, 2017)

are you trying to connect through your iwn NIC ?

if so, you need to add to /etc/rc.conf:

```
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
```

and
in /etc/wpa_supplicant.conf:

```
network={
           ssid="YOUR-SSID"
            psk="YOUR-KEY"
}
```

when done, type:

```
service netif restart
```


----------



## MisterStupid (Jan 17, 2017)

Yep, this is already there with priority 5
.........
but 

```
service netif restart
```
did it, thanks a lot ASX ! I just installed pkg, you're a prince !


----------



## ASX (Jan 17, 2017)

You are welcome, have fun!


----------



## Birdy (Jul 4, 2017)

Hi,


ASX said:


> ... do:
> 
> ```
> zpool import bootpool
> ```



Is this to put in /boot/loader.rc?

EDIT: See here and here for how to proceed.


----------

