By Steven Ovadia
In this article, excerpted from Learn Linux in a Month of Lunches, I talk about how to find and fix a hardware problem on a laptop using Linux.
When something isn’t right with your system, it’s either a hardware issue, a software issue, or a combination of the two.
So if your Ubuntu laptop can’t connect to your WiFi network, and the issue isn’t with your network itself (please make sure the issue isn’t something like your router is turned off!), then you need to figure out where the problem is.
If the issue is with software, maybe it’s not configured properly. Or maybe the correct wireless software isn’t installed. If the issue is with the hardware, maybe your laptop’s wireless card is broken. Or maybe it’s not turned on.
But the most common issue, especially with a fresh Linux installation, is that your distribution is having trouble talking to your wireless card. Before we can fix it, we need to know what kind of wireless card your laptop has.
While this might be in the manual for your laptop, or on the support website for your laptop’s manufacturer, the reality is that laptops are often made up of different parts. Two of the same kind of laptop might have different wireless cards, depending on when and where they were made.
Linux gives a relatively straight-forward way to get this information. It involves a trip into the command line, which we’ll access via the terminal.
The command line is an alternative way to interact with your computer. Rather than using your mouse to click-and-open a program to give you system information, as you would with Windows, you’re going to open your terminal, which will allow you to type commands directly to your computer. You’re cutting out the graphical middle man.
To access the terminal, you’re going to click the Ubuntu icon in the top left corner of your screen. A search bar will open up and you can type the word “terminal” (see figure 1). You’ll see the word Terminal open up under Applications.
Click on the word or icon and the terminal will open up.
Figure 1 Typing the word terminal will open up a terminal in Ubuntu.
Once in the terminal, type the command
lspci -v. This command (see figure 2) will show you all of the hardware used in your system, from wireless cards to memory to graphics cards.
Figure 2 The lspci command in your terminal.
It’s not easy to read, but if you scroll through the list, you can look for words like network or 802.1, which usually denotes a wireless protocol. Reading through that section of the output, you can get the make and model of your wireless card. If you’re having problems with it, you now have a more specific way to search for solutions to your problem.
Rather than doing a search like “wireless won’t work in Ubuntu”, which will bring up a myriad of issues across models, you can now search on your wireless card, which will only pull up information that will help your particular issue.
You’ll also see a line that says Kernel driver in use. The kernel is the most basic part of your system–the thing upon which everything else is built.
But what is a driver? We’ll cover that now.
A driver is a piece of software that allows the Linux kernel to talk to your hardware. I pointed out the kernel driver line in the output of the `lspci` command. Drivers exist in all operating systems, but they’re usually installed by the hardware manufacturer. For instance, your Windows computer has these same kinds of drivers, connecting Windows to your wireless card. But the manufacturer handled the installation of the drivers.
In the case of Ubuntu, it automatically handled the installation of drivers, looking at what you have and installing what you need. But sometimes, the wrong drivers are installed, which is what causes technical issues.
Another issue with drivers is that not every hardware manufacturer makes drivers for Linux, which means the drivers sometimes need to be reverse-engineered. Companies that provide their own drivers tend to produce better results.
This is why you sometimes see people advising against things like certain graphics cards for Linux systems–if the drivers aren’t good, it’s harder for the operating system to communicate with the hardware.
In a perfect world, you have your kernel in the middle of your system, trying to communicate with the various pieces of hardware around your computer–things like the graphics cards, the wireless card, and even your computer’s motherboard.
The drivers are the bridge between the kernel and these different pieces of hardware, as this figure illustrates.
Figure 3 Drivers help the kernel communicate with your hardware.
And again, this is how ALL computers work. But with Linux, the driver issue is more transparent, which makes it easier to fix any issues that emerge. One of the nice things about Linux is that it isn’t just a way to run your computer–it also teaches about how your computer works.
If there are any issues with drivers, you already know how to see which drivers are controlling which hardware: use the
lspci -v command, which includes not only the hardware, but the driver interacting with the hardware. This is very helpful for troubleshooting in that you can research if there are known issues with certain drivers and certain pieces of hardware.
Interestingly, but perhaps unsurprisingly, Linux tends to work better with older hardware, since the driver issues have already been worked out either with the distribution or with the kernel. Newer devices are more untested and can pose more complications.
One complication with drivers is that not all of them are open source. Some drivers are contributed to the kernel by the manufacturer, but the source code remains closed, making it harder to tweak them if there’s a communication issue somewhere in the chain that’s going kernel to driver to hardware.
As a result, you’ll sometimes see reference to proprietary drivers, meaning they are closed-source and provided by the hardware manufacturer, and open-source drivers, which are either reverse engineered by developers to interact with hardware or provided by the manufacturer with the underlying code available for anyone to modify and view.
Depending upon the level of commitment to free and open source software, some users try to avoid proprietary drivers while others choose the driver that works best for their software. If your system doesn’t have the best driver installed by default, there are a few options to install the correct one.
One is to just research any issues with your current drivers and hardware. Fixing a driver is as simple as just installing the correct one. It usually takes a minute or two. The
lspci -v command gives you all of the information you need–your hardware and the driver associated with it. Then, some quick online searching should reveal the issue and the correct driver.
Most times the right driver is in the distribution’s software repository and you can go and install it from there yourself. Sometimes you need to get the correct driver from a manufacturer’s site. This is often the case with printer drivers because there are so many different kinds of printers, it’s hard for a system, Linux, OS X, or Windows, to keep track of all of the drivers.
Some distributions offer automated driver management. For instance, you can ask Ubuntu to help you with your drivers. Here’s how:
- Click the top left icon and type Software & Updates
- Then, click on the Additional Drivers tab.
This will cause Ubuntu to look at the drivers on your machine and see if there are other ones that might be better. If your system is working fine, you can ignore this area. But if you are experiencing a challenge, this is a very helpful area to explore.
Ubuntu will look at your drivers and see if there’s another one that might do the job for you. Other distributions, like Linux Mint, also have a driver management component. .Linux Mint, which is based upon Ubuntu, will also automatically check your drivers for you.
Figure 4 Linux Software and Features
Different distributions have different features.
Distributions like Ubuntu and Mint have a more automated driver management component, while others do not. Different distributions have common elements and unique elements.
To use a car metaphor, if you learned how to drive on a 1995 Honda Civic, you should have no trouble driving a 2012 BMW Series 5. They’re different cars, with different features, but conceptually they’re the same and more is similar than different. With Linux, there are always multiple ways to approach a challenge.
This is all you need to know about drivers, though. They’re like keys that unlock different pieces of hardware around your computer. Windows and OS X can handle drivers efficiently because they put their operating systems on specific hardware, so they know just which drivers to include. With Linux, you could be installing the operating system on just about any hardware, so the system needs to figure out which drivers to use.
The driver issue is serious enough that many people research hardware issues before installing Linux. This gives you a sense of potential driver challenges. The Live installation method is also good for sussing out these kinds of driver issues. If your graphics card doesn’t work in a Live session, there’s a good chance you have a driver issue.
These driver issues are obvious on Linux systems, but you also see them on Windows, in the form of mice that don’t work and displays that look a little off. Many times, you can ask Windows to check your drivers, much like Ubuntu does, or, you need to go to a vendor site and download and install the Windows driver yourself.
This is a common scenario if you’re reinstalling Windows from scratch and don’t have the installation media provided by the manufacturer.
Codecs are another technology that operate in the background with most other operating system but can become visible with Linux. Part of this is the role codecs performs–they encode and decode (hence codec – enCODe\DECode) audio and video. Most distributions install standard codecs by default. These are the codecs allowing you to do things like listen to MP3s and watch movies.
Some distributions avoid installing codecs because of international software patent issues (different countries have different patent rules). Debian used to be one such distribution but they now include a variety of multimedia codecs by default. But codecs still are not a straight-forward process with Linux.
For example, you’ll often hear about a multimedia framework called _GStreamer_. Most distributions have this installed by default. Some multimedia still won’t work, despite GStreamer being installed.
In certain cases, you’ll need to install a collection of codecs called something like gstreamer-ugly. For instance, on Ubuntu, they’re called gstreamer1.0-plugins-ugly, but on Arch, they’re called gst-plugins-ugly. Different Distributions call the codecs by slightly different names. You can install them via the package manager.
These are codecs that could present legal issues for the distribution, so the distributions make it available in a “don’t ask, don’t tell” kind of way, but don’t install them by default.
The only time you have to think about codecs is if you’re trying to do something with audio and/or visual content and it’s not working for you. If your drivers are working, then you know you just need to find the codec that will unlock the file format. Remember: drivers unlock hardware and codecs unlock audio and video. Both work in the background–until they don’t work, which is why it’s useful to have a basic understanding of what they are.