198 lines
3.5 KiB
Markdown
198 lines
3.5 KiB
Markdown
|
|
# Troubleshooting Hardware and Device Drivers
|
||
|
|
|
||
|
|
## 1. Identifying Hardware and Drivers
|
||
|
|
|
||
|
|
### a) List all hardware:
|
||
|
|
```
|
||
|
|
lshw
|
||
|
|
```
|
||
|
|
This command provides detailed information about your system's hardware configuration.
|
||
|
|
|
||
|
|
### b) List PCI devices:
|
||
|
|
```
|
||
|
|
lspci
|
||
|
|
```
|
||
|
|
Shows all PCI devices connected to your system.
|
||
|
|
|
||
|
|
### c) List USB devices:
|
||
|
|
```
|
||
|
|
lsusb
|
||
|
|
```
|
||
|
|
Displays all USB devices connected to your system.
|
||
|
|
|
||
|
|
### d) Check loaded kernel modules:
|
||
|
|
```
|
||
|
|
lsmod
|
||
|
|
```
|
||
|
|
Lists all currently loaded kernel modules (drivers).
|
||
|
|
|
||
|
|
## 2. Checking System Logs
|
||
|
|
|
||
|
|
### a) View kernel messages:
|
||
|
|
```
|
||
|
|
dmesg
|
||
|
|
```
|
||
|
|
Displays kernel-related messages, including hardware detection and driver loading.
|
||
|
|
|
||
|
|
### b) Check system logs:
|
||
|
|
```
|
||
|
|
journalctl
|
||
|
|
```
|
||
|
|
For systems using systemd, this command shows system logs.
|
||
|
|
|
||
|
|
## 3. Managing Drivers
|
||
|
|
|
||
|
|
### a) Load a module:
|
||
|
|
```
|
||
|
|
sudo modprobe module_name
|
||
|
|
```
|
||
|
|
|
||
|
|
### b) Unload a module:
|
||
|
|
```
|
||
|
|
sudo modprobe -r module_name
|
||
|
|
```
|
||
|
|
|
||
|
|
### c) Blacklist a module:
|
||
|
|
Add the following line to /etc/modprobe.d/blacklist.conf:
|
||
|
|
```
|
||
|
|
blacklist module_name
|
||
|
|
```
|
||
|
|
|
||
|
|
## 4. Troubleshooting Specific Hardware Types
|
||
|
|
|
||
|
|
### a) Network interfaces:
|
||
|
|
- Check network interface status:
|
||
|
|
```
|
||
|
|
ip link show
|
||
|
|
```
|
||
|
|
- Bring an interface up or down:
|
||
|
|
```
|
||
|
|
sudo ip link set interface_name up/down
|
||
|
|
```
|
||
|
|
|
||
|
|
### b) Graphics:
|
||
|
|
- Check graphics card information:
|
||
|
|
```
|
||
|
|
lspci | grep VGA
|
||
|
|
```
|
||
|
|
- For NVIDIA GPUs, use:
|
||
|
|
```
|
||
|
|
nvidia-smi
|
||
|
|
```
|
||
|
|
|
||
|
|
### c) Audio:
|
||
|
|
- List audio devices:
|
||
|
|
```
|
||
|
|
aplay -l
|
||
|
|
```
|
||
|
|
- Check ALSA mixer settings:
|
||
|
|
```
|
||
|
|
alsamixer
|
||
|
|
```
|
||
|
|
|
||
|
|
## 5. Firmware Issues
|
||
|
|
|
||
|
|
### a) Check for missing firmware:
|
||
|
|
```
|
||
|
|
dmesg | grep firmware
|
||
|
|
```
|
||
|
|
|
||
|
|
### b) Install firmware packages:
|
||
|
|
```
|
||
|
|
sudo apt install linux-firmware
|
||
|
|
```
|
||
|
|
(For Debian/Ubuntu-based systems)
|
||
|
|
|
||
|
|
## 6. Kernel Parameters
|
||
|
|
|
||
|
|
Modify kernel parameters by editing /etc/default/grub and updating GRUB_CMDLINE_LINUX_DEFAULT. After changes, run:
|
||
|
|
```
|
||
|
|
sudo update-grub
|
||
|
|
```
|
||
|
|
|
||
|
|
## 7. Driver Compilation
|
||
|
|
|
||
|
|
### If you need to compile a driver:
|
||
|
|
- a) Install build essentials:
|
||
|
|
```
|
||
|
|
sudo apt install build-essential linux-headers-$(uname -r)
|
||
|
|
```
|
||
|
|
|
||
|
|
- b) Download driver source, then typically:
|
||
|
|
```
|
||
|
|
make
|
||
|
|
sudo make install
|
||
|
|
```
|
||
|
|
|
||
|
|
## 8. Debugging Tools
|
||
|
|
|
||
|
|
- a) strace: Trace system calls and signals
|
||
|
|
```
|
||
|
|
strace command
|
||
|
|
```
|
||
|
|
|
||
|
|
- b) ltrace: Library call tracer
|
||
|
|
```
|
||
|
|
ltrace command
|
||
|
|
```
|
||
|
|
|
||
|
|
## 9. Hardware Information Tools
|
||
|
|
|
||
|
|
- a) inxi: Comprehensive hardware information
|
||
|
|
```
|
||
|
|
inxi -Fxz
|
||
|
|
```
|
||
|
|
|
||
|
|
- b) hwinfo: Another detailed hardware information tool
|
||
|
|
```
|
||
|
|
hwinfo --short
|
||
|
|
```
|
||
|
|
|
||
|
|
## 10. Kernel Configuration
|
||
|
|
|
||
|
|
Check current kernel configuration:
|
||
|
|
```
|
||
|
|
zcat /proc/config.gz
|
||
|
|
```
|
||
|
|
(If available)
|
||
|
|
|
||
|
|
## 11. Udev Rules
|
||
|
|
|
||
|
|
Manage device events and permissions by creating or modifying rules in /etc/udev/rules.d/.
|
||
|
|
|
||
|
|
## 12. Benchmarking and Stress Testing
|
||
|
|
|
||
|
|
- a) CPU stress test:
|
||
|
|
```
|
||
|
|
stress --cpu 8 --timeout 20s
|
||
|
|
```
|
||
|
|
|
||
|
|
- b) Disk benchmark:
|
||
|
|
```
|
||
|
|
sudo hdparm -tT /dev/sda
|
||
|
|
```
|
||
|
|
|
||
|
|
## 13. Power Management
|
||
|
|
|
||
|
|
a) Check CPU frequency scaling:
|
||
|
|
```
|
||
|
|
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||
|
|
```
|
||
|
|
|
||
|
|
b) Set performance mode:
|
||
|
|
```
|
||
|
|
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||
|
|
```
|
||
|
|
|
||
|
|
## 14. Troubleshooting Steps
|
||
|
|
|
||
|
|
1. Identify the problem hardware or driver
|
||
|
|
2. Check system logs for errors
|
||
|
|
3. Ensure correct drivers are installed and loaded
|
||
|
|
4. Try different kernel parameters
|
||
|
|
5. Update or downgrade drivers if necessary
|
||
|
|
6. Check for conflicts with other hardware or software
|
||
|
|
7. Test hardware in a live Linux environment to isolate OS issues
|
||
|
|
|
||
|
|
Remember to backup important data before making significant system changes. If you're unsure about any step, research further or seek help from the Linux community forums specific to your distribution.
|