




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Mastering Linux Troubleshooting: A Comprehensive Guide for Real-World Issues Troubleshooting skills are invaluable for a DevOps or Linux system administrator. When a service fails, a disk fills up, or network performance degrades, quick and effective diagnosis can make the difference between minutes of downtime and hours of frustration. This article dives deep into Linux troubleshooting best practices, key commands, and practical solutions to some of the most common issues.
1. Basic Troubleshooting Steps 1. Check System Logs
2. Common Linux Issues and Solutions 2.1. Service Not Running or Crashing
/etc. 2.2. Network Issues/etc/resolv.conf. 2.3. Disk Space Issues| dmesg | View kernel messages | | strace | Trace system calls of a process | | netstat / ss | Check network connections | | lsof | List open files by processes | | iotop | Monitor disk I/O usage | | uptime | Check system load averages |
4. Troubleshooting Workflow Example Let’s say a web server on your Linux machine isn’t responding. Here’s how to approach it:
Install the crash tool: sudo apt install kexec-tools crash kdump-tools sudo systemctl enable kdump Reboot and analyze crash dumps stored in /var/crash/. 5.2. SSH Connectivity Issues Unable to SSH into a remote server. Diagnosis: Check the SSH service status: sudo systemctl status ssh #Test connectivity with: telnet <server_ip> 22 # Verify if the port is open. Solution: Restart the SSH service: sudo systemctl restart ssh #Check firewall rules: sudo ufw status sudo ufw allow 22/tcp Inspect the SSH configuration: Look for typos or misconfigurations in /etc/ssh/sshd_config. Fix permission issues on SSH keys: chmod 600 ~/.ssh/id_rsa chmod 700 ~/.ssh 5.3. SELinux Denials and Policy Issues Processes fail to execute despite correct permissions, or services stop unexpectedly. Diagnosis: Look for SELinux denials: sudo ausearch - m AVC,USER_AVC - ts recent sudo journalctl | grep "denied" Solution: Temporarily disable SELinux: sudo setenforce 0 Identify the issue and apply the correct policy: sudo ausearch - c "
Unmount the filesystem: sudo umount /dev/sdX Repair the filesystem: sudo fsck - f /dev/sdX Check the SMART status of the disk: sudo smartctl - H /dev/sdX 5.7. System Lockdown Due to Firewall Rules After applying firewall rules, remote access becomes blocked. Diagnosis: Check the current firewall rules: sudo iptables - L - n - v Solution: Flush all firewall rules temporarily to regain access: sudo iptables - F Allow essential ports: sudo iptables - A INPUT - p tcp --dport 22 - j ACCEPT Save new rules: sudo iptables-save > /etc/iptables/rules.v 5.8. Time Synchronization Issues (NTP/Chrony) Incorrect time on the system causes issues with authentication, logging, or certificates. Diagnosis: check the system clock: date timedatectl status Verify NTP sync status: ntpq - p # For NTP chronyc tracking # For Chrony Solution: Restart the NTP/Chrony service: sudo systemctl restart ntp sudo systemctl restart chronyd Manually sync the time: sudo ntpdate pool.ntp.org Mastering Linux troubleshooting requires practice and patience. This guide provides a strong foundation for diagnosing and solving the most common issues in Linux systems. With
regular use of logs, monitoring tools, and effective resource management, you’ll be well on your way to becoming a Linux troubleshooting expert.