DEV Community

Cover image for Troubleshooting Common Linux Problems: A Practical Guide
Marzena Pugo
Marzena Pugo

Posted on

1

Troubleshooting Common Linux Problems: A Practical Guide

Table of Contents


Start with the Basics: What’s Really Going On?

Before you dive into commands, take a breath and gather the facts.

  • What’s broken? Is there an error message?

  • Did something change recently (updates, new installs)?

  • Can you reproduce the problem, or is it random?

Asking the right questions and getting a clear description of the issue saves you hours of wild goose chases


System Logs: Your First Detective Tool

Logs are your best friends when Linux acts up.

  • General system logs:
    tail -n 50 /var/log/syslog or tail -n 50 /var/log/messages

  • Kernel messages:
    sudo dmesg | tail -20

  • Authentication issues:
    tail -n 50 /var/log/auth.log or /var/log/secure

  • Boot problems:
    cat /var/log/boot.log or use head/tail for quick peeks**

  • Pro tip: Use grep "error" to search for red flags fast


Resource Hogs: CPU, Memory, and Disk Issues

Is your system sluggish or unresponsive?

  • Check system load:

uptime shows load averages

  • See what’s eating resources:

top, htop, or ps aux --sort=-%cpu | head for CPU hogs
ps aux --sort=-%mem | head for memory guzzlers

  • Disk space:

df -h for usage, du -sh * to find big files, and
sudo apt clean or sudo dnf clean all to clear package caches.

  • If a process is out of control, use kill -9 PID (replace PID with the process ID).


Permission Headaches and Dependency Drama

Permission denied?

  • Check with ls -la filename

  • Fix with chmod +x filename or change ownership with chown
    user:group filename.

Missing libraries or dependencies?

  • For errors like “libsomething.so.2: cannot open shared object file,” use:

apt-file search libsomething.so.2 (Debian/Ubuntu)
dnf provides */libsomething.so.2 (Fedora/RHEL)

  • Install the required package with your package manager


Network Not Working? Step-by-Step Fixes

  • Check your network interface:
    ip link

  • Verify your IP address:
    ip addr

  • Can you reach your gateway?
    ip route show and ping -c 4

  • Test DNS:
    ping -c 4 google.com

  • Check open ports:
    nc -zv google.com 443.

  • If SSH locks you out, try accessing the server locally or through the console, and check for high load or network failures


Boot Issues and Frozen Systems

  • Boot failures:
    Check /var/log/boot.log for clues.
    Use dmesg for kernel and hardware errors.

  • Frozen system?
    Try switching TTYs with Ctrl+Alt+F2, or use the hypervisor console if it’s a VM.

  • Safe reboot:
    If all else fails, use echo b > /proc/sysrq-trigger for a safe reboot


Real-World Scenarios and Quick Solutions

Script works manually but fails in cron?

  • Add logging to your script.

  • Compare environment variables between manual and cron runs.

  • Fix missing PATH or variables in your script.

  • Intermittent network drops?

  • Check logs for hardware errors.

  • Monitor with ping or dmesg -w for real-time clues


Wrapping Up

Linux troubleshooting is all about staying calm, asking the right questions, and using the right tools.

  • Always check logs first.

  • Monitor your resources.

  • Don’t ignore permissions or dependencies.

  • Automate what you can, but know how to dig in manually.

  • And remember, the Linux community is massive-don’t be afraid to
    search forums and share your own solutions. Happy troubleshooting!

AWS Security LIVE! Stream

Streaming live from AWS re:Inforce

What’s next in cybersecurity? Find out live from re:Inforce on Security LIVE!

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →