Troubleshooting

Diagnosing and resolving common Linux issues.

Topics

Topic Description

Boot Issues

GRUB, initramfs, systemd boot failures

Network Issues

Connectivity, DNS, routing problems

Performance

CPU, memory, I/O bottlenecks

General Approach

  1. Check logs — journalctl, dmesg, /var/log

  2. Check status — systemctl status, process state

  3. Check resources — CPU, memory, disk, network

  4. Check configuration — recent changes, syntax errors

  5. Isolate — binary search to find the cause

Essential Commands

Logs

# System journal
journalctl -xe              # Recent errors
journalctl -b               # Current boot
journalctl -b -1            # Previous boot
journalctl -u <service>     # Specific service
journalctl -f               # Follow

# Kernel messages
dmesg -T                    # With timestamps
dmesg -T | tail -50         # Recent

# Traditional logs
tail -f /var/log/syslog
tail -f /var/log/auth.log

System Status

# Services
systemctl --failed
systemctl status <service>

# Processes
top
htop
ps aux | grep <process>
pgrep -a <pattern>

Resources

# CPU/Memory
free -h
vmstat 1
sar -u 1 5

# Disk
df -h
iostat -x 1
iotop

# Network
ss -tlnp
iftop
nethogs