./troubleshooting_workshop_guide.md

Troubleshooting Workshop

Your Mission

There is an Nginx web server installed on your machine. It is currently broken.

The Rules of Engagement:

  • Goal: Get curl localhost to show the "Victory" message.
  • Tools: Google, ChatGPT, and AI are ALLOWED.
  • Win Condition: Raise your hand when fixed. You must EXPLAIN the bugs to the judge. If you can't explain why it works, you don't win.

01. The Crash Course

Don't panic. Here is everything you need to know.

The Superuser (sudo)

Analogy: "Administrator Mode" or "Simon Says".

Linux protects system files (like web configs) from accidental damage. If you try to edit them as a normal user, it will say "Permission Denied."

Typing sudo before a command tells the computer: "I know what I'm doing, do it anyway."

# Edit a protected file
sudo nano /etc/hosts

# Install software
sudo apt install nginx

Services (systemctl)

Analogy: A restaurant kitchen.

Most programs stop when you close them. "Services" (or Daemons) run in the background forever, waiting for customers (web visitors). You control them with systemctl.

Important: If you change a config file, the service won't know until you restart it!

# Is it running or dead?
systemctl status nginx
# Apply your changes
sudo systemctl restart nginx

Permissions (chmod)

Analogy: ID Card Access.

Every file has 3 rights: Read (4), Write (2), eXecute (1).

Permissions are often shown as numbers:

  • 7 (4+2+1) = Read, Write, Execute
  • 6 (4+2) = Read, Write
  • 4 (4) = Read only
# Give owner RW, others R (Standard)
sudo chmod 644 filename.html

# Give everyone everything (Unsafe)
sudo chmod 777 filename.html

Logs

Analogy: The Black Box Recorder.

Linux is often silent. If you run a command and nothing happens, it usually worked.

If it fails, it writes the reason into a log file. You just have to find it.

# Show errors for the last boot
journalctl -xe
# Read the last 20 lines of a file
tail -n 20 /var/log/nginx/error.log

02. Helpful Commands

Command Category What it does
nano / vim Editing Text editors to change config files.
cat Reading Prints file contents to screen.
grep Search Searches for a specific word inside a file.
curl Network Fetches a webpage from command line.
ss -tuln Network Shows open ports. Crucial for servers.
ps aux Process Shows all currently running programs.

03. The OODA Loop

1

Observe

Run the command. What exact error message did you get?

2

Orient

Read the error, and copy it. Paste it into Google or ChatGPT for additional help (if necessary).

3

Decide

Based on the search (or your own knowledge), what file needs editing? What command fixes it?

4

Act & Loop

Execute the fix. Test again. If it fails, go to Step 1.