Skip to content

Phase 4 · Free

4.1 How to Read an Error Message

Beginners see an error and panic. Professionals read it. Most error messages tell you exactly what went wrong, which file, and often which line. This phase is about breaking your own machine on purpose and fixing it without reinstalling. It starts with reading.

Phase 4: Break It, Fix It. Lesson 1 of 5. About 15 minutes.

Plain entry

Beginners see an error and panic. Professionals read it. Most error messages tell you exactly what went wrong, which file, and often which line. This phase is about breaking your own machine on purpose and fixing it without reinstalling. It starts with reading.

Before anything in this phase: take a fresh VMA software-based emulation of a complete computer that runs its own operating system and applications, isolated from the host hardware. Read more → snapshotA saved, point-in-time state of a virtual machine or storage volume that you can roll back to if a change goes wrong. Read more → named before-phase-4. If you get truly stuck, roll back, write down what happened, and try again.

Terms

  • Exit codeThe number a program returns when it finishes, where 0 means success and anything else signals a specific kind of failure. Read more →: a number every command returns. 0 means success; anything else is a failure. Read it with echo $?.
  • stderr: the error output stream (lesson 3.5).
  • Root cause: the actual reason, not the symptom.

Depth

Anatomy of a real error:

cat /etc/shadow
cat: /etc/shadow: Permission denied

Three parts: which program (cat), what object (/etc/shadow), what went wrong (Permission denied). Read left to right, every time.

ls /nope; echo "exit code: $?"
ls: cannot access '/nope': No such file or directory
exit code: 2

Common messages and what they really mean:

MessageUsually means
Permission deniedWrong user or wrong permissions. Check ls -l before reaching for sudoA Linux command that runs a single command with administrator (root) privileges, after checking that your account is allowed to do so. Read more →.
No such file or directoryTypo, wrong path, or wrong current folder. Check pwd.
command not foundNot installed, or typo. Try apt search name.
No space left on deviceDisk full. df -h.
Could not get lock /var/lib/dpkg/lockAnother apt is running (often automatic updates). Wait.
Read-only file systemFilesystemThe structure an operating system uses to organize data on a disk into files and folders, tracking names, sizes, permissions, and where each piece is stored. Read more → error, kernelThe core of an operating system that runs with full hardware control and decides how every program gets CPU time, memory, and device access. Read more → remounted it read-only. See lesson 4.4.

When searching, paste the exact message in quotes, add your distro and version, and leave out your username and hostname.

Why it works this way

Most errors are built the same way: which program, which thing it was working on, and what went wrong. cat: company/hr/file1.txt: No such file or directory names the program (cat), the path it tried, and the reason. Read left to right and you have your first hypothesis for free. Search for the error text, not your guess about it, because the exact words are what other people searched for too.

Self-check

  1. What exit code means success?
  2. Name the three parts of cat: /etc/shadow: Permission denied.

Answers: (1) 0. (2) Program, object, problem.

Sources