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:
| Message | Usually means |
|---|---|
Permission denied | Wrong 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 directory | Typo, wrong path, or wrong current folder. Check pwd. |
command not found | Not installed, or typo. Try apt search name. |
No space left on device | Disk full. df -h. |
Could not get lock /var/lib/dpkg/lock | Another apt is running (often automatic updates). Wait. |
Read-only file system | FilesystemThe 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
- What exit code means success?
- Name the three parts of
cat: /etc/shadow: Permission denied.
Answers: (1) 0. (2) Program, object, problem.
Sources
- Bash manual, Exit Status: https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
errnolist: https://man7.org/linux/man-pages/man3/errno.3.html