Skip to content
Visual explainer 3h to learn 5 steps

A troubleshooting method

Work from symptom to root cause with a repeatable checklist.

By Invicly Tech, , in Linux Administration (RHCSA-style). About 11 minutes to read.

Topic 36 of 42

In short

Good troubleshooting is a method, not luck. Start from a precise symptom, ask what changed, gather evidence from status, logs and resource checks, form one hypothesis at a time, test it, and record the root cause. Most real incidents are a failed service, a full disk, a bad config, DNS or a firewall or SELinux rule.

Explained simply

When something breaks, it is tempting to try random fixes: restart this, reboot that. Sometimes it works, but you learn nothing, and the problem comes back. A method is a set of steps you follow every time, so you move from what you see to why it happened.

Start by describing the problem exactly. Not "the site is broken" but "the login page returns error 502 for all users since 14:10". Then ask the most useful question in IT: what changed? An update, a config edit, a new deploy, a full disk.

Next, collect evidence before you change anything: service status, logs, disk space, memory, network. Pick the most likely cause, test it with the smallest possible change, and see if the symptom goes away.

When it works again, write down what happened and why. That note helps the next person, maybe you in six months, and it shows how to stop the problem from happening again.

Press Play on a diagram to walk through it one step at a time.

CycleThe troubleshooting loop
  1. 1
    Observe

    Exact symptom, scope and recent changes.

  2. 2
    Gather evidence

    systemctl status, journalctl, df, ss.

  3. 3
    Hypothesise

    One likely cause at a time.

  4. 4
    Test and fix

    Smallest change that confirms or rules it out.

  5. 5
    Verify and record

    Confirm the fix and write down the root cause.

  6. Back to step 1
MapWhere to look first, by symptom
Symptom
  • Service will not start
    • systemctl status
    • journalctl -xeu NAME
    • Config syntax test
  • Permission denied
    • ls -l and namei -l path
    • SELinux: ausearch -m AVC
    • Running as which user?
  • Cannot connect
    • ss -tlnp on the server
    • Firewall rules
    • DNS and routes
  • Slow
    • Load vs nproc
    • free -h and vmstat
    • iostat -xz
  • No space left
    • df -h and df -i
    • du -xh, lsof +L1

In depth

Define the symptom and find what changed

A good problem statement answers: what exactly fails, for whom, since when, and how often. Who is affected tells you a lot: everyone means the server or network, one user means their account or client. A clear start time lets you look for changes just before it.

Useful sources of change: dnf history and rpm -qa --last for packages, journalctl --since '14:00' --until '14:15' for everything logged in that window, last reboot for restarts, ls -lt /etc | head for recently edited configs, and your deploy or config history. Many incidents are caused by a change made in the hour before, often by the same team.

  • dnf history list | head shows recent package transactions
  • journalctl -p err -b shows errors since this boot
  • find /etc -mmin -60 -type f lists configs changed in the last hour

Check resources with the USE idea

For each resource (CPU, memory, disk, network), ask three questions: how busy is it (utilization), is work waiting for it (saturation), and are there errors? This short checklist, known as the USE method, stops you from missing the obvious.

In practice: uptime and top for CPU, free -h and the kernel log for memory and OOM kills, df -h, df -i and iostat for disks, and ip -s link for network errors and drops. Do not forget limits that are not hardware: too many open files (ulimit -n, errors like Too many open files), a full connection table, or a service that hit its systemd restart limit and gave up.

Test the network from the bottom up

Network problems are easiest to find layer by layer, starting at the bottom. Is the link up (ip link)? Does the host have the right address (ip addr)? Is there a route to the target (ip route get 10.0.5.20)? Can you reach the gateway (ping)? Does the name resolve (getent hosts db01, or dig db01)? Is the port open on the server (ss -tlnp on the server, nc -zv db01 5432 from the client)? Does the application answer (curl -v)?

The first layer that fails is where to dig. If DNS fails, check /etc/resolv.conf and resolvectl status. If the port is listening but a remote client cannot connect, suspect the firewall (firewall-cmd --list-all) or, on RHEL, an SELinux port label.

LayersNetwork checks, top to bottom
  1. 1
    Application

    curl -v http://host:8080/health

  2. 2
    Port and firewall

    ss -tlnp, nc -zv, firewall-cmd --list-all

  3. 3
    Name resolution

    getent hosts, dig, resolvectl status

  4. 4
    Routing

    ip route get, ping the gateway

  5. 5
    Address

    ip addr: right IP and prefix?

  6. 6
    Link

    ip link: state UP, cable or vNIC

Full disks, hidden space and inodes

A full disk makes services fail in odd ways: databases refuse writes, logins hang, logs stop. df -h finds the full filesystem, and sudo du -xh --max-depth=1 /var | sort -h finds the big folder level by level. If df and du disagree, a deleted file is still open; sudo lsof +L1 finds it, and restarting that process frees the space.

If df -h shows space but you still get No space left on device, check df -i. Inode exhaustion comes from millions of tiny files, such as session files or a mail queue. Find the folder with the most files and clean it. Also know that ext4 keeps 5% of blocks for root by default, so a normal user may see a full disk before root does. To shrink the journal, use journalctl --vacuum-size=500M.

  • sudo lsof +L1 lists deleted files still held open
  • sudo find /var -xdev -type f | cut -d/ -f1-4 | sort | uniq -c | sort -n | tail counts files per folder
  • journalctl --disk-usage shows how much the journal uses

Write down the root cause

The symptom was a 502; the trigger was a full disk; the root cause was a log file with no rotation. Asking why several times, often called the five whys, moves you from the first answer to the one worth fixing.

A short postmortem has: a timeline with times, the impact (who was affected and for how long), the root cause, what fixed it, and follow-up actions with owners, such as adding logrotate and a disk alert. Keep it blameless: describe what the system allowed, not who made a mistake, so people share the full story. Over time these notes become your team's best runbook.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Define the symptom and recent changes~35m
  2. 2
    Check services, logs and resources~35m
  3. 3
    Test network, DNS and ports~35m
  4. 4
    Fix full disks and inode exhaustion~35m
  5. 5
    Write down the root cause~35m

Key points

  • systemctl status and journalctl -xeu NAME explain most service failures.
  • Check df -h and df -i; full disks break services in confusing ways.
  • Test the network bottom-up: link, address, route, DNS, port, application.
  • Change one thing at a time so you know what fixed it.

Key terms

Tap a card to flip it. 0/4 known

Examples

bash
systemctl --failed
sudo journalctl -xeu httpd | tail -30
df -h; df -i
sudo ss -tulpn | grep -E ":80|:443"
getent hosts db01 && curl -sv http://localhost/ -o /dev/null
sudo ausearch -m AVC -ts recent | tail
sudo firewall-cmd --list-all

A first-five-minutes checklist for a broken web service.

Website down after a weekend

Monday morning, the site returns 503. Step 1, symptom: all users, since Sunday 03:12 from the monitoring. Step 2, changes: dnf history shows nothing, but journalctl around 03:12 shows the database stopped. Step 3, evidence: systemctl status mariadb says failed; the log says No space left on device. Step 4: df -h shows /var at 100%; du points to a 40 GB slow-query log. Step 5: truncate it, start mariadb, confirm the site works. Step 6: write it down and add log rotation plus a disk alert.

bash
systemctl --failed
journalctl --since 'sun 03:00' --until 'sun 03:30' -p warning
sudo journalctl -u mariadb -n 20
df -h /var
sudo du -xh --max-depth=2 /var | sort -h | tail -5
sudo truncate -s 0 /var/lib/mysql/slow.log
sudo systemctl start mariadb && curl -sI http://localhost/ | head -1

The app cannot reach the database

The app logs connection refused to db01:5432. Work bottom-up from the app server. Step 1: the name resolves to the right IP. Step 2: the route and a ping work. Step 3: nc to port 5432 is refused, so the network is fine and something is wrong at the server. Step 4: on db01, ss shows PostgreSQL listening only on 127.0.0.1. Root cause: listen_addresses was reset by a config change. Fix it, restart, and retest from the app server.

bash
getent hosts db01
ip route get 10.0.5.20 && ping -c 2 db01
nc -zv db01 5432               # Connection refused
# on db01:
sudo ss -tlnp | grep 5432      # 127.0.0.1:5432 only
sudo -u postgres psql -c 'SHOW listen_addresses;'
# set listen_addresses = '*' in postgresql.conf, then:
sudo systemctl restart postgresql
nc -zv db01 5432               # succeeded

Quick reference

  • Ask first: what exactly fails, for whom, since when, and what changed?
  • systemctl --failed, then journalctl -xeu NAME for the failing unit
  • journalctl --since '14:00' --until '14:15' shows everything in a time window
  • Network bottom-up: ip link, ip addr, ip route get, getent hosts, ss -tlnp, curl -v
  • df -h and df -i: space and inodes are separate limits
  • lsof +L1 finds deleted files that still hold disk space
  • Change one thing at a time and note each change with the time
  • Postmortem: timeline, impact, root cause, fix, follow-up actions

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Only one user cannot log in; everyone else is fine. Where should you look first?

Question 2

2nc -zv db01 5432 from the app server says Connection refused. What does that tell you?

Question 3

3df says 100% used, but du only finds half of that. What is the likely cause?

Question 4

4Why change only one thing at a time?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    List all failed units and show the last 20 log lines with explanations for one of them.

  2. Exercise 2medium

    Find which folder under /var holds the most files, as you would for inode exhaustion.

  3. Exercise 3hard

    Break name resolution on a test VM on purpose, then diagnose it from scratch using the bottom-up order and write a three-line root cause note.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

What should I check first when a Linux service fails?
Run systemctl status NAME and journalctl -xeu NAME. The last lines of the log usually say exactly why it stopped, such as a bad config line, a missing file or a busy port.
What is the difference between a symptom and a root cause?
The symptom is what users see, such as an error page. The root cause is the underlying reason that, once fixed, stops the problem from coming back.
Why does my disk say full when there is space left?
Either you are out of inodes (check df -i) or a deleted file is still open (check lsof +L1). On ext4, normal users also cannot use the last 5% reserved for root.
What is a blameless postmortem?
A write-up of an incident that focuses on how the system allowed the failure, not on who made a mistake. People share more details when they are not afraid of blame.

Go deeper

ShareXLinkedInWhatsApp