Linucate
~ Linucate_

101.1 Determine and configure hardware settings

All Levels

Introduction

This lesson is about one simple question:

How does Linux see hardware, and how do you check or change it safely?

For LPIC-1, you do not need to become a hardware engineer. You need a clear mental map:

firmware decides what is enabled -> Linux detects the device -> a driver handles it -> you inspect or tune it

If you keep that chain in mind, most exam questions become easier.

What you should be able to do after this lesson:

  • Check whether Linux can see a device.
  • Find which driver is being used.
  • Tell disks apart: SATA, NVMe, USB, HDD, SSD.
  • Read basic hardware resource information.
  • Understand what /sys, udev, and D-Bus do.
  • Reset a stuck USB device carefully.

Before you start:

  • sudo means "run as administrator".
  • <disk>, <module>, <iface>, <driver>, <path> are placeholders. Replace them with real names from your system.
  • If a command is missing, install the package that provides it. Common examples: pciutils, usbutils, util-linux.

Big Idea: How Linux uses hardware

When a device works in Linux, this usually happens:

  1. BIOS/UEFI leaves the device enabled.
  2. The kernel finds the device on a bus such as PCI or USB.
  3. A driver binds to it.
  4. The kernel gives it resources like IRQs or memory ranges.
  5. User space tools such as udev create helpful device nodes in /dev.

That is why your troubleshooting order is usually:

  1. Is the device visible?
  2. Which driver owns it?
  3. What resources did it get?
  4. Can I change behavior through modules, sysfs, or firmware?

Integrated Peripherals: Enable or Disable Them

An integrated peripheral is hardware built into the machine, for example:

  • onboard audio
  • onboard network card
  • SATA controller
  • Bluetooth adapter

There are two common places where such hardware can be enabled or disabled.

1) In firmware (BIOS/UEFI)

If the device is disabled in BIOS/UEFI, Linux usually cannot see it at all.

Typical signs:

  • it does not appear in lspci
  • it does not appear in lsusb
  • no driver binds to it

So if Linux "cannot find" a device, always consider firmware first.

2) In Linux

Linux can also effectively disable a device by not loading its driver.

Common ways:

  • remove the driver module for this session: sudo modprobe -r <module>
  • prevent it from loading automatically:
/etc/modprobe.d/blacklist.conf
blacklist <module>

To enable it again:

  • remove the blacklist line
  • load the driver again with sudo modprobe <module>

Quick verification

After enabling or disabling something, check again:

lspci -nnk
lsusb
dmesg | tail -n 30

What you are looking for:

  • does the device now appear?
  • is a driver attached?
  • did the kernel log an error or a success message?

First Tools to Learn: lspci, lsusb, lsblk

These three commands give you your first picture of the system.

lspci: internal devices on the PCI/PCIe bus

Use this for:

  • graphics cards
  • network cards
  • SATA and NVMe controllers
  • sound cards

Run:

lspci -nnk

Example output:

01:00.0 Network controller [0280]: MEDIATEK Corp. MT7921 [14c3:7961]
        Kernel driver in use: mt7921e

How to read it:

  • 01:00.0 = the device address on the PCI bus
  • [0280] = hardware class
  • [14c3:7961] = vendor and device ID
  • Kernel driver in use = the driver that currently owns the device

For the exam, lspci -nnk is one of the best commands to remember.

lsusb: USB devices

Use this for external devices such as:

  • keyboards
  • mice
  • USB network adapters
  • phones
  • flash drives

Run:

lsusb
lsusb -t

Why two commands?

  • lsusb shows the devices
  • lsusb -t shows the USB tree and the driver view

Example output from lsusb -t:

/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/5p, 480M
    |__ Port 002: Dev 002, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

How to read it:

  • root_hub = the USB controller root
  • Driver=xhci_hcd = the host controller driver
  • Driver=usbhid = the driver for the USB device
  • 480M / 1.5M = negotiated speed

Inspect one USB device in more detail:

lsusb -v -d <vendor:product>
lsusb -s <bus:dev>

lsblk: storage devices

Use this to get a quick storage overview.

Run:

lsblk -o NAME,TYPE,TRAN,ROTA,MODEL

Example output:

NAME   TYPE TRAN ROTA MODEL
sda    disk usb     0 STORAGE DEVICE

How to read it:

  • NAME = kernel device name
  • TYPE = disk or partition
  • TRAN = transport such as usb, sata, nvme
  • ROTA = 1 usually means HDD, 0 usually means SSD or flash
  • MODEL = model string from the device

This command is excellent when you need to answer:

  • Is this disk internal or external?
  • Is it likely an HDD or SSD?
  • What name should I use in later commands?

Drivers and Kernel Modules

A driver tells the kernel how to talk to hardware. Very often, the driver is loaded as a kernel module.

See loaded modules

lsmod | head -n 10

Load a module

sudo modprobe <module>

Remove a module

sudo modprobe -r <module>

This only works if the module is not busy.

See module parameters

modinfo -p <module>

Set a persistent module option

/etc/modprobe.d/<module>.conf
options <module> key=value

Blacklist a module

/etc/modprobe.d/blacklist.conf
blacklist <module>

Simple idea to remember:

  • lsmod = what is loaded now
  • modprobe = load or remove a module
  • modinfo -p = what options the module understands

Mass Storage: How to Tell Devices Apart

For LPIC, you should be comfortable with the most common storage types.

Common names in /dev

  • SATA, SCSI, and many USB disks: /dev/sdX
  • NVMe: /dev/nvme0n1
  • SD card: /dev/mmcblk0

Quick way to identify a disk

Start with:

lsblk -o NAME,TYPE,TRAN,ROTA,MODEL

Then confirm with sysfs:

cat /sys/block/<disk>/removable
cat /sys/block/<disk>/queue/rotational

Typical meaning:

  • removable=1 often means removable media
  • rotational=1 usually means HDD
  • rotational=0 usually means SSD or flash

Simple examples

  • TRAN=nvme -> NVMe SSD
  • TRAN=usb and removable=1 -> external USB device
  • TRAN=sata and rotational=1 -> likely SATA HDD

Keep in mind that virtual machines and RAID layers can hide some details.

Hardware Resources: IRQ, Memory, I/O Ports, DMA

Once Linux finds a device, it gives the device resources. You do not need deep electrical knowledge here. You just need to know where to look.

Main files

cat /proc/interrupts | head -n 10
cat /proc/iomem | head -n 10
cat /proc/ioports | head -n 10
cat /proc/dma

What these files mean

  • /proc/interrupts = IRQ lines and how active they are
  • /proc/iomem = memory ranges used by RAM and devices
  • /proc/ioports = legacy I/O port ranges
  • /proc/dma = DMA channels in use

Example

10:    1066624   IR-IO-APIC   10-edge   AMDI0010:00

How to read it:

  • 10 = IRQ number
  • the big number = how many interrupts happened
  • AMDI0010:00 = the device or driver using that IRQ

For the exam, the big takeaway is:

these /proc files show which resources Linux assigned to hardware

sysfs, udev, and D-Bus

These three names sound abstract at first, but the idea is simple.

sysfs: the kernel's live hardware view

sysfs lives under /sys. It shows devices, classes, and many settings as files.

Run:

ls /sys
ls /sys/class/net
cat /sys/class/net/<iface>/address

What to remember:

  • /sys is not a normal disk directory
  • it reflects the kernel's current view of devices

udev: creates useful device nodes in /dev

udev reacts to hardware events and creates names like:

  • /dev/sda
  • /dev/nvme0n1
  • /dev/disk/by-id/...

Run:

ls -l /dev/disk/by-id | head
udevadm info -q property -n /dev/<disk> | head

What to remember:

  • /dev is where device nodes appear
  • udev helps make hardware easier to use and identify
  • custom rules often live in /etc/udev/rules.d/

D-Bus: programs talking to each other

D-Bus is a message bus for user-space programs. In simple words: it helps services and desktop tools exchange events and requests.

You do not usually use D-Bus to "fix hardware" directly in beginner troubleshooting, but LPIC expects you to know what it is.

Run:

busctl --system list | head
ls -l /run/dbus

What to remember:

  • /sys = kernel view
  • /dev = usable device nodes
  • D-Bus = communication between user-space programs

Resetting a Stuck USB Device

Sometimes a USB device hangs but is still visible. If you know the USB path, you can unbind and bind it again.

Run:

lsusb -t
echo '<path>' | sudo tee /sys/bus/usb/drivers/usb/unbind
echo '<path>' | sudo tee /sys/bus/usb/drivers/usb/bind

<path> is the USB path from lsusb -t, for example 1-2 or 5-1.4.1.

This is useful, but be careful:

  • do not reset your only keyboard or mouse
  • do not reset a USB disk you are actively using

Practice Step by Step

1) A Wi-Fi card is not working
  1. Check whether Linux sees the device: lspci -nnk | grep -A3 -i -E "network|wireless|802\.11"
  2. Find the current driver: look for Kernel driver in use
  3. Check whether the module is loaded: lsmod | grep -i <driver>
  4. Try loading it: sudo modprobe <module>
  5. Check logs: dmesg | grep -iE "wifi|wlan|firmware|iwlwifi|ath|rtw|mt7"
2) A USB device is visible, but frozen
  1. Find its path in the tree: lsusb -t
  2. Confirm the device with: lsusb
  3. Rebind it: echo '<path>' | sudo tee /sys/bus/usb/drivers/usb/unbind echo '<path>' | sudo tee /sys/bus/usb/drivers/usb/bind
  4. Check logs: dmesg | tail -n 30
3) You want to know what kind of disk `/dev/sda` is
  1. Start with: lsblk -o NAME,TYPE,TRAN,ROTA,MODEL
  2. Then check: cat /sys/block/sda/removable cat /sys/block/sda/queue/rotational
  3. Build a simple conclusion: transport + removable flag + rotational flag

Cheat Sheet

  • lspci -nnk = PCI devices, IDs, and drivers
  • lsusb = USB devices
  • lsusb -t = USB tree and drivers
  • lsusb -v -d <vendor:product> = detailed info for one USB device
  • lsblk -o NAME,TYPE,TRAN,ROTA,MODEL = disk overview
  • lsmod = loaded modules
  • modprobe <module> = load a module
  • modprobe -r <module> = remove a module
  • modinfo -p <module> = show module parameters
  • /proc/interrupts, /proc/iomem, /proc/ioports, /proc/dma = hardware resources
  • /sys = live kernel hardware view
  • /dev = device nodes created with help from udev
  • /etc/modprobe.d/*.conf = module options and blacklists
  • /etc/udev/rules.d/ = custom udev rules
  • /sys/bus/usb/drivers/usb/{unbind,bind} = USB rebind path
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.