# lspci displays my wifi card, but ifconfig does not

## m_p_w

basically I am trying to set up the wpa_supplicant, but it cannot find a wireless interface.

Furthermore, the ifconfig does not find my wifi card, but lspci does. What am I doing wrong? 

Additionally the kernel is configured as it is mentioned in the gentoo handbook/wiki when it comes to wifi

----------

## NeddySeagoon

m_p_w,

```
ifconfig
```

 only shows interfaces that are up.

```
ifconfig -a
```

 shows all interfaces known to the kernel.

Which invocation are you using?

If the interface is not known to the kernel, its driver and possibly its firmware are not loaded.

Maybe you did make the kernel correctly and then messed up the install?

Look at the date/time in 

```
uname -a
```

Thats the build date and time of the running kernel.

----------

## m_p_w

I did 

```
ifconfig -a
```

 and it appears that the kernel does not recognize the wifi's driver.

The kernel's menu shows that driver for my wifi's card is set up to <M> and the setting which are mentioned in gentoo.wiki/wifi are also set up in my kernel.

Additionally I did install the latest firmware with the command 

```
emerge --ask sys-kernel/linux-firmware
```

and uname-a shows the date when I installed the system.

Do you have idea what I am doing wrong?

----------

## Anon-E-moose

what card? What does lspci say it is?

----------

## m_p_w

it is Qualcomm Atheros QCA9565 / AR9565, From my experience this card works very well on debian-distro family.

----------

## NeddySeagoon

m_p_w,

When you install a new kernel, you need to mount /boot.

Look in /boot with it both unmounted and mounted.  

If you don't have a separate boot, you can't have this problem.

When your kernel changes version, you need to tell the boot loader about it, or it will always load the old kernel.

What is the output of 

```
uname -a
```

What is the output of 

```
ls -l /usr/src/linux/x86/boot/bzImage
```

The first tells about the running kernel, the latter about the most recently built kernel, as long as your /usr/src/linux/ symlink is up to date.

----------

## m_p_w

I am not sure if it makes any difference on gentoo, but normally when I install debian or other distro based on debian, I do not create seperate /boot partition, and the same I did when I was installing gentoo.

The output of 

```
uname -a
```

 is 4.14.61-gentoo

when I type 

```
ls -l /usr/src/linux/x86/boot/bzImag
```

 I get that this directory does not exist, also I looked into it and I do not have directory x86 at all in /usr/src/linux/

----------

## NeddySeagoon

m_p_w,

I wanted all of 

```
uname -a
```

In particular, the time and date. 

I messed up the kernel binary build location. I missed the /arch/ part.

```
ls -l /usr/src/linux/arch/x86/boot/bzImage
```

The idea is to compare the time stamps.

A separate /boot is not required.  It narrows the problem space if you don't have one.

Can you put your /boot/grub/grub.cfg onto a pastebin site please?

Post 

```
ls -l /boot
```

 too.

----------

## m_p_w

```
uname -a
```

https://pastebin.com/FtRzFwbN

```
ls -l /boot
```

https://pastebin.com/STfbxZFA

/boot/grub/grub.cfg 

https://pastebin.com/EJ3vLqE0

```
ls -l /usr/src/linux/arch/x86/boot/bzImage
```

I do not have bzImage in /usr/src/linux/arch/x86/boot/

----------

## NeddySeagoon

m_p_w,

The good news is that your system is self consistent.

You only have a single kernel in /boot and in grub.cfg.

That you don't have a /usr/src/linux/arch/x86/boot/bzImage file suggests that the kernel build failed.

The file /boot/initramfs-genkernel-x86_64-4.14.61-gentoo tells that you use genkernel.

genkernel runs 

```
make clean
```

at the start, which will remove all the binaries in the kernel tree, including bzImage, which is created at the end of the kernel build.

In /boot, its vmlinuz-4.14.61-gentoo.

Have you updated the kernel since 

```
Wed Aug 15 07:03:22 CEST 2018
```

If so, the kernel failed to build.

----------

## m_p_w

is it possible to rebuild the kernel?

----------

## NeddySeagoon

m_p_w,

Yes and you should do it once every x release in 4.x.y to keep up with security updates and if you have new hardware, performance improvements.

The process is the same as building the kernel the first time.

As you are a genkernel user, run 

```
genkernel --menuconfig all
```

When you are dropped into the kernel menu system, make the changes to support your wifi.

Exit when you are finished and genkernel will build and install your new kernel.

If the build fails put the log onto a pastebin site.

If you are rebuilding 4.14.61 you are done. The new kernel will overwrite the old kernel.

If you build a different version you must update grub.cfg, so grub knows about it.

When this happens, you will get another kernel in the boot menu. Take care to choose the new one at boot time.

Its a good idea to have at least two kernels. Everyone builds a kernel that won't boot from time to time.

Its convenient to use the grub menu to have another go.

----------

## m_p_w

ok I compiled kernel, but still config -a does not display my wifi  :Sad: 

However, now lspci displays kernel module for the wifi card, but then by my understanding all drivers are modules, but not all modules are drivers :/

Do you know why the kernel driver is not being used?

----------

## Anon-E-moose

is the kernel module loaded, ie does "lsmod" show the module?

what does "dmesg|grep <module name>" show (use whatever the module is called  for the grep part)

----------

## NeddySeagoon

m_p_w,

Please put all of dmesg from booting your own kernel onto a pastebin site,

It sounds like your wifi may need firmware which is not being found.

----------

## m_p_w

the output of dmesg

https://pastebin.com/GM6yVW2U

when I run dmesg|grep ath9k then nothing is shown

----------

## NeddySeagoon

m_p_w,

All those 

```
version magic '4.14.61-gentoo SMP mod_unload modversions ' should be '4.14.61-gentoo SMP mod_unload
```

mean that something went wrong with your kernel build and install.

Some parts are compiled with modversions and some are not. The mix makes the parts incompatible.

This can happen if your clock takes a step back because make is lazy.

make looks at the timestamp of an output file, if its newer that all the input files, make does nothing. That usually saves time.

Have you seen any warnings about clock skew?

Are you using NTP to set your system time at boot?

Save your .config file out of the way. Its at /usr/src/linux/.config

```
cd /usr/src/linux/

make mrproper
```

That last step restores the kernel to its state as it was when it came out of the tarball.

Put the .config file back.

Now rebuild and reinstall your kernel.

The make mrproper step will force make to rebuild everything so its self consistent.

----------

## m_p_w

I am not using ntp, and I have not seen any warnings about clock skew

----------

## Anon-E-moose

 *m_p_w wrote:*   

> I am not using ntp, and I have not seen any warnings about clock skew

 

Still worthwhile to clean it proper and rebuild it all.

If I make minor changes, I just do a make and let it rebuild the few things needed,

but if I make major changes, I like to clean it and rebuild it all.

Judging by the messages, something is out of whack.

----------

## Jaglover

'clean' and 'proper' are make targets alright, 'make clean' removes all compiled parts and lets you start clean, 'make proper' restores your sources into pristine state, also removing your precious .config file.

----------

## NeddySeagoon

Jaglover,

The .config is not that precious to genkernel users.

----------

## m_p_w

w8 a sec when I am building the kernel I get a message 

>> Not installing firmware as requested by configuration FIRMWARE_INSTALL=no...

https://pastebin.com/Ygc6Jp2j

I think this is the reason why the driver is not used, what do you think?

----------

## Anon-E-moose

I don't install firmware when I compile my kernel, especially on those things that I compile as modules, they install when loaded.

----------

## m_p_w

Then I really don't know what I am doing wrong  :Sad: 

----------

## NeddySeagoon

m_p_w,

That looks good so far. Now rewrite grub.cfg.

It should not be needed but you don't want an old initrd being used with your new kernel.

```
Not installing firmware as requested by configuration FIRMWARE_INSTALL=no...
```

is probably harmless.

Firmware is provided in two ways. Embedded in the kernel source and external to kernel firmware, in sys-kernel/linux-firmware and friends.

I think that FIRMWARE_INSTALL=no refers to firmware embedded in the kernel source and that's not where WiFi firmware is usually found.

Reboot into your new kernel and initrd using your new grub.cfg then pasetbin dmesg. 

That will show us what's going on.

----------

## m_p_w

Do you mean initrd in /usr/share/man/man4/ ?

Additionally, do you rewrite grub.cfg with the command update-grub?

----------

## NeddySeagoon

m_p_w,

The terms initrd and initramfs are used interchangeably. They both serve the same function but have different internal structures.

Genkernel will have made you a new initramfs file and put it into /boot beside the kernel.

Its kernel specific because it contains kernel modules. You must use the initramfs that matches your kernel.

Looking at your previous /boot

```
-rw-r--r-- 1 root root  116232 Aug 15 17:21 config-4.14.61-gentoo

drwxr-xr-x 6 root root    4096 Aug 15 21:15 grub

-rw-r--r-- 1 root root 1562260 Aug 15 18:04 initramfs-genkernel-x86_64-4.14.61-gentoo

-rw-r--r-- 1 root root 4293886 Aug 15 17:21 System.map-4.14.61-gentoo

-rw-r--r-- 1 root root 9404688 Aug 15 17:21 vmlinuz-4.14.61-gentoo
```

config-4.14.61-gentoo is the .config the kernel was built with.

grub is the directory where grub lives.

initramfs-genkernel-x86_64-4.14.61-gentoo is the file I have been calling the initrd.

Notice its slightly newer than the kernel. Thats because the kernel has to be made first, so the modules can be included here.

System.map-4.14.61-gentoo is a list of kernel symbols and addresses. Its used for debugging.

vmlinuz-4.14.61-gentoo is the kernel itself.

Your times and dates on those files will have changed if all is well.

To rewrite grub.cfg, you use the command 

```
grub-mkconfig -o /boot/grub/grub.cfg
```

----------

## m_p_w

Ok everything works now. Thank you very much. 

I will just write the steps which I took, so it would be easier for someone with similar problem to follow.

Specifications of my system

-Fresh Install

-wifi driver which works 10/10 out of the box on debian (in my case:- Qualcomm Atheros QCA9565 / AR9565)

step 1) 

check if this is the case for you too

```
lspci 
```

Displays your wifi card

```
ifconfig -a
```

Does not display you wifi card

```
dmesg
```

Displays bunch of errors such as

https://pastebin.com/GM6yVW2U

```
[    5.887155] crc_itu_t: version magic '4.14.61-gentoo SMP mod_unload modversions ' should be '4.14.61-gentoo SMP mod_unload '

[    5.910228] dax: version magic '4.14.61-gentoo SMP mod_unload modversions ' should be '4.14.61-gentoo SMP mod_unload '

[    5.910305] dax: version magic '4.14.61-gentoo SMP mod_unload modversions ' should be '4.14.61-gentoo SMP mod_unload '

[    5.914183] dm_bio_prison: version magic '4.14.61-gentoo SMP mod_unload modversions ' should be '4.14.61-gentoo SMP mod_unload '
```

The pastebin will be gone soon. Included a smal sample from it above. -- NeddySeagoon

Optional:- no bzImage in /usr/src/linux/arch/x86/boot/

step 2)

```
cd /usr/src/linux/ 
```

```
make mrproper
```

step 3)

```
genkernel --menuconfig all
```

step 4) 

configure kernel to make wifi work

https://wiki.gentoo.org/wiki/Wifi

step 5)

when building kernel is done

```
grub-mkconfig -o /boot/grub/grub.cfg
```

----------

