Whenever I have to troubleshoot "wifi is not working", "video is not working" etc. problems in linux I really do not understand how to do it correctly. My approach is messy: try
lspci, look into
dmesg, look into some logs, google and hopefully you'll find the solution. What I really want is to understand what is going on and to be able to trace the whole path and find out when exactly something's going wrong.
Let's say wifi is broken.
lspci to find out what kind of network card is in my computer. Usually I can see something related to wifi in
lspci's output. This "something" includes the name and model of my card. But how does it work? Does this command list only the devices previously successfully discovered by something else (udev may be?) Where does it take the name/description of the device? Is it stored somewhere inside the hardware? Is it possible that
lspci would not report my piece of hardware if something went wrong on previous steps?
Now I need to understand if appropriate kernel module is present for my hardware. What I do is I go into kernel sources, run
make menuconfig and search for the name of my hardware. Does it mean that the kernel must know about all the network card models on Earth? This seems strange because there are way too many of such models. I guess all the network cards should have similar interfaces, what is so different between them that makes it necessary to have different modules for different types of cards?
Is there a better way to find out suitable kernel model for my card? What should I do if even after the module I found is compiled and installed the card still does not work? How can I make sure the module is correct (that would mean that the problem happens on some later stages)?
Now I run
iwconfig. These commands display network interfaces. If I see the wifi interface in the result, does it mean that the kernel successfully detected the hardware and created the interface so that other programs can use it now? Does it mean that the problem now is more high-level (such as wrong password or smthn like that)?
Can contents of
/dev/ directory help me somehow to understand what is going wrong (or make sure that something is definitely going right)?
Sorry if this question looks messy, it reflects the mess in my head. Please help me to get rid of this mess.