๐Ÿง Linux Troubleshooting Scenarios ๐Ÿง

๐Ÿง Linux Troubleshooting Scenarios ๐Ÿง

ยท

3 min read

When it comes to troubleshooting on Unix/Linux systems, having the right approach is key. Whether you're a Software Developer, DevOps Engineer, or Architect, understanding the problems and their resolutions is vital in this widespread environment.

Let's dive into some common scenarios and their solutions:

Issue 1: Server Connectivity Problem ๐Ÿ” Approach / Solution:

  • โœ… Ping server by Hostname and IP Address.

  • โœ… Check if Hostname/IP Address is pingable.

    • โ— If only IP is pingable, it might be a DNS issue.

      • ๐Ÿ“Œ Check /etc/hosts, /etc/resolv.conf, and /etc/nsswitch.conf.

      • ๐Ÿ“Œ Optionally, check DNS in /etc/sysconfig/network-scripts/ifcfg-<interface>.

    • โ— If neither is pingable, investigate network side or server-specific problems.

      • ๐Ÿ“‹ Check uptime, IP status, routes, Selinux, and Firewall rules.

      • ๐Ÿ”Œ Examine physical cable connections.

Issue 2: Unable to Connect to Website/Application ๐Ÿ” Approach / Solution:

  • โœ… Ping server by Hostname and IP Address.

  • โ— If pingable, use telnet to check service availability.

    • โœ… If service is running, inspect firewall, logs, and configuration.

Issue 3: Unable to SSH ๐Ÿ” Approach / Solution:

  • โœ… Ping server by Hostname and IP Address.

  • โ— If pingable, use telnet to check service availability.

    • โœ… If service is running, verify user status, shell, and root login.
  • ๐Ÿ“‹ Check service status, firewall, logs, and configuration.

Issue 4: Full Disk Space or Disk Extension ๐Ÿ” Approach / Solution:

  • โœ… Detect system performance degradation.

  • โ— Identify space issues with df and find large files with du.

    • ๐Ÿ—œ Compress/remove large files, move items, check disk health.

    • ๐Ÿ“ Add new disk, create partitions (LVM), extend filesystems.

Issue 5: Corrupted Filesystem ๐Ÿ” Approach / Solution:

  • โœ… Check logs for errors causing boot failure.

  • โ— Run fsck for bad sectors.

    • ๐Ÿ”ง Reboot into rescue mode, fix filesystem, edit fstab entries.

Issue 6: Fstab File Errors ๐Ÿ” Approach / Solution:

  • โœ… Check logs for boot errors.

  • โ— Run fsck for bad sectors.

    • ๐Ÿ”ง Reboot into rescue mode, fix filesystem, edit fstab entries.

Issue 7: Can't cd to Directory ๐Ÿ” Approach / Solution:

  • ๐Ÿ“‹ Check directory existence, path conflicts, permissions, and executability.
  • ๐Ÿ“‹ Check target existence, path conflicts, permissions, ownership.

Issue 9: Running Out of Memory ๐Ÿ” Approach / Solution:

  • ๐Ÿ“ˆ Monitor cache and RAM usage with commands like free -h.

  • โ— Identify memory-hungry processes, adjust priorities, extend swap space.

Issue 10: Add/Extend Swap Space ๐Ÿ” Approach / Solution:

  • โ— Create swap file, set permissions, enable swap with swapon.

  • ๐Ÿ“‹ Update fstab for persistence.

Issue 11: Unable to Run Commands ๐Ÿ” Approach / Solution:

  • โ— Troubleshoot permission, sudo access, paths, installation issues.

Issue 12: Unexpected System Reboot and Process Restart ๐Ÿ” Approach / Solution:

  • ๐Ÿ”„ Investigate system crash reasons (CPU, RAM, kernel, hardware).

  • ๐Ÿ” Understand process restart methods and watchdog applications.

Issue 13: Unable to Get IP Address ๐Ÿ” Approach / Solution:

  • ๐Ÿ”Œ Check IP assignment methods (DHCP, Static).

  • โ— Troubleshoot network settings, NIC status, and restart network service.

Issue 14: Backup and Restore File Permissions ๐Ÿ” Approach / Solution:

  • ๐Ÿ“‹ Create ACL file before changing permissions, restore with setfacl.

  • ๐Ÿ“ธ Consider VM snapshots or rebuilds for restoring permissions.

๐Ÿ’ก Useful Disk Partition Tip ๐Ÿ’ก:

  • ๐Ÿ“Š Rescan new disk status with echo 1 > /sys/block/sda/device/rescan.

  • ๐Ÿ“ Expanding existing disks appends space, doesn't affect existing data.

  • ๐Ÿ”„ Recreate filesystems to format old data, share .vmdk for replication.

Mastering Linux troubleshooting helps ensure smooth operations and efficient problem-solving in your IT journey! ๐Ÿš€๐Ÿ”ง

ย