Common Linux troubleshooting scenarios

 


1. System Won't Boot

Symptoms: After rebooting, the system stops at the boot screen or fails to load the operating system.

Causes:

  • Corrupted bootloader (e.g., GRUB).
  • Missing or corrupted kernel.
  • Disk errors.

Solutions:

  • Boot from a live USB: Access the system via a live USB, then troubleshoot.
  • Check bootloader: Use the grub-install command to reinstall GRUB.
  • Repair filesystem: Run fsck on the root filesystem to detect and fix disk errors.
  • Restore kernel: Reinstall or update the kernel package if it's missing.

2. Network Connectivity Issues

Symptoms: No network connectivity, unable to ping external websites, or resolve domain names.

Causes:

  • Misconfigured network interface.
  • Firewall blocking network traffic.
  • DNS issues.

Solutions:

  • Check IP configuration: Use ip a or ifconfig to check interface settings. Modify /etc/network/interfaces or use nmcli for configuration.
  • Check firewall: Use ufw status or iptables -L to verify that the firewall isn't blocking traffic.
  • Check DNS: Test using ping 8.8.8.8 to see if it's a DNS issue. If so, check /etc/resolv.conf for DNS server configuration.

3. Disk Space Issues

Symptoms: Error messages about "No space left on device" or inability to write files.

Causes:

  • Disk is full.
  • Filesystem reaching inode limit.

Solutions:

  • Identify large files: Use du -sh /* to locate large files.
  • Clear logs: Check /var/log and rotate or delete large log files.
  • Inode check: Run df -i to see if you've run out of inodes, and delete unnecessary small files if needed.

4. Slow Performance

Symptoms: System slowdowns, lagging applications, or high CPU usage.

Causes:

  • High memory or CPU consumption.
  • Disk I/O bottlenecks.
  • Background processes consuming resources.

Solutions:

  • Monitor resources: Use top or htop to identify resource-intensive processes.
  • Kill processes: Terminate high-usage processes with kill.
  • Optimize disk I/O: Check iostat for I/O performance and make adjustments as needed, such as upgrading hardware or adjusting configurations.

5. Permission Denied Errors

Symptoms: "Permission denied" error messages even as root.

Causes:

  • Incorrect file permissions or ownership.
  • SELinux or AppArmor restrictions.

Solutions:

  • Check file permissions: Use ls -l to inspect file permissions. Change them using chmod or chown.
  • Verify SELinux status: If SELinux is enforcing, use getenforce to check status and setenforce 0 to temporarily disable it.
  • AppArmor profiles: For Ubuntu and derivatives, check AppArmor with sudo aa-status and adjust as needed.

6. Broken Package Dependencies

Symptoms: Errors during package installation or upgrade.

Causes:

  • Corrupted or missing package files.
  • Conflicting dependencies.

Solutions:

  • Force reinstall: Use apt-get install -f (Debian/Ubuntu) to fix broken dependencies.
  • Clear cache: Run apt-get clean or dnf clean all to clear the package cache.
  • Use a package manager: Tools like dpkg --configure -a or yum-complete-transaction can often resolve these issues.

7. File Not Found in Path

Symptoms: Command not found error even if the program is installed.

Causes:

  • Binary location not included in the system’s PATH.
  • Application not installed correctly.

Solutions:

  • Locate binary: Use which <command> to find where the binary is located. Add the location to PATH if necessary (export PATH=$PATH:/path/to/directory).
  • Install application: If the program isn't installed, use the appropriate package manager to install it.

8. Kernel Panic

Symptoms: System crashes with a kernel panic error.

Causes:

  • Hardware issues.
  • Corrupted kernel or drivers.
  • Memory errors.

Solutions:

  • Check hardware: Test hardware components (e.g., RAM, disk).
  • Update kernel: Try reinstalling or updating to a stable kernel version.
  • View kernel logs: Review /var/log/kern.log for specific causes.

 

9. USB Drive Not Detected

Symptoms: Inserting a USB drive does not mount or display the drive in the file manager.

Causes:

  • USB drive failure or hardware issues.
  • Lack of necessary drivers or permissions.
  • Incorrect USB port or connection.

Solutions:

  • Check dmesg: Run dmesg | tail immediately after inserting the drive to see any system messages related to USB detection.
  • Check mount points: Use lsblk or fdisk -l to verify if the drive is detected. If so, manually mount it using mount.
  • Install drivers: Ensure you have usbutils and udisk2 packages installed for handling USB devices.

10. SSH Connection Refused

Symptoms: Unable to connect via SSH, seeing “Connection refused” errors.

Causes:

  • SSH server (sshd) not running or misconfigured.
  • Firewall blocking SSH port (default 22).
  • Network issues between client and server.

Solutions:

  • Check SSH service: Verify SSH server status with sudo systemctl status ssh or sudo service ssh status.
  • Open firewall ports: Ensure port 22 is open using ufw allow 22 or iptables.
  • Test network: Use ping, traceroute, or telnet <server> 22 to confirm network connectivity to the server.

11. Frozen GUI/Desktop Environment

Symptoms: The system’s graphical interface is unresponsive, mouse and keyboard inputs are not registering.

Causes:

  • High memory or CPU usage.
  • Graphical server crash.
  • Hardware issues.

Solutions:

  • Switch to terminal: Press Ctrl + Alt + F2 to switch to a different terminal, then check processes with top or htop.
  • Restart display manager: Run sudo systemctl restart gdm (for GNOME), sddm (for KDE), or lightdm as needed.
  • Force restart: If unable to recover, force a reboot using REISUB keys (Alt + SysRq + R E I S U B).

12. Outdated System Time

Symptoms: Incorrect system time, leading to issues with timestamps and SSL connections.

Causes:

  • Incorrect time zone or NTP settings.
  • CMOS battery failure (hardware clock).

Solutions:

  • Synchronize with NTP: Run sudo timedatectl set-ntp true to enable NTP sync.
  • Set timezone: Use sudo timedatectl set-timezone <timezone> to set the correct timezone.
  • Replace CMOS battery: If system time resets after shutdown, consider replacing the CMOS battery.

13. Software Installation Fails Due to Missing Repositories

Symptoms: Package manager errors indicating missing repositories.

Causes:

  • Repositories were removed or are outdated.
  • Network issues preventing repository access.

Solutions:

  • Update repository list: Refresh using sudo apt update or equivalent.
  • Add missing repositories: Locate and add missing repositories in /etc/apt/sources.list (Debian/Ubuntu) or /etc/yum.repos.d/ (RHEL/CentOS).
  • Check network: Ensure you can access the repository URLs in a browser or with ping.

14. High Load Average

Symptoms: uptime or top shows a high load average, indicating the system is overloaded.

Causes:

  • Overloaded CPU or disk I/O.
  • Too many processes running simultaneously.

Solutions:

  • Identify high-usage processes: Use top or ps aux --sort=-%cpu to identify and kill or stop unnecessary processes.
  • Schedule heavy tasks: Run CPU or disk-intensive tasks during off-peak hours or set process priority with nice and renice.
  • Consider upgrading hardware: If high load persists, consider upgrading CPU, memory, or disks.

15. Failed to Load Kernel Module

Symptoms: Error messages about missing or failing to load kernel modules, often impacting hardware or software functionality.

Causes:

  • Incompatible kernel version.
  • Missing or corrupted kernel module.

Solutions:

  • Load module manually: Use modprobe <module_name> to load the module, and check errors with dmesg.
  • Reinstall module: If the module is missing, install or rebuild it using package managers or by reconfiguring the kernel (make menuconfig for custom kernels).
  • Kernel update: Ensure compatibility by updating to a compatible kernel.

16. Failed User Login

Symptoms: Users unable to log in with correct credentials, sometimes due to permissions or lockouts.

Causes:

  • Account lockout or disabled account.
  • Permission issues in home directory or .bashrc errors.

Solutions:

  • Unlock account: Use sudo usermod -U <username> or passwd -u <username>.
  • Verify permissions: Check home directory permissions with ls -ld /home/username, ensuring ownership and permissions are correct.
  • Check login shell: If login is blocked, ensure the shell is valid by checking /etc/passwd.

Post a Comment

0 Comments