Table of Contents
- Boot Issues: When Linux Refuses to Start
- Network Problems: No Internet or Slow Connectivity
- Package Management Headaches: Broken Dependencies & Failed Updates
- Disk Space Woes: Running Out of Storage
- Permission Errors: “Permission Denied” Messages
- Service Failures: When systemd Services Won’t Start
- GUI Troubles: Black Screens, Unresponsive Desktops, & Display Issues
- Performance Lags: Slow System, High CPU/RAM Usage
- Kernel Issues: Panics, Module Conflicts, & Hardware Incompatibility
- General Troubleshooting Methodology: A Systematic Approach
- Conclusion
- References
1. Boot Issues: When Linux Refuses to Start
Boot problems are among the most critical—if Linux won’t start, you can’t access your system. Common symptoms include GRUB errors, kernel panics, or a frozen boot screen.
Common Causes
- Corrupted GRUB (Grand Unified Bootloader) configuration.
- Failed kernel update or incompatible kernel version.
- Faulty hardware (e.g., failing hard drive, RAM issues).
- Misconfigured init system (e.g., systemd errors).
Troubleshooting Steps
Scenario 1: GRUB Menu Missing or Errors
If GRUB fails to load (e.g., “error: file not found”), use a Linux live USB to repair it:
- Boot from the live USB and open a terminal.
- Identify your Linux root partition with
lsblk(look for/dev/sdaXor/dev/nvme0n1pX). - Mount the root partition:
sudo mount /dev/sdaX /mnt - Chroot into the mounted system:
sudo chroot /mnt - Reinstall GRUB (for BIOS systems):
For UEFI systems, mount the EFI partition first:grub-install /dev/sda # Replace /dev/sda with your disk (not partition!) update-grubsudo mount /dev/sdaY /mnt/boot/efi # /dev/sdaY is your EFI partition (FAT32) grub-install --target=x86_64-efi --bootloader-id=GRUB /dev/sda
Scenario 2: Kernel Panic During Boot
A kernel panic (e.g., “Kernel panic - not syncing: VFS: Unable to mount root fs”) often occurs due to a corrupted kernel. Fix it by:
- Reboot and hold
Shift(BIOS) orEsc(UEFI) to access the GRUB menu. - Select an older kernel version from the “Advanced options” menu.
- Once booted, remove the problematic kernel:
sudo apt remove linux-image-<version>-generic # Debian/Ubuntu sudo dnf remove kernel-<version> # RHEL/Fedora - Update GRUB to reflect changes:
sudo update-grub.
Scenario 3: System Hangs at “Loading Initial Ramdisk”
This may indicate a hardware or driver conflict. Check for faulty RAM with memtest86+ (boot from live USB and run the tool). For driver issues, blacklist problematic modules (e.g., faulty GPU drivers) by editing /etc/modprobe.d/blacklist.conf and adding:
blacklist <module-name>
2. Network Problems: No Internet or Slow Connectivity
Network issues range from “no internet” to DNS failures or slow speeds. The goal is to isolate whether the problem is local (your machine), router, or ISP-related.
Common Causes
- Misconfigured network interfaces (e.g., static IP conflicts).
- Firewall blocking traffic (e.g.,
ufw,iptables). - DNS server failures or incorrect DNS settings.
- Faulty network hardware (e.g., Ethernet cable, Wi-Fi adapter).
Troubleshooting Steps
Step 1: Check Interface Status
Use ip addr to verify if your network interface (e.g., eth0, wlan0) has an IP address:
ip addr show eth0 # Replace eth0 with your interface
- If no IP (e.g.,
inet 0.0.0.0), your DHCP server isn’t assigning an address. Restart the network service:sudo systemctl restart NetworkManager # For NetworkManager sudo systemctl restart systemd-networkd # For systemd-networkd
Step 2: Test Connectivity
- Ping your router (e.g.,
ping 192.168.1.1). If it fails, check Ethernet/Wi-Fi hardware. - Ping a public IP (e.g.,
ping 8.8.8.8). If this works butping google.comfails, DNS is broken.
Step 3: Fix DNS Issues
Edit /etc/resolv.conf (temporarily) or set DNS via NetworkManager:
sudo nano /etc/resolv.conf
Add public DNS servers:
nameserver 8.8.8.8 # Google DNS
nameserver 1.1.1.1 # Cloudflare DNS
For permanent changes, use nmcli (NetworkManager):
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8,1.1.1.1"
nmcli con up "Wired connection 1"
Step 4: Check Firewall Rules
A misconfigured firewall can block traffic. Temporarily disable ufw to test:
sudo ufw disable
If connectivity returns, re-enable and adjust rules:
sudo ufw allow 80/tcp # Allow HTTP
sudo ufw allow 443/tcp # Allow HTTPS
sudo ufw enable
3. Package Management Headaches: Broken Dependencies & Failed Updates
Package managers like apt (Debian/Ubuntu) or dnf (RHEL/Fedora) simplify software installation, but broken dependencies or corrupted caches can derail updates.
Common Causes
- Interrupted updates (e.g., power loss during
apt upgrade). - Third-party repositories conflicting with official ones.
- Missing dependencies for a package.
Troubleshooting Steps
Scenario 1: “Broken Packages” in apt
Fix with:
sudo apt clean # Clear cached packages
sudo apt autoremove # Remove unused dependencies
sudo apt --fix-broken install # Repair broken dependencies
Scenario 2: Stuck on “Waiting for Cache Lock”
This happens when another package manager (e.g., dpkg, synaptic) is running. Kill the process:
sudo lsof /var/lib/dpkg/lock-frontend
sudo kill -9 <PID> # Replace <PID> with the process ID
sudo dpkg --configure -a # Resume interrupted dpkg operations
Scenario 3: Third-Party Repo Conflicts
If a PPA or third-party repo causes errors, disable it:
sudo add-apt-repository --remove ppa:repo-name/ppa # Debian/Ubuntu
sudo rm /etc/yum.repos.d/repo-name.repo # RHEL/Fedora
4. Disk Space Woes: Running Out of Storage
Running out of disk space can crash services, corrupt files, or prevent updates.
Common Causes
- Large log files (e.g.,
/var/log). - Unnecessary packages or cached files.
- Accidental storage of big files (e.g., backups, ISOs).
Troubleshooting Steps
Step 1: Identify Disk Usage
Check overall disk space with df -h (human-readable):
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 200G 180G 10G 95% / # Root partition is 95% full!
Check inode usage (critical for file metadata) with df -i:
df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda2 1280000 1280000 0 100% / # Inodes exhausted!
Step 2: Free Up Space
- Delete large files: Use
duto find files >1GB:sudo du -h / --max-depth=1 | sort -rh | head -10 - Clean logs: Truncate large log files (e.g.,
/var/log/syslog):sudo truncate -s 0 /var/log/syslog - Clear package caches:
sudo apt clean # Debian/Ubuntu sudo dnf clean all # RHEL/Fedora
Step 3: Resize Partitions (If Using LVM)
If you’re using LVM (Logical Volume Manager), extend the root partition:
- Check free space in the volume group:
vgs # Look for "VFree" - Extend the logical volume:
sudo lvextend -L +50G /dev/ubuntu-vg/root # Add 50GB - Resize the filesystem:
sudo resize2fs /dev/ubuntu-vg/root # For ext4 sudo xfs_growfs /dev/ubuntu-vg/root # For XFS
5. Permission Errors: “Permission Denied” Messages
“Permission denied” errors occur when your user lacks access to files/directories. Linux uses a robust permission system (user, group, others) to secure data.
Common Causes
- Incorrect file permissions (e.g.,
rw-------for a shared file). - Wrong owner/group (e.g., a file owned by
rootbut accessed by a regular user).
Troubleshooting Steps
Understand Permissions
Use ls -l to check permissions:
ls -l file.txt
-rw-r--r-- 1 alice users 1024 Oct 5 12:00 file.txt
rw-r--r--: User (alice) can read/write, group (users) can read, others can read.- Permissions are numeric:
r=4,w=2,x=1.rw-r--r--=644.
Fix Permissions
- Change permissions with
chmod:chmod 644 file.txt # User: rw, Group: r, Others: r chmod +x script.sh # Add execute permission for all - Change owner/group with
chown:sudo chown alice:users file.txt # Owner: alice, Group: users
Dangerous Pitfalls
Avoid chmod 777 (full access for everyone)—it’s a security risk! Use the principle of least privilege.
6. Service Failures: When systemd Services Won’t Start
systemd manages most Linux services (e.g., nginx, ssh). If a service fails to start, logs and status checks are your best tools.
Troubleshooting Steps
Step 1: Check Service Status
Use systemctl status to diagnose:
systemctl status nginx
● nginx.service - A high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-10-05 14:30:00 UTC; 5s ago
Process: 1234 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Step 2: View Service Logs
Use journalctl to trace errors:
sudo journalctl -u nginx -f # -f = "follow" live logs
Look for clues like “address already in use” (port conflict) or “permission denied” (incorrect config file permissions).
Step 3: Fix the Service
- Port conflict: Identify the process using the port (e.g., 80):
Kill it withsudo lsof -i :80sudo kill -9 <PID>, then restart the service. - Corrupted config: Validate the service’s config file:
nginx -t # For nginx apache2ctl configtest # For Apache
7. GUI Troubles: Black Screens, Unresponsive Desktops, & Display Issues
Graphical User Interface (GUI) issues can range from minor annoyances (e.g., wrong resolution) to showstoppers (e.g., black screen on login).
Common Causes
- Outdated or incompatible graphics drivers (e.g., NVIDIA/AMD proprietary drivers).
- Corrupted Xorg or Wayland configuration.
- Desktop environment (DE) crashes (e.g., GNOME, KDE).
Troubleshooting Steps
Scenario 1: Black Screen After Login
- Switch to a TTY (text terminal) with
Ctrl+Alt+F3. - Check Xorg logs for errors:
cat /var/log/Xorg.0.log | grep -i error - Reinstall graphics drivers:
- NVIDIA:
sudo apt install nvidia-driver-535 - AMD:
sudo apt install xserver-xorg-video-amdgpu
- NVIDIA:
- Restart the display manager:
sudo systemctl restart gdm # For GNOME sudo systemctl restart sddm # For KDE
Scenario 2: Incorrect Display Resolution
- List available resolutions with
xrandr:xrandr - Set a valid resolution (e.g., 1920x1080):
xrandr --output HDMI-1 --mode 1920x1080 - Persist the change by adding the command to
~/.xprofile.
8. Performance Lags: Slow System, High CPU/RAM Usage
A slow Linux system is often due to resource bottlenecks (CPU, RAM, disk I/O).
Troubleshooting Steps
Identify Resource Hogs
Use htop (interactive) or top to monitor CPU/RAM usage:
htop
Look for processes with high %CPU or RES (resident memory).
Check for Swap Usage
Excessive swap usage (disk used as RAM) slows the system. Check with free -h:
free -h
total used free shared buff/cache available
Mem: 15Gi 12Gi 1.0Gi 500Mi 2.0Gi 2.5Gi
Swap: 20Gi 18Gi 2.0Gi # High swap usage!
Fix by closing memory-heavy apps or increasing physical RAM.
Disk I/O Bottlenecks
Use iostat to check disk read/write speeds:
sudo iostat -x 5 # Run every 5 seconds
High %util (e.g., >90%) indicates a slow disk. Upgrade to an SSD or clean up disk usage.
9. Kernel Issues: Panics, Module Conflicts, & Hardware Incompatibility
The Linux kernel is the core of the OS. Issues here can cause system instability.
Troubleshooting Steps
Update the Kernel
New kernels often fix bugs. Update with:
sudo apt upgrade linux-image-generic # Debian/Ubuntu
sudo dnf upgrade kernel # RHEL/Fedora
Blacklist Problematic Modules
If a kernel module (e.g., nouveau for NVIDIA) causes issues, blacklist it:
- Create a
.conffile in/etc/modprobe.d/:sudo nano /etc/modprobe.d/blacklist-nouveau.conf - Add:
blacklist nouveau options nouveau modeset=0 - Rebuild the initramfs:
sudo update-initramfs -u
10. General Troubleshooting Methodology: A Systematic Approach
To resolve issues efficiently, follow this workflow:
- Reproduce the Issue: Ensure the problem occurs consistently (e.g., “Does the network fail only on Wi-Fi?”).
- Check Logs: Use
journalctl(system logs),/var/log/(application logs), anddmesg(kernel messages). - Isolate Variables: Test one change at a time (e.g., disable a service, update one package).
- Use Tools: Leverage diagnostic tools (
htop,ip,df) to gather data. - Document Fixes: Note what worked (or didn’t) for future reference.
Conclusion
Troubleshooting Linux issues is a skill that grows with practice. By understanding common problems, using the right tools, and following a systematic approach, you can resolve most issues quickly. Remember: logs are your best friend, and the Linux community (forums, docs, tutorials) is always there to help.
References
- Linux Man Pages:
man <command>(e.g.,man journalctl). - Official Distro Docs: Ubuntu, Fedora, Arch Linux.
- Forums: Ask Ubuntu, Unix & Linux Stack Exchange.
- Books: “Linux Troubleshooting Bible” by Daniel J. Barrett.