./deploy.sh to get Permission denied and exit code 126; strace -e execve shows EACCES; switch to findmnt -T to point out noexec.execve(); the decision order DAC → ACL → capabilities → LSM; the apt/dpkg locks and state machine; systemd jobs and result codes (203/EXEC, start-limit-hit, oom-kill); the dependency chain block device → filesystem → mount → fstab; socket → route → NIC → DNS; cloud-init stages and the metadata service; and the OOM killer and cgroup limits.linuxlab (Ubuntu Server 26.04 LTS, user labadmin) and the sample service myapp.service. For faults that need a cloud account, the diagnostic commands and expected output are given.| # | Time | Module | Core content | Animation · interaction | Lab |
|---|---|---|---|---|---|
| 0 | Before class | Instructions and fault lab environment | Take a snapshot of linuxlab; create ~/linuxlab/lab8.sh (inject faults with drop-ins, loop disks, cleanup); confirm myapp.service is running normally | Environment self-check | Generate lab8.sh |
| 1 | 00–08 | A · Files, permissions, users and packages | Problems 1–12: script without execute permission / noexec, CRLF interpreter, immutable attribute, directory traversal permissions, sudoers and its syntax, SSH public keys and directory permissions, changed host keys, dpkg lock, interrupted dpkg, NO_PUBKEY, dnf metadata | Simulator for the execve() and permission checks of one ./deploy.sh run | Execute permission and noexec · CRLF · directory traversal · dpkg lock |
| 2 | 08–16 | A · Services, logs, storage and networking | Problems 13–25: 203/EXEC, starting too often, daemon-reload, 217/USER, logs not persisted, deleted but still in use, inode exhaustion, mount failure, emergency mode, LVM extension not taking effect, port in use, connection refused, temporary DNS failure | Troubleshooting tree: “service won't start / can't connect” | 203/EXEC · start rate limiting · inode exhaustion · port conflicts and listen addresses |
| 3 | 16–24 | A · Linux in the cloud: Azure and AWS | Problems 26–38: Entra sign-in disabled, AADSSHLoginForLinux exit code, Azure fstab emergency mode, temporary disk data loss, cloud-init not applied, VM agent not ready, AMA with no data, EC2 publickey, IMDSv2 401, TargetNotConnected, NVMe device names and resizing, user data not rerun, kernel unable to mount root | Troubleshooting tree: “cloud VM won't connect / won't boot” | cloud-init failures (local Multipass) · findmnt pre-check · IMDSv2 tokens · Entra roles |
| 4 | 24–30 | A · Security, performance and kernel | Problems 39–50: OOM, fork failure, file descriptor exhaustion, conntrack table full, SYN queue overflow, hung task, soft lockup, high load with low CPU, SELinux, AppArmor, clock skew, ext4 read-only | “Memory → process → kernel” resource gate simulator | cgroup OOM · TasksMax · LimitNOFILE |
| 5 | 30–37 | B · Fundamentals and architecture | Interview 1–13 | Mock interview | 2 scenario questions |
| 6 | 37–44 | B · System administration and networking | Interview 14–25 | Mock interview | 2 scenario questions |
| 7 | 44–52 | B · Cloud and automation | Interview 26–38 | Mock interview | 3 scenario questions |
| 8 | 52–60 | B · Security, performance and scenario design | Interview 39–50 | Mock interview | 3 scenario questions |
| — | After class | Quick reference · Capstone drills | 50 “error → first command → fix” entries; 50 flashcards; 8 mixed faults; full mock interview | Full mock interview | 12-question final quiz |
| Topic | m1 | m2 | m3 | m4 | m5 | m6 | m7 | m8 |
|---|---|---|---|---|---|---|---|---|
| Shell, processes, execve and exit codes | ● | ● | — | ● | ● | — | ● | — |
| File permissions, ACLs, attributes, users and sudo | ● | — | ● | ● | ● | — | — | ● |
| Packages: apt / dpkg / dnf and repository signing | ● | — | — | — | ● | — | ● | ● |
| systemd, journald and resource limits | — | ● | ● | ● | ● | ● | — | ● |
| Storage: block devices, LVM, filesystems, fstab | — | ● | ● | ● | — | ● | ● | — |
| Networking: sockets, routes, firewall, DNS, conntrack | — | ● | ● | ● | — | ● | — | ● |
| SSH, identity and access (Entra sign-in / SSM / IMDS) | ● | — | ● | — | — | ● | ● | ● |
| cloud-init, cloud agents, monitoring and patching | — | — | ● | — | — | — | ● | ● |
| Memory, CPU, I/O and kernel logs | — | ● | ● | ● | ● | ● | — | ● |
| SELinux / AppArmor, hardening and auditing | — | — | — | ● | — | — | — | ● |
crash tool) → see the kernel and distribution documentation. This hour covers only the principles behind them, in the interview questions.Permission denied, 203/EXEC, No space, TargetNotConnected, Killed process) into the filter box.Symptom → root cause (mechanism) → diagnostic commands → sample expected output → fix → prevention and best practices → see Hour N → reproduction lab. Titles use the exact error text where possible. Entries marked “Verified against source” were checked against the upstream default-branch source of systemd, the Linux kernel, OpenSSH, APT, util-linux, sudo / sudo-rs and gunicorn. Entries marked “Official docs” come from man7.org, learn.microsoft.com and docs.aws.amazon.com. All others are marked “Check on your system”: prefixes, fields and wording vary with version, locale and distribution patch level.
Question → 30-second answer → in-depth answer (principles, commands/code) → common follow-ups → extra credit points → common wrong answers. Difficulty: JuniorMid-levelSenior. Target roles: Senior Cloud / DevOps / SRE.
| Hour | Most-referenced content in this hour |
|---|---|
| Hour 1 Core fundamentals | The full command execution path (parsing → PATH → fork/exec → permission checks → exit code), permissions and ACLs, users and sudo, apt / dnf, the ~/linuxlab working directory, and the manually run myapp |
| Hour 2 System administration and production readiness | myapp.service (user myapp, /opt/myapp/venv, /etc/myapp/myapp.env, port 5000, /healthz), journald, LVM (loop devices), fstab, ip/ss, SSH hardening, timers |
| Hour 3 Azure · Hour 4 AWS | rg-linux-lab / vm-linux-lab (canadacentral), Entra ID sign-in, AMA and DCR, Update Manager, serial console; Name=linux-lab in ca-central-1 (AL2023), IMDSv2, SSM, CloudWatch Agent, EC2 serial console |
| Hour 5 · Hour 6 · Hour 7 | Robust scripts and ShellCheck, Packer golden images; CIS, SELinux/AppArmor, nftables, PAM, auditd, sysctl, cgroups; the USE method, vmstat/iostat/pidstat, tcpdump, boot rescue, strace/perf/bpftrace |
apt-key removed), sudo-rs as the default sudo (the original is renamed sudo.ws), core tools from rust-coreutils (cp/mv/rm are still the GNU versions), chrony for time sync on new installs, Dracut as the default initramfs tool, and OpenSSH 10.2. Differences from 24.04 LTS (kernel 6.8, systemd 255, APT 2.7, original sudo, GNU coreutils, systemd-timesyncd, initramfs-tools) are marked separately in the relevant problems. RHEL-family comparison: Rocky Linux / AlmaLinux 10.2 (kernel 6.12 series). Upstream references: kernel.org stable 7.3.4, long-term support 6.18 / 6.12 / 6.6 / 6.1 / 5.15 / 5.10; upstream systemd v262.2. All “expected output” examples are samples; PIDs, IPs, times, UUIDs and so on will differ on your system.linuxlab, ~/linuxlab and myapp.service from Hours 1–2. Take a snapshot first; all service faults are injected through a single removable drop-in.linuxlab runs Ubuntu 26.04 LTS (or 24.04; differences are noted per problem), that labadmin has sudo, and that myapp.service is running and /healthz responds normally.~/linuxlab/lab8.sh: inject and remove the myapp.service fault drop-in, create loop disks, view recent service and kernel logs, and clean up in one step.linuxlab (and the temporary VM lab8ci). Use only the hour 3 and hour 4 cloud resources for cloud labs, and restore them when you're done.linuxlab (multipass launch --name linuxlab --cpus 2 --memory 4G --disk 20G; no image is specified, so the current LTS is used; Multipass is currently 1.17.1), the administrator labadmin, and the working directory ~/linuxlab.myapp, code in /opt/myapp/app (app.py; venv at /opt/myapp/venv), config in /etc/myapp/myapp.env (root:myapp 0640), and the unit myapp.service (Type=exec, WorkingDirectory=/opt/myapp/app, SyslogIdentifier=myapp, so log lines start with myapp[PID]:), running gunicorn on 0.0.0.0:5000, depending on redis-server.service, with logs going to journald.rg-linux-lab, vm-linux-lab, canadacentral) or hour 4 (ca-central-1, tag Name=linux-lab, AL2023). Without a cloud account, you can still do the other labs (reading the diagnosis and expected output only).rhellab (Rocky / Alma 10.2) is needed only for the labs for #12 and #47.multipass version multipass info linuxlab | grep -E 'State|Release|IPv4' multipass stop linuxlab && multipass snapshot linuxlab --name pre-lab8 && multipass start linuxlab multipass shell linuxlab
. /etc/os-release; echo "$PRETTY_NAME"; uname -r systemctl --version | head -1 sudo --version | head -1 # 26.04: sudo-rs; 24.04: Sudo version 1.9.x systemctl is-active myapp redis-server curl -fsS http://127.0.0.1:5000/healthz; echo
Ubuntu 26.04 LTS
7.0.0-15-generic
systemd 259 (259.x-…ubuntu…)
sudo-rs 0.2.x
active
active
{"status":"ok","redis":true}
Snapshots require stopping the instance first (Multipass 1.13 and later support snapshot / restore). To restore: multipass stop linuxlab && multipass restore linuxlab.pre-lab8. Version numbers and output formats depend on your setup. For Hyper-V / VirtualBox, use their own checkpoints or snapshots. WSL2 has no snapshots, but you can back it up with wsl --export. Its systemd must be enabled in /etc/wsl.conf, and the disk and kernel are managed by WSL, so results for the storage and kernel labs (#20–#22, #44–#50) will differ.
All service faults are written to /etc/systemd/system/myapp.service.d/lab8.conf; deleting that file and running daemon-reload restores the service. All storage faults use loop images under /var/tmp/lab8, so the system disk is not touched.
mkdir -p ~/linuxlab && cat > ~/linuxlab/lab8.sh <<'EOF'
# Usage: source ~/linuxlab/lab8.sh
L8=/var/tmp/lab8; DROP=/etc/systemd/system/myapp.service.d/lab8.conf
# Inject drop-in: reads [Service] etc. from stdin
l8_inject() { sudo mkdir -p "${DROP%/*}" && sudo tee "$DROP" >/dev/null && sudo systemctl daemon-reload && echo "injected: $DROP"; }
# Heal: remove the fault, clear the failure count, restart
l8_heal() { sudo rm -f "$DROP"; sudo systemctl daemon-reload; sudo systemctl reset-failed myapp; sudo systemctl restart myapp; systemctl is-active myapp; }
# Last N lines of service / kernel logs
l8_log() { journalctl -u "${2:-myapp}" -n "${1:-15}" --no-pager -o short-iso; }
l8_klog() { sudo journalctl -k -n "${1:-15}" --no-pager -o short-iso; }
# Create a loop disk: l8_loop <name> <size, e.g. 200M>; prints the device name
l8_loop() { sudo mkdir -p $L8 && sudo truncate -s "${2:-200M}" "$L8/$1.img" && sudo losetup -fP --show "$L8/$1.img"; }
# Clean up: unmount /mnt/lab8*, release loop devices, delete the images and the drop-in
l8_clean() {
for m in $(findmnt -rno TARGET | grep '^/mnt/lab8'); do sudo umount -l "$m"; done
losetup -nO NAME,BACK-FILE | awk -v p="$L8" 'index($2,p){print $1}' | xargs -r -n1 sudo losetup -d
sudo rm -rf "$L8" /mnt/lab8*; l8_heal >/dev/null; echo "lab8 cleaned"
}
EOF
source ~/linuxlab/lab8.sh && type l8_inject | head -1
l8_inject is a function
systemctl cat myapp | grep -E '^(Type|User|WorkingDirectory|EnvironmentFile|SyslogIdentifier|ExecStart|Restart)=' stat -c '%U:%G %a %n' /etc/myapp/myapp.env df -hT / ; df -i / | tail -1 ss -ltnp | grep -E ':5000|:6379' resolvectl status | grep -E 'Current DNS|DNS Servers' | head -2
Type=exec
User=myapp
WorkingDirectory=/opt/myapp/app
EnvironmentFile=/etc/myapp/myapp.env
SyslogIdentifier=myapp
ExecStart=/opt/myapp/venv/bin/gunicorn -w 2 -b 0.0.0.0:5000 app:app
Restart=on-failure
root:myapp 640 /etc/myapp/myapp.env
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 19G 2.9G 16G 16% /
/dev/sda1 1245184 98123 1147061 8% /
LISTEN 0 2048 0.0.0.0:5000 0.0.0.0:* users:(("gunicorn",pid=1234,fd=5),…)
LISTEN 0 511 127.0.0.1:6379 0.0.0.0:* users:(("redis-server",pid=987,fd=6))
Current DNS Server: 10.122.0.1
DNS Servers: 10.122.0.1
uptime, dmesg -T | tail, vmstat 1, mpstat -P ALL 1, pidstat 1, iostat -xz 1, free -m, sar -n DEV 1, sar -n TCP,ETCP 1, top), strace -f, and bpftrace.~/linuxlab/faults/ (inject.sh / reset.sh / status.sh / blindbox.sh; the disk faults use a loop ext4 at /mnt/faultdisk) does not interfere with this hour. Before you start, run ~/linuxlab/faults/status.sh to confirm nothing is left over, and run ~/linuxlab/faults/reset.sh if needed. This hour uses only /mnt/lab8*, /var/tmp/lab8 and the drop-in lab8.conf.sudo -i) before you make changes. For the fstab lab (#21), use only the findmnt --verify and systemd-analyze pre-checks; do not reboot. For all cloud labs, write down the cost and the cleanup commands. If something goes wrong: multipass restore linuxlab.pre-lab8.source ~/linuxlab/lab8.sh && l8_clean multipass delete --purge lab8ci 2>/dev/null # On the local machine: delete the temporary VM from problem #30 sudo systemctl status myapp --no-pager | head -3
./deploy.sh: the x (search) permission on each directory in the path → the noexec mount option → the file's own x permission (owner / group / other, ACLs) → recognizing #! and then execve of the interpreter → LSM (AppArmor / SELinux). Each failing step maps to an errno: EACCES, ENOENT, EPERM.lock-frontend, the database lock lock, half-configured states and dpkg --configure -a. With APT 3.1, repository signing uses signed-by + deb822 .sources files.Type a keyword from the error (such as Permission denied, interpreter, sudoers, publickey, lock, NO_PUBKEY) to filter; click a line to jump to its details.
labadmin@linuxlab:~/linuxlab$ ./deploy.sh -bash: ./deploy.sh: Permission denied labadmin@linuxlab:~/linuxlab$ ls -l deploy.sh -rw-r--r-- 1 labadmin labadmin 412 Nov 17 09:12 deploy.sh
Symptom: A script pulled from Git or copied with scp cannot be run directly. More subtle: after chmod +x, you still get Permission denied in /tmp or on a data disk, yet bash deploy.sh works.
Root cause: execve() requires: ① the caller has x (search) permission on every directory in the path; ② the caller has x permission on the file (root also needs at least one x bit); ③ the filesystem is not mounted with noexec. CIS baselines often set /tmp, /var/tmp and /dev/shm to noexec. Git records only 100755 / 100644, and files committed from Windows often lose the executable bit. bash deploy.sh works because it is /usr/bin/bash that gets executed, and the script is only read. So noexec is not a security boundary; it only prevents accidental execution.
ls -l deploy.sh; namei -l "$PWD/deploy.sh" # check directory and file permissions level by level findmnt -no TARGET,OPTIONS -T deploy.sh # mount point and options (look for noexec) getfacl -p deploy.sh 2>/dev/null | grep -v '^#' git ls-files -s deploy.sh # mode recorded in the repo: 100644 / 100755
-rwxr-xr-x 1 labadmin labadmin 412 Nov 17 09:12 deploy.sh f: /tmp/deploy.sh drwxr-xr-x root root / drwxrwxrwt root root tmp -rwxr-xr-x labadmin labadmin deploy.sh /tmp rw,nosuid,nodev,noexec,relatime 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 deploy.sh
chmod +x deploy.sh && git update-index --chmod=+x deploy.sh && git commit -m "make deploy.sh executable" # noexec mount: don't remove noexec; move the script to a suitable location install -m 0755 deploy.sh ~/linuxlab/bin/deploy.sh # or /usr/local/bin (needs sudo)
git update-index --chmod=+x; check it with test -x in CI.TMPDIR to a private directory without noexec. Don't remove the noexec setting on /tmp.NoExecPaths= / ExecPaths=.See Hour 1 Module 3: file permissions, ownership and ACLs and Hour 6 Module 1: hardening baseline (CIS).
$ ./deploy.sh -bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory $ ./healthcheck.sh # when the first line is #!/usr/bin/env bash /usr/bin/env: 'bash\r': No such file or directory
Symptom: The script was edited on Windows or converted by a tool, and now it won't run. /bin/bash exists, yet the error says it can't be found.
Root cause: The file uses CRLF line endings. The kernel takes everything after #! up to \n as the interpreter path, so it tries to run the nonexistent /bin/bash\r. execve returns ENOENT, and bash shows “bad interpreter”; ^M is the carriage return \r. Similar causes: a wrong interpreter path (#!/bin/python), or distributions such as Alpine that don't ship bash.
head -1 deploy.sh | od -c | head -2 # look for \r \n file deploy.sh grep -c $'\r' deploy.sh # count the lines containing CR
0000000 # ! / b i n / b a s h \r \n deploy.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators 17
sed -i 's/\r$//' deploy.sh # or: sudo apt install dos2unix && dos2unix deploy.sh printf '*.sh text eol=lf\n' >> .gitattributes && git add --renormalize . && git commit -m "normalize line endings"
eol=lf in the repository with .gitattributes; set the editor to LF; run ShellCheck in CI (it reports SC1017 “Literal carriage return”).#!/usr/bin/env bash is more portable, but it is affected by CRLF in the same way.See Hour 1 Module 2: shell and the filesystem hierarchy, Bash course hour 7 Module 2: ShellCheck, and Git 8 hours (line endings).
$ sudo rm /var/log/myapp/app.log rm: cannot remove '/var/log/myapp/app.log': Operation not permitted $ sudo truncate -s0 /var/log/myapp/app.log truncate: cannot open '/var/log/myapp/app.log' for writing: Operation not permitted
Symptom: root's delete, rename or write to a file returns EPERM (not EACCES), even though the permission bits look normal.
Root cause: the file has the extended attribute i (immutable: it can't be changed, deleted or linked) or a (append-only: it can only be appended to). The filesystem enforces this, so even root is bound by it; only a process holding CAP_LINUX_IMMUTABLE can clear it. Common sources: “tamper-proofing” scripts, security hardening, and log-shipping agents. If a directory has i, no files can be created or deleted in it. Other reasons root gets EPERM / EROFS: a read-only mount, an overlay lower layer, or an LSM denial.
lsattr /var/log/myapp/app.log /var/log/myapp -d findmnt -no OPTIONS -T /var/log/myapp sudo journalctl -k --since -10min | grep -iE 'apparmor|avc' | tail -3
----i---------e------- /var/log/myapp/app.log --------------e------- /var/log/myapp rw,relatime
sudo chattr -i /var/log/myapp/app.log && sudo rm /var/log/myapp/app.log # Log tamper protection: use append-only rather than immutable; logrotate's prerotate/postrotate removes and re-adds the attribute
attributes); otherwise, rotation and upgrades will fail.See Hour 1 Module 3 and Hour 6 Module 5: auditing.
$ journalctl -u myapp -n 3 --no-pager myapp[2210]: File "/opt/myapp/app/app.py", line 31, in save myapp[2210]: with open(DATA, "a") as f: myapp[2210]: PermissionError: [Errno 13] Permission denied: '/opt/myapp/data/counter.db'
Symptom: The file is -rw-rw-rw-, yet the myapp user still can't open it; or it can read the file but can't create new files.
Root cause: To reach a path, you need x (search) permission on every parent directory. Creating, deleting or renaming an entry in a directory requires w+x on that directory, regardless of the file's own permissions. Typical case: a deployment script creates /opt/myapp/data as root:root 0750, or a root shell with umask 077 creates the directory. Evaluation order: owner → named-user ACL → group / named-group ACL (limited by the mask) → other. Only the first matching class applies; if the owner bits are more restrictive, “other” is not checked either.
sudo -u myapp namei -l /opt/myapp/data/counter.db sudo -u myapp test -w /opt/myapp/data && echo dir-writable || echo dir-NOT-writable getfacl -p /opt/myapp/data id myapp
f: /opt/myapp/data/counter.db
drwxr-xr-x root root /
drwxr-xr-x root root opt
drwxr-xr-x myapp myapp myapp
drwxr-x--- root root data
counter.db - Permission denied
dir-NOT-writable
uid=998(myapp) gid=998(myapp) groups=998(myapp)
sudo install -d -o myapp -g myapp -m 0750 /opt/myapp/data # Better: let systemd manage the writable directory (created automatically, owner set) sudo systemctl edit myapp # under [Service], add StateDirectory=myapp, and have the code use $STATE_DIRECTORY (/var/lib/myapp)
root:root and read-only. Put writable data in /var/lib/<app> (StateDirectory=), logs in journald, and caches with CacheDirectory=.sudo -u <service user> namei -l <path>; don't check as root.chmod -R 777: that widens the attack surface and doesn't help with the parent directories.See Hour 1 Module 3 and Hour 2 Module 1: systemd.
# 24.04 (original sudo 1.9.x) $ sudo systemctl restart myapp [sudo] password for bob: bob is not in the sudoers file. # 26.04 (sudo-rs is the default sudo) $ sudo systemctl restart myapp [sudo: authenticate] Password: sudo: I'm sorry bob. I'm afraid I can't do that
Symptom: A new colleague's password is correct, but sudo still refuses. They were just added with usermod -aG sudo bob, yet their terminal is still refused.
Root cause: Authentication (the password is correct) and authorization (whether a matching sudoers rule exists) are two separate steps. Ubuntu's default rule is %sudo ALL=(ALL:ALL) ALL (on the RHEL family it's %wheel). Group membership is determined at login: an existing session does not pick up a new group, so you have to log in again (or use newgrp / su - bob). Another cause: the user was added to admin / wheel rather than the group this distribution uses. The original sudo logs the “incident”; sudo-rs prints different messages and writes a different log format, so scripts should not grep for the exact wording.
id bob; getent group sudo sudo -l -U bob # run by an administrator who has permission sudo grep -rhE '^\s*%?(sudo|wheel|admin)\b' /etc/sudoers /etc/sudoers.d/ 2>/dev/null sudo journalctl _COMM=sudo -n 5 --no-pager
uid=1001(bob) gid=1001(bob) groups=1001(bob) sudo:x:27:labadmin User bob is not allowed to run sudo on linuxlab. %sudo ALL=(ALL:ALL) ALL
sudo usermod -aG sudo bob # takes effect after bob logs in again; verify: id shows 27(sudo) # Manage only myapp: grant minimal privileges, not full sudo echo 'bob ALL=(root) /usr/bin/systemctl restart myapp, /usr/bin/journalctl -u myapp *' | sudo tee /etc/sudoers.d/50-bob-myapp sudo chmod 0440 /etc/sudoers.d/50-bob-myapp && sudo visudo -cf /etc/sudoers.d/50-bob-myapp
visudo -c.sudo.ws (check the release notes).See Hour 1 Module 4: users, groups and sudo and Hour 6 Module 4: PAM and sudo policy.
$ sudo -i
/etc/sudoers.d/myapp:1:28: syntax error
myapp ALL=(root) NOPASSWD systemctl restart myapp
^~~~~~~~~
sudo: parse error in /etc/sudoers.d/myapp near line 1
sudo: no valid sudoers sources found, quitting
Symptom: Someone wrote a rule straight into the file with echo ... >> /etc/sudoers.d/myapp, and afterwards nobody can use sudo. A cloud VM has no root password, so they locked themselves out.
Root cause: sudo parses all sudoers files at startup (including @includedir /etc/sudoers.d), and a syntax error in any one snippet invalidates the whole policy (the default for the original sudo). In the example above, NOPASSWD: is missing a colon, and the command is not an absolute path. Another common mistake: the file permissions are not 0440, or the owner is not root; the original sudo refuses unsafe files.
sudo visudo -c # if sudo is already broken, run this from the recovery path below ls -l /etc/sudoers.d/ pkexec visudo -c 2>/dev/null || echo "pkexec is unavailable (servers usually have no polkit agent)"
visudo -f /etc/sudoers.d/myapp directly to correct the file or delete it.multipass exec linuxlab -- sudo ... also goes through sudo, so it won't work; use snapshot restore, or enter recovery mode from GRUB / systemd.unit=rescue.target.az vm run-command invoke --command-id RunShellScript --scripts "rm /etc/sudoers.d/myapp" (runs as root through the VM agent), the serial console, or the VMAccess extension. AWS: SSM Run Command (AWS-RunShellScript, runs as root) or the EC2 serial console.sudo visudo -f /etc/sudoers.d/myapp # Contents: myapp ALL=(root) NOPASSWD: /usr/bin/systemctl restart myapp sudo visudo -cf /etc/sudoers.d/myapp && sudo chmod 0440 /etc/sudoers.d/myapp
visudo -f or through configuration management (Ansible community.general.sudoers / template with validate: visudo -cf %s).See Hour 1 Module 4, Hour 3 Module 7: serial console, and Hour 4 Module 7.
$ ssh labadmin@10.0.0.4 labadmin@10.0.0.4: Permission denied (publickey). # server journalctl -u ssh: sshd[1532]: Authentication refused: bad ownership or modes for directory /home/labadmin/.ssh
Symptom: The key is in authorized_keys, yet login fails; or one day nobody can log in to a machine.
Root cause: sshd defaults to StrictModes yes: if the home directory, ~/.ssh, or authorized_keys can be written by anyone other than the owner (and root), it refuses the keys in that file. Common triggers: chmod -R 777 /home/labadmin, creating .ssh as root (wrong owner), or restoring a backup after the UID changed. Other causes: the client did not offer the right private key (check with ssh -v for “Offering public key”), the server policy rejects the key type (OpenSSH 10 has removed DSA), AllowUsers / AllowGroups restrictions, or a locked account.
ssh -v labadmin@10.0.0.4 2>&1 | grep -E 'Offering|Authentications that can continue|Server accepts' # On the server (via the console or another session): sudo journalctl -u ssh -n 20 --no-pager | grep -iE 'refused|invalid|Accepted' namei -l /home/labadmin/.ssh/authorized_keys sudo sshd -T | grep -E 'strictmodes|pubkeyauthentication|allowusers|authorizedkeysfile'
debug1: Offering public key: /home/me/.ssh/id_ed25519 ED25519 SHA256:… explicit debug1: Authentications that can continue: publickey drwxr-xr-x root root / drwxr-xr-x root root home drwxrwxrwx labadmin labadmin labadmin drwx------ labadmin labadmin .ssh -rw------- labadmin labadmin authorized_keys strictmodes yes
sudo chmod 755 /home/labadmin # or 750; the key is to remove group/other write permission sudo chown -R labadmin:labadmin /home/labadmin/.ssh chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
StrictModes. Distribute keys with ssh-copy-id or cloud-init's ssh_authorized_keys.TrustedUserCAKeys) or cloud identity (Entra sign-in, EC2 Instance Connect, SSM) so you don't have scattered long-lived public keys.See Hour 2 Module 6: SSH keys, configuration and hardening and Hour 6 Module 4: SSH certificates.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! … Offending ED25519 key in /home/me/.ssh/known_hosts:7 Host key verification failed.
Symptom: After rebuilding vm-linux-lab or an EC2 instance and reusing the same IP / DNS name, SSH refuses connections, and CI deployments fail too.
Root cause: On first boot of a new instance, cloud-init generates new host keys (unique per instance, which is normal). The client's known_hosts still holds the old key, and SSH can't tell a rebuilt machine from a man-in-the-middle attack, so it refuses.
ssh-keygen -F 10.0.0.4 # fingerprint recorded locally ssh-keyscan -t ed25519 10.0.0.4 2>/dev/null | ssh-keygen -lf - # Get the new host's real fingerprint out-of-band (Azure boot diagnostics / AWS console output; cloud-init prints it) aws ec2 get-console-output --instance-id i-0abc… --latest --output text | grep -A3 'BEGIN SSH HOST KEY FINGERPRINTS'
ssh-keygen -R 10.0.0.4 # delete the old record only after the fingerprint matches ssh labadmin@10.0.0.4 # accept again (or pre-populate known_hosts)
StrictHostKeyChecking=no in CI. Use SSH host certificates (@cert-authority), or take the fingerprint from the console output or metadata when the instance is created and distribute it.az ssh vm or other channels that don't depend on known_hosts.$ sudo apt install -y jq E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1873 (unattended-upgr) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
Symptom: On a new VM, apt install in cloud-init / user data fails now and then; running it manually also reports a lock.
Root cause: apt/dpkg uses fcntl record locks so that only one front end modifies the package database at a time. After a new machine boots, unattended-upgrades, apt-daily.service and cloud-init's package_update are often running. A lock is a kernel object held by a process and released when the process exits. Deleting the lock file does not unlock anything; it only lets two processes write the database at once and corrupt it (#10).
sudo fuser -v /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock ps -o pid,etime,cmd -p 1873 systemctl list-jobs; systemctl status apt-daily.service apt-daily-upgrade.service --no-pager | grep -E 'Active|Main PID' cloud-init status
USER PID ACCESS COMMAND
/var/lib/dpkg/lock-frontend: root 1873 F.... unattended-upgr
PID ELAPSED CMD
1873 03:12 /usr/bin/python3 /usr/bin/unattended-upgrade
status: running
# Wait for the lock instead of deleting it: APT supports a lock-wait timeout sudo apt-get -o DPkg::Lock::Timeout=600 install -y jq # cloud-init: use the packages: module, or run cloud-init status --wait before runcmd
DPkg::Lock::Timeout consistently (the Ansible apt module has lock_timeout).See Hour 1 Module 6: package management and Hour 5 Module 5: patch automation.
$ sudo apt upgrade E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Symptom: During an upgrade the SSH session drops, the VM reboots, or the OOM killer strikes; afterwards every apt command errors. Sometimes a package sits in the iF (half-installed) state, and its service won't start.
Root cause: dpkg installs a package in two steps, unpack and configure (which runs the maintainer scripts), and records each package's state in /var/lib/dpkg/status. If the process is interrupted, the state stops at half-installed / unpacked / half-configured, and apt refuses to continue on an inconsistent database. If postinst itself fails (for example, a bad service configuration makes systemctl start fail), rerunning it still fails, so the root cause must be fixed first.
dpkg --audit dpkg -l | awk '$1 !~ /^(ii|rc)$/ && NR>5' sudo tail -20 /var/log/dpkg.log; sudo tail -30 /var/log/apt/term.log
The following packages are only half configured, probably due to problems configuring them the first time. The configuration should be retried using dpkg --configure <package> or the configure menu option in dselect: redis-server Persistent key-value database with network interface iF redis-server 5:8.x amd64 Persistent key-value database …
sudo dpkg --configure -a sudo apt-get -f install # fix dependencies # If postinst keeps failing: check the errors in term.log, fix the configuration, then rerun; don't hand-edit /var/lib/dpkg/status
tmux / screen. In production, have Update Manager / Patch Manager run upgrades during a maintenance window.dpkg --audit result in your post-upgrade health checks.See Hour 1 Module 6.
$ sudo apt update Err:5 https://packages.example.com/apt stable InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4A3B2C1D0E9F8A7B E: The repository 'https://packages.example.com/apt stable InRelease' is not signed.
Symptom: After adding a third-party repository, apt update fails. Following an old tutorial and running apt-key adv --recv-keys reports that the command doesn't exist on 26.04.
Root cause: APT uses gpgv to verify the InRelease signature, and the key must be in a keyring that the repository is allowed to use. 26.04 (APT 3.1) has removed apt-key. The modern approach: put the public key in /etc/apt/keyrings/ (or /usr/share/keyrings/), and bind it to that repository with Signed-By: in a deb822 .sources file, so the third-party key cannot sign for other repositories. Another cause: the vendor rotated its signing key and the local key file is outdated.
grep -rn . /etc/apt/sources.list.d/*.sources | grep -E 'URIs|Suites|Signed-By' gpg --show-keys --with-subkey-fingerprints /etc/apt/keyrings/example.gpg 2>/dev/null | grep -E '^(pub|sub)|expires|expired' apt-config dump | grep -i 'Signed-By' | head -3
sudo install -d -m 0755 /etc/apt/keyrings curl -fsSL https://packages.example.com/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/example.gpg sudo tee /etc/apt/sources.list.d/example.sources >/dev/null <<'EOF' Types: deb URIs: https://packages.example.com/apt Suites: stable Components: main Signed-By: /etc/apt/keyrings/example.gpg EOF sudo apt update
[trusted=yes].apt update in CI to catch key rotations early.See Hour 1 Module 6: package management: apt, dnf and repositories.
$ sudo dnf install -y redis Errors during downloading metadata for repository 'appstream': - Curl error (6): Couldn't resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-10 [Could not resolve host: mirrors.rockylinux.org] Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name …
Symptom: Package installation fails on the RHEL-family lab machine while an Ubuntu machine on the same subnet works; or you get Curl error (28): Timeout was reached or a GPG check failure.
Root cause: dnf first downloads the metadata (repomd.xml) for every enabled repository, choosing mirrors through mirrorlist / metalink, and if any enabled repository fails, the whole operation aborts (unless skip_if_unavailable=True). Check layer by layer: DNS (#25) → egress / proxy (for a corporate proxy, set proxy= in /etc/dnf/dnf.conf) → a firewall that allows only some mirrors → a clock error causing TLS failures (#49) → a repository that is disabled or end-of-life.
dnf repolist -v 2>/dev/null | grep -E 'Repo-id|Repo-mirrors|Repo-baseurl' | head getent hosts mirrors.rockylinux.org || echo DNS-FAIL curl -sSI https://mirrors.rockylinux.org/ | head -1 grep -E '^(proxy|skip_if_unavailable)' /etc/dnf/dnf.conf; timedatectl | grep -E 'synchronized|Local time'
sudo resolvectl status | head; sudo systemctl restart systemd-resolved # or fix the DNS settings in NetworkManager sudo dnf clean all && sudo dnf makecache # Internal network: use an internal mirror (baseurl) or Satellite / Pulp; dnf config-manager --set-disabled to temporarily disable unreachable repositories
apt update ↔ dnf makecache, apt-cache policy ↔ dnf info / dnf repoquery, dpkg -S ↔ rpm -qf. Fedora already defaults to dnf5; for the dnf version on RHEL 10 series, check the release notes../deploy.sh runPick a case and click “Run” to see which step fails, which errno you get, and what the terminal shows. Order (simplified): shell → fork() → execve() → kernel checks → run.
linuxlab, with source ~/linuxlab/lab8.sh already run. All files go in ~/linuxlab/lab8 and /var/tmp/lab8; run the cleanup step at the end.mkdir -p ~/linuxlab/lab8 && cd ~/linuxlab/lab8 printf '#!/bin/bash\necho "deploy ok from $PWD"\n' > deploy.sh ./deploy.sh; echo "exit=$?"
-bash: ./deploy.sh: Permission denied exit=126
126 = found but not executable; 127 = command not found.
noexec mount, and verify that the x bit can't rescue it:chmod +x deploy.sh && ./deploy.sh DEV=$(l8_loop ne 64M) && sudo mkfs.ext4 -q "$DEV" && sudo mkdir -p /mnt/lab8ne && sudo mount -o noexec "$DEV" /mnt/lab8ne sudo install -m 0755 -o labadmin deploy.sh /mnt/lab8ne/ && /mnt/lab8ne/deploy.sh; bash /mnt/lab8ne/deploy.sh
deploy ok from /home/labadmin/linuxlab/lab8 -bash: /mnt/lab8ne/deploy.sh: Permission denied deploy ok from /home/labadmin/linuxlab/lab8
strace -f -e trace=execve /mnt/lab8ne/deploy.sh 2>&1 | tail -2
execve("/mnt/lab8ne/deploy.sh", ["/mnt/lab8ne/deploy.sh"], 0x7ffd… /* 24 vars */) = -1 EACCES (Permission denied)cd ~/linuxlab/lab8 && printf '#!/bin/bash\r\necho hi\r\n' > crlf.sh && chmod +x crlf.sh ./crlf.sh; file crlf.sh
-bash: ./crlf.sh: /bin/bash^M: bad interpreter: No such file or directory crlf.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators
sed -i 's/\r$//' crlf.sh && ./crlf.sh
hi
myapp when a parent directory has no x permission:sudo install -d -o root -g root -m 0700 /var/tmp/lab8/secret echo 42 | sudo tee /var/tmp/lab8/secret/counter.db >/dev/null && sudo chmod 666 /var/tmp/lab8/secret/counter.db sudo -u myapp cat /var/tmp/lab8/secret/counter.db sudo -u myapp namei -l /var/tmp/lab8/secret/counter.db | tail -2
cat: /var/tmp/lab8/secret/counter.db: Permission denied
drwx------ root root secret
counter.db - Permission deniedThe cat in 26.04 comes from rust-coreutils, so the error prefix wording may differ slightly from GNU; check your system.
sudo setfacl -m u:myapp:x /var/tmp/lab8/secret && sudo -u myapp cat /var/tmp/lab8/secret/counter.db sudo chattr +i /var/tmp/lab8/secret/counter.db && sudo rm /var/tmp/lab8/secret/counter.db; lsattr /var/tmp/lab8/secret/counter.db sudo chattr -i /var/tmp/lab8/secret/counter.db
42 rm: cannot remove '/var/tmp/lab8/secret/counter.db': Operation not permitted ----i---------e------- /var/tmp/lab8/secret/counter.db
fcntl(F_SETLK) and checks the holder with F_GETLK; flock(1) is a different kind of lock that APT can't see):sudo python3 -c 'import fcntl,time; f=open("/var/lib/dpkg/lock-frontend","w"); fcntl.lockf(f, fcntl.LOCK_EX); time.sleep(30)' &
sleep 1; sudo apt-get install -y jq 2>&1 | grep -E '^E:' | head -2
sudo fuser -v /var/lib/dpkg/lock-frontendE: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 4321 (python3)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
USER PID ACCESS COMMAND
/var/lib/dpkg/lock-frontend: root 4321 F.... python3sudo apt-get -o DPkg::Lock::Timeout=120 install -y jq >/dev/null && jq --version
jq-1.8.x
sudo umount /mnt/lab8ne; l8_clean; rm -rf ~/linuxlab/lab8
No verified video specifically covering CRLF interpreters, chattr immutable attributes, or the APT 3 signing migration was found. Here is a 3-minute storyboard you can record yourself:
./deploy.sh to get Permission denied and exit code 126; strace -e execve shows EACCES; switch to findmnt -T to point out noexec.od -c to zoom in on \r, explaining that the kernel treats /bin/bash\r as the interpreter path.sudo -u myapp namei -l to walk through the parent directory that was refused, then use setfacl -m u:myapp:x to fix it precisely.fuser -v /var/lib/dpkg/lock-frontend finds unattended-upgr; demonstrates DPkg::Lock::Timeout.systemctl ("Job for … failed because …"), the unit Result (exit-code, start-limit-hit, oom-kill…), and the main process exit status (203/EXEC, 217/USER, and 200/CHDIR are failures systemd hits before exec; 1, 2, and 3 are the application exiting on its own).Filter by error keyword (for example 203, too quickly, daemon-reload, No space, emergency, refused, or resolution). Click a row to jump to the details.
$ sudo systemctl restart myapp
Job for myapp.service failed because the control process exited with error code.
See "systemctl status myapp.service" and "journalctl -xeu myapp.service" for details.
$ systemctl status myapp --no-pager | sed -n '3,6p'
Active: failed (Result: exit-code) since Mon 2026-11-17 10:02:11 UTC; 3s ago
Process: 3120 ExecStart=/opt/myapp/venv/bin/gunicorn … (code=exited, status=203/EXEC)
Main PID: 3120 (code=exited, status=203/EXEC)
Symptom: after you rebuild the venv, upgrade Python, or change ExecStart, the service won't start. Running the same command by hand in the shell works.
Root cause: 203/EXEC: systemd calls execve() after the fork, and the call fails, so the application code never runs. Common causes: the path does not exist (the venv was deleted or rebuilt with a different Python version, so the #! line of a script in the venv points to an interpreter that is gone), no execute (x) bit, a non-absolute ExecStart path (required by older versions), a noexec mount, or a wrong SELinux label. The log shows the specific errno. Related exit codes: 200/CHDIR (WorkingDirectory does not exist), 217/USER (#16), and 226/NAMESPACE (a sandboxing option refers to a path that does not exist).
journalctl -u myapp -b -n 20 --no-pager -o cat | grep -iE 'exec|failed|error' systemctl show myapp -p ExecStart -p WorkingDirectory -p User --no-pager ls -l /opt/myapp/venv/bin/gunicorn; head -1 /opt/myapp/venv/bin/gunicorn sudo -u myapp /opt/myapp/venv/bin/gunicorn --version
myapp.service: Unable to locate executable '/opt/myapp/venv/bin/gunicorn': No such file or directory myapp.service: Failed at step EXEC spawning /opt/myapp/venv/bin/gunicorn: No such file or directory myapp.service: Main process exited, code=exited, status=203/EXEC myapp.service: Failed with result 'exit-code'.
sudo -u myapp python3 -m venv /opt/myapp/venv && sudo -u myapp /opt/myapp/venv/bin/pip install -r /opt/myapp/app/requirements.txt sudo systemctl restart myapp && systemctl is-active myapp
systemd-analyze verify myapp.service on the unit file in CI. After deployment, run a smoke test against /healthz and roll back automatically if it fails.See Hour 2 Module 1 systemd: Units, Services and Dependencies.
$ journalctl -u myapp -n 6 --no-pager -o cat myapp.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED myapp.service: Failed with result 'exit-code'. myapp.service: Scheduled restart job, restart counter is at 5. myapp.service: Start request repeated too quickly. myapp.service: Failed with result 'start-limit-hit'. $ sudo systemctl start myapp Job for myapp.service failed because start of the service was attempted too often.
Symptom: the service crashes repeatedly within a few seconds and then stops for good, and Restart=on-failure no longer brings it back. Even after you fix the configuration, systemctl start is still refused.
Root cause: start rate limiting. By default, at most StartLimitBurst=5 starts are allowed within StartLimitIntervalSec=10s (the defaults come from DefaultStartLimit*). If the limit is exceeded, the unit enters the start-limit-hit failed state until the interval passes or you run reset-failed by hand. The real root cause is the first failure. In the example above, gunicorn exited with status 3, which is typically caused by a worker import failure, a Redis connection failure, or a configuration error.
journalctl -u myapp -b --no-pager -o cat | grep -m1 -B2 -A8 'Traceback\|Error\|error' # find the first failure systemctl show myapp -p NRestarts -p Result -p StartLimitBurst -p StartLimitIntervalUSec -p RestartUSec
NRestarts=5 Result=start-limit-hit StartLimitBurst=5 StartLimitIntervalUSec=10s RestartUSec=100ms
sudoedit /etc/myapp/myapp.env # fix the root cause (for example, a wrong REDIS_URL) sudo systemctl reset-failed myapp && sudo systemctl start myapp
RestartSec=2s to 5s, and set StartLimitIntervalSec/StartLimitBurst in the [Unit] section. This prevents a storm of fast failures from filling the logs and overloading dependencies.After=redis-server.service with Wants= or Requires=, and have the application retry dependencies with backoff. Set an alert on start-limit-hit (for example, send a notification with OnFailure=).See Hour 2 Module 1.
$ sudo vim /etc/systemd/system/myapp.service # change -w 2 to -w 4 $ sudo systemctl restart myapp Warning: The unit file, source configuration file or drop-ins of myapp.service changed on disk. Run 'systemctl daemon-reload' to reload units. $ systemctl show myapp -p ExecStart | grep -o '\-w [0-9]' -w 2
Symptom: you changed the unit file, but the behavior does not change after a restart. Or you changed a drop-in, but the service still uses the old environment variables.
Root cause: systemd (PID 1) keeps the parsed units in memory, so changes to files on disk take effect only after daemon-reload. The file that EnvironmentFile= points to is read at every start, so changing it only requires a service restart. Unit files and drop-ins require daemon-reload.
systemctl show myapp -p NeedDaemonReload -p FragmentPath -p DropInPaths systemctl cat myapp # what is on disk (including drop-ins) systemd-delta --type=extended,overridden | grep myapp
NeedDaemonReload=yes FragmentPath=/etc/systemd/system/myapp.service DropInPaths=/etc/systemd/system/myapp.service.d/override.conf
sudo systemctl daemon-reload && sudo systemctl restart myapp # Better: run systemctl edit myapp to edit the drop-in; it runs daemon-reload automatically
/usr/lib/systemd/system/ directly, because upgrades overwrite them. Write a drop-in with systemctl edit instead.daemon_reload: true option of the Ansible systemd_service module).See Hour 2 Module 1.
myapp.service: Failed to determine user credentials: No such process myapp.service: Failed at step USER spawning /opt/myapp/venv/bin/gunicorn: No such process myapp.service: Main process exited, code=exited, status=217/USER # another case: myapp[3301]: KeyError: 'REDIS_URL'
Symptom: a developer runs gunicorn app:app in their own shell and it works, but it fails when handed to systemd.
Root cause: a systemd service runs in a different environment from an interactive shell. It does not read ~/.bashrc or ~/.profile, PATH is a minimal set, and it does not pick up settings from HOME. Environment variables come only from Environment= and EnvironmentFile=. The working directory defaults to /, and the user is set by User=. 217/USER: the user named by User= does not exist (for example, myapp was never created on the new machine, or the name is misspelled). If EnvironmentFile= points to a missing file and has no - prefix, the unit fails to start. A misspelled variable name makes the application raise a KeyError.
getent passwd myapp systemctl show myapp -p User -p Group -p WorkingDirectory -p EnvironmentFiles -p Environment sudo systemd-run --pty --uid=myapp -p EnvironmentFile=/etc/myapp/myapp.env -p WorkingDirectory=/opt/myapp/app env | sort | head sudo cat /proc/$(systemctl show -p MainPID --value myapp)/environ | tr '\0' '\n' # actual environment of the running process
sudo useradd --system --home-dir /opt/myapp --shell /usr/sbin/nologin myapp # if the user is missing echo 'REDIS_URL=redis://127.0.0.1:6379/0' | sudo tee -a /etc/myapp/myapp.env sudo systemctl restart myapp
systemd-run --pty in the same environment as the service, not in your own shell.DynamicUser=yes (no need to pre-create the user), or declare the system user with sysusers.d. Have the application validate its required configuration at startup and report a clear error.$ journalctl --list-boots IDX BOOT ID FIRST ENTRY LAST ENTRY 0 6b1f… Mon 2026-11-17 09:00:02 UTC Mon 2026-11-17 10:15:40 UTC $ journalctl -b -1 -- No entries -- $ journalctl --disk-usage Archived and active journals take 3.9G in the file system.
Symptom: the server rebooted overnight, and you want to see what happened before the reboot, but only the current boot's logs are there. Or the opposite: /var/log/journal takes up several GB.
Root cause: journald's Storage= defaults to auto. Logs persist only if /var/log/journal exists. Otherwise they go to /run/log/journal, which is held in memory and is lost on reboot. Some minimal images and containers do not have this directory. The persistent size limit is controlled by settings such as SystemMaxUse= (by default 10% of the filesystem, up to 4G). The journal grows when an application logs heavily at debug level or when rate limiting is turned off.
ls -ld /var/log/journal /run/log/journal 2>&1 systemd-analyze cat-config systemd/journald.conf | grep -vE '^#|^$' journalctl --disk-usage; journalctl -p warning -b -1 -n 20 --no-pager 2>/dev/null | tail -5 journalctl -b -o json --output-fields=_SYSTEMD_UNIT | jq -r ._SYSTEMD_UNIT | sort | uniq -c | sort -rn | head
sudo mkdir -p /etc/systemd/journald.conf.d printf '[Journal]\nStorage=persistent\nSystemMaxUse=1G\nMaxRetentionSec=1month\n' | sudo tee /etc/systemd/journald.conf.d/50-lab.conf sudo systemctl restart systemd-journald sudo journalctl --vacuum-size=1G # reclaim now
RateLimitIntervalSec/RateLimitBurst settings.See Hour 2 Module 2 Logs: journald, rsyslog and log rotation.
myapp[2210]: OSError: [Errno 28] No space left on device $ df -h /var Filesystem Size Used Avail Use% Mounted on /dev/sda1 19G 19G 0 100% / $ sudo rm /var/log/myapp/debug.log # 12 GB $ df -h /var | tail -1 /dev/sda1 19G 19G 0 100% /
Symptom: the disk is full. You deleted the largest log file, but no space was freed. The total reported by du is much smaller than the used space reported by df.
Root cause: deleting a file only removes its directory entry (unlink). As long as a process still has the file open, the inode and data blocks are not freed. du cannot see them, but df still counts them. The most common case: an application keeps a log open and writes to it, and someone runs rm on it instead of rotating it. Or logrotate renames the file, but the application does not reopen it. Other reasons why df and du disagree: a mount point hides files in the original directory, and ext4 reserved blocks (5% by default, reserved for root).
sudo lsof -nP +L1 | awk 'NR==1 || $7>100000000' # files with link count 0 that are still open sudo du -xhd1 / 2>/dev/null | sort -h | tail -5; df -h / sudo tune2fs -l /dev/sda1 | grep -E 'Reserved block count|Block count'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME gunicorn 2210 myapp 7w REG 8,1 12884901888 0 26219 /var/log/myapp/debug.log (deleted)
sudo truncate -s0 /proc/2210/fd/7 # truncate the deleted file (does not interrupt the process) sudo systemctl restart myapp # or make the process reopen the log file # to empty a log, use truncate or : > file, not rm; if the program cannot reopen files, use copytruncate with logrotate
/ and /var (for example at 80% and 90%). Put data and logs on separate filesystems or data disks.See Hour 2 Module 2 and Hour 7 Module 4 Disk and filesystem problems.
$ touch /var/lib/myapp/sessions/new touch: cannot touch '/var/lib/myapp/sessions/new': No space left on device $ df -i /var | tail -1 /dev/sda1 1245184 1245184 0 100% / $ rm /var/lib/myapp/sessions/* -bash: /usr/bin/rm: Argument list too long
Symptom: there is plenty of space, but you cannot create files. When you clean up, rm * fails.
Root cause: the number of ext4 inodes is fixed by mkfs according to the bytes-per-inode ratio. A huge number of small files (sessions, caches, mail queues, and some package manager caches) uses up the inodes first. Argument list too long is E2BIG from execve(): after the shell expands *, the total argument length exceeds the kernel limit (related to ARG_MAX and the stack size). XFS allocates inodes dynamically, so this is rare, but it has an imaxpct limit.
df -i / /var sudo find /var -xdev -type f | cut -d/ -f2-4 | sort | uniq -c | sort -rn | head -5 getconf ARG_MAX
Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda1 1245184 1245184 0 100% / 1102417 var/lib/myapp 48211 var/lib/dpkg 2097152
sudo find /var/lib/myapp/sessions -type f -mmin +60 -delete # bypasses shell expansion # or: find … -print0 | xargs -0 rm; use systemd-tmpfiles for periodic cleanup: echo 'e /var/lib/myapp/sessions - - - 1h' | sudo tee /etc/tmpfiles.d/myapp.conf
node_filesystem_files_free from node_exporter).mkfs.ext4 -i 4096 or XFS.See Hour 2 Module 3 Storage and Hour 7 Module 4.
$ sudo mount /dev/vdb1 /data
mount: /data: wrong fs type, bad option, bad superblock on /dev/vdb1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
Symptom: a newly added data disk, a disk restored from a snapshot, or a disk moved from another machine fails to mount.
Root cause: libmount shows a generic message for errors such as EINVAL returned by mount(2). The real cause is in the kernel log. Common causes: (1) the partition has no filesystem (you forgot mkfs, or you tried to mount the whole disk when the filesystem is on a partition); (2) the wrong type, or missing userspace tools (-t nfs needs nfs-common, and xfs needs xfsprogs); (3) a duplicate XFS UUID (two disks cloned from the same snapshot are mounted together, which needs -o nouuid or xfs_admin -U generate); (4) filesystem corruption that needs fsck; (5) wrong options.
lsblk -f /dev/vdb; sudo blkid /dev/vdb1 sudo dmesg -T | tail -5 sudo file -s /dev/vdb1
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS vdb └─vdb1 xfs 5c0e…-… [Mon Nov 17 10:21:03 2026] XFS (vdb1): Filesystem has duplicate UUID 5c0e… - can't mount
sudo mount -o nouuid /dev/vdb1 /data # temporary fix (duplicate XFS UUID) sudo umount /data && sudo xfs_admin -U generate /dev/vdb1 && sudo mount /dev/vdb1 /data # no filesystem: confirm the disk is empty (lsblk -f, wipefs -n) before mkfs, or you will destroy data
mkfs or wipefs, run lsblk -f twice to confirm the device. In automation, use stable device identifiers (Azure: /dev/disk/azure/scsi1/lun0; AWS: /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol…).xfs_admin -U for XFS and tune2fs -U for ext4).See Hour 2 Module 3 Storage: Disks, Partitions, LVM and Filesystems and Hour 2 Module 4 Mounts and fstab.
[ TIME ] Timed out waiting for device dev-disk-by\x2duuid-5c0e….device. [DEPEND] Dependency failed for /data. [DEPEND] Dependency failed for Local File Systems. You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, or "exit" to continue bootup. Give root password for maintenance (or press Control-D to continue):
Symptom: after a reboot, SSH does not work, and the console shows emergency mode. This is usually because a data disk was detached, the UUID in fstab is wrong, or the fstab entry uses a name that can change, such as /dev/sdc.
Root cause: systemd-fstab-generator turns each fstab line into a .mount unit. By default it is a Requires dependency of local-fs.target. If the device does not appear within 90 seconds (DefaultDeviceTimeoutSec), the mount fails, local-fs.target fails, and the default OnFailure=emergency.target takes effect. Adding nofail turns the dependency into a Wants dependency, so a failure does not block boot. Cloud VMs usually have no root password, so you cannot log in while in emergency mode. Your options are the serial console with single-user mode, or offline repair (#28).
sudo findmnt --verify --verbose 2>&1 | tail -5 sudo systemctl daemon-reload && systemctl list-units --type=mount --all | grep -E 'data|not-found' sudo mount -a && echo "mount -a OK"
/data [E] unreachable source: UUID=5c0e…-… [W] recommended root FS passno is 1 (current is 0) 1 parse error, 1 error, 1 warning
# in emergency mode or the serial console: mount -o remount,rw / vi /etc/fstab # comment out the line, or change it to: UUID=<correct value> /data xfs defaults,nofail,x-systemd.device-timeout=10s 0 2 systemctl daemon-reload && systemctl default
UUID= and nofail for data disks. Add _netdev to network filesystems. After you edit fstab, run findmnt --verify and mount -a before you reboot.mounts module on Ubuntu cloud images adds nofail automatically. Manage fstab with cloud-init or Ansible, and do not edit it by hand.See Hour 2 Module 4 Mounts, fstab and Swap and Hour 7 Module 6 Boot failures and rescue mode.
$ sudo lvextend -L +5G /dev/vgdata/lvdata Size of logical volume vgdata/lvdata changed from 10.00 GiB (2560 extents) to 15.00 GiB (3840 extents). Logical volume vgdata/lvdata successfully resized. $ df -h /data | tail -1 /dev/mapper/vgdata-lvdata 9.8G 9.3G 0.5G 95% /data
Symptom: the LV has grown, but the application still reports a full disk. After you expand a cloud data disk, lsblk shows the new size, but pvs does not change.
Root cause: storage is layered as disk → partition → PV → VG → LV → filesystem, and each layer must be grown in turn. lvextend grows only the LV. The filesystem needs resize2fs (ext4) or xfs_growfs (XFS; the argument is the mount point, and XFS can only grow, not shrink). After you expand a cloud disk, you also need growpart to grow the partition and pvresize to grow the PV. When the VG has too little free space, lvextend reports Insufficient free space.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/vdb sudo pvs; sudo vgs; sudo lvs vgdata df -hT /data
sudo lvextend -r -L +5G /dev/vgdata/lvdata # -r (--resizefs) grows the LV and the filesystem in one step # if you already grew the LV: sudo resize2fs /dev/vgdata/lvdata # ext4; for XFS: sudo xfs_growfs /data # after a cloud disk expansion: sudo growpart /dev/vdb 1 && sudo pvresize /dev/vdb1
lvextend -r to expand. Keep some free space in the VG for snapshots and emergency growth.See Hour 2 Module 3.
myapp[4012]: [2026-11-17 10:30:01 +0000] [4012] [ERROR] Connection in use: ('0.0.0.0', 5000)
myapp[4012]: [2026-11-17 10:30:01 +0000] [4012] [ERROR] Retrying in 1 second.
…
myapp[4012]: [2026-11-17 10:30:06 +0000] [4012] [ERROR] Can't connect to ('0.0.0.0', 5000)
Symptom: restarting the service fails, or a second instance will not start. Similar errors: bind() to 0.0.0.0:80 failed (98: Address already in use) (nginx), and Python OSError: [Errno 98] Address already in use.
Root cause: a socket is already LISTENing on the address and port (EADDRINUSE). Possible causes: the old process did not fully exit (KillMode= set incorrectly, or it was started by hand with nohup), two services use the same port, or a copy is still running in tmux. TIME_WAIT usually does not prevent LISTEN, because most servers set SO_REUSEADDR.
sudo ss -ltnp 'sport = :5000' ps -o pid,ppid,user,lstart,cmd -p $(sudo ss -ltnpH 'sport = :5000' | grep -oP 'pid=\K[0-9]+' | sort -u | paste -sd,) systemctl status myapp --no-pager | grep -E 'Main PID|CGroup' ; sudo systemd-cgls -u myapp.service | head
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 2048 0.0.0.0:5000 0.0.0.0:* users:(("gunicorn",pid=2875,fd=5))
PID PPID USER STARTED CMD
2875 1 labadmin Mon Nov 17 08:12:44 2026 /opt/myapp/venv/bin/python3 /opt/myapp/venv/bin/gunicorn …
kill 2875 # the copy started by hand (owned by labadmin, not in the myapp.service cgroup) sudo systemctl restart myapp && sudo ss -ltnp 'sport = :5000'
nohup. By default, KillMode=control-group cleans up the whole group of processes when the service stops.HUP/USR2, not stop + start.See Hour 2 Module 5 Networking and Hour 1 Module 5 Processes.
$ curl -m 5 http://10.0.0.4:5000/healthz curl: (7) Failed to connect to 10.0.0.4 port 5000 after 2 ms: Couldn't connect to server $ curl -m 5 http://10.0.0.4:5000/healthz # another client curl: (28) Connection timed out after 5001 milliseconds
Symptom: curl 127.0.0.1:5000 works inside the VM, but access from outside fails. Sometimes it fails immediately, and sometimes it times out.
Root cause: an immediate failure (RST / ECONNREFUSED) means the packet reached the host, but either (1) no process listens on that address (the application binds only to 127.0.0.1, often because the default was not overridden with -b 0.0.0.0:5000), or (2) the firewall sent REJECT. A timeout means the packet was silently dropped: a host firewall DROP (ufw's default deny incoming is a DROP), a cloud security group or NSG, asymmetric routing, or a middlebox.
# on the server sudo ss -ltnp 'sport = :5000' # listening on 127.0.0.1 or 0.0.0.0? sudo ufw status verbose 2>/dev/null | head; sudo nft list ruleset | grep -nE 'dport 5000|policy' | head sudo tcpdump -ni any 'tcp port 5000' -c 6 # did the packets arrive? did an RST come back? # on the client ip route get 10.0.0.4; nc -vz -w3 10.0.0.4 5000
LISTEN 0 2048 127.0.0.1:5000 0.0.0.0:* users:(("gunicorn",pid=3911,fd=5))
10:41:02.112 eth0 In IP 10.0.0.9.51544 > 10.0.0.4.5000: Flags [S], seq …
10:41:02.112 eth0 Out IP 10.0.0.4.5000 > 10.0.0.9.51544: Flags [R.], seq 0, ack …
sudo systemctl edit myapp # change -b in ExecStart to 0.0.0.0:5000 (or keep 127.0.0.1 if it sits behind nginx) sudo ufw allow from 10.0.0.0/24 to any port 5000 proto tcp # on the cloud, also check the NSG (Azure) or the security group and NACL (AWS)
ss), then the host firewall, then packet capture, then the cloud network, then client routing. Find the hop where the packet disappears.See Hour 2 Module 5, Hour 6 Module 3 Firewall, and Hour 7 Module 5 Network troubleshooting.
$ curl https://pypi.org
curl: (6) Could not resolve host: pypi.org
$ python3 -c 'import socket; socket.getaddrinfo("pypi.org", 443)'
socket.gaierror: [Errno -3] Temporary failure in name resolution
Symptom: you can ping IP addresses, but every domain name fails to resolve. Or only some (internal) domain names fail.
Root cause: on Ubuntu, /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf. Queries go to 127.0.0.53, and systemd-resolved forwards them upstream (the upstream servers come from netplan or DHCP). Common failures: a script overwrote resolv.conf with a regular file or pointed it at an invalid server, systemd-resolved is stopped, the upstream DNS server is unreachable (port 53 is blocked by a security group or firewall), or split DNS is not configured (internal domain names should go to the internal DNS). On RHEL-family systems, NetworkManager usually writes resolv.conf directly.
ls -l /etc/resolv.conf; cat /etc/resolv.conf | grep -v '^#' resolvectl status | sed -n '1,15p' resolvectl query pypi.org dig +short @10.122.0.1 pypi.org; systemctl is-active systemd-resolved
-rw-r--r-- 1 root root 22 Nov 17 10:50 /etc/resolv.conf nameserver 10.9.9.9 pypi.org: resolve call failed: All attempts to contact name servers or networks failed ;; communications error to 10.9.9.9#53: timed out
sudo ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf sudo systemctl restart systemd-resolved && resolvectl query pypi.org # Pin DNS: write it to netplan (nameservers:) or /etc/systemd/resolved.conf.d/, then run netplan apply
/etc/resolv.conf. Leave DNS to netplan, cloud-init, or NetworkManager.See Hour 2 Module 5 and Hour 7 Module 5 Network troubleshooting.
Choose the first symptom you see, step by step. The tree ends with a conclusion and the matching question numbers.
myapp.service on linuxlab. All service faults are injected through a drop-in with l8_inject, and l8_heal restores them. The inode exhaustion in lab 2-C happens only on a 64 MB loopback filesystem.source ~/linuxlab/lab8.sh printf '[Service]\nExecStart=\nExecStart=/opt/myapp/venv/bin/gunicorn-typo -b 0.0.0.0:5000 app:app\n' | l8_inject sudo systemctl restart myapp; systemctl show myapp -p Result -p ExecMainStatus; l8_log 4
Job for myapp.service failed because the control process exited with error code. See "systemctl status myapp.service" and "journalctl -xeu myapp.service" for details. Result=exit-code ExecMainStatus=203 … myapp.service: Failed at step EXEC spawning /opt/myapp/venv/bin/gunicorn-typo: No such file or directory
An empty ExecStart= clears the original value. This is the standard way for a drop-in to override a list-type setting.
sudo sed -i 's/gunicorn-typo/gunicorn/' /etc/systemd/system/myapp.service.d/lab8.conf sudo systemctl restart myapp 2>&1 | head -1; systemctl show myapp -p NeedDaemonReload sudo systemctl daemon-reload && sudo systemctl restart myapp && systemctl is-active myapp
Warning: The unit file, source configuration file or drop-ins of myapp.service changed on disk. Run 'systemctl daemon-reload' to reload units. NeedDaemonReload=yes active
l8_healprintf '[Service]\nExecStart=\nExecStart=/bin/sh -c "echo boom; exit 3"\nRestart=always\nRestartSec=200ms\n' | l8_inject sudo systemctl restart myapp; sleep 3 systemctl show myapp -p Result -p NRestarts; l8_log 3
Result=start-limit-hit NRestarts=5 … myapp.service: Scheduled restart job, restart counter is at 5. … myapp.service: Start request repeated too quickly. … myapp.service: Failed with result 'start-limit-hit'.
sudo rm /etc/systemd/system/myapp.service.d/lab8.conf && sudo systemctl daemon-reload sudo systemctl start myapp 2>&1 | head -1; sudo systemctl reset-failed myapp && sudo systemctl start myapp && systemctl is-active myapp
Job for myapp.service failed because start of the service was attempted too often. active
DEV=$(l8_loop inode 64M) && sudo mkfs.ext4 -q -N 2048 "$DEV" && sudo mkdir -p /mnt/lab8i && sudo mount "$DEV" /mnt/lab8i
sudo install -d -o labadmin /mnt/lab8i/s && cd /mnt/lab8i/s
for i in $(seq 1 3000); do : > f$i 2>/dev/null || { echo "failed at $i"; break; }; done
df -h /mnt/lab8i | tail -1; df -i /mnt/lab8i | tail -1failed at 2038 /dev/loop1 55M 24K 51M 1% /mnt/lab8i /dev/loop1 2048 2048 0 100% /mnt/lab8i
rm * also works. E2BIG is triggered only with millions of files:find /mnt/lab8i/s -type f -name 'f1*' -delete && df -i /mnt/lab8i | tail -1 cd ~ && sudo umount /mnt/lab8i
/dev/loop1 2048 936 1112 46% /mnt/lab8i
python3 -m http.server 5000 --bind 0.0.0.0 >/dev/null 2>&1 & ROGUE=$! sudo systemctl restart myapp; sleep 6; l8_log 3; sudo ss -ltnp 'sport = :5000' | tail -1
… [ERROR] Connection in use: ('0.0.0.0', 5000)
… [ERROR] Retrying in 1 second.
… [ERROR] Can't connect to ('0.0.0.0', 5000)
LISTEN 0 5 0.0.0.0:5000 0.0.0.0:* users:(("python3",pid=5120,fd=3))kill $ROGUE
printf '[Service]\nExecStart=\nExecStart=/opt/myapp/venv/bin/gunicorn -w 2 -b 127.0.0.1:5000 app:app\n' | l8_inject && sudo systemctl restart myapp
curl -s 127.0.0.1:5000/healthz; echo; hostname -I | awk '{print $1}'{"status":"ok","redis":true}
10.122.0.57curl -m 5 http://10.122.0.57:5000/healthz
curl: (7) Failed to connect to 10.122.0.57 port 5000 after 3 ms: Couldn't connect to server
l8_cleanNo verified teaching video covers "deleted but still open files" or layered LVM expansion. Storyboard:
df at 100%, still at 100% after rm on a large log. lsof +L1 shows (deleted). After truncate /proc/PID/fd/N, the space comes back.lvextend -r doing it in one step.az vm run-command, and az vm repair. AWS: console output and screenshots, the EC2 serial console, SSM Run Command, and attaching the root volume to a rescue instance.Filter by keyword (for example Connection closed, exit code, emergency, /mnt, cloud-init, 401, TargetNotConnected, or nvme). Click a row to jump to the details.
$ az ssh vm -g rg-linux-lab -n vm-linux-lab Connection closed by 10.0.0.4 port 22
Symptom: in hour 3, Entra ID sign-in was enabled (AADSSHLoginForLinux extension). A new colleague runs az login successfully, but az ssh vm is closed immediately, even though they are a Contributor on the subscription.
Root cause: Entra sign-in is authorized by the RBAC data-plane role Virtual Machine Administrator Login (which allows sudo) or Virtual Machine User Login (a regular user). Owner and Contributor do not include login rights. The control plane and data plane are separated on purpose and audited. The same applies when the VM's system-assigned managed identity is turned off. Role assignments take time to propagate.
ME=$(az ad signed-in-user show --query id -o tsv)
az role assignment list --assignee "$ME" --all --query "[?contains(roleDefinitionName,'Virtual Machine')].{role:roleDefinitionName,scope:scope}" -o table
az vm show -g rg-linux-lab -n vm-linux-lab --query identity.type -o tsv
az vm extension list -g rg-linux-lab --vm-name vm-linux-lab --query "[].{name:name,state:provisioningState}" -o table
(empty: no Virtual Machine * Login role) SystemAssigned Name State ------------------- --------- AADSSHLoginForLinux Succeeded
RG=$(az group show -n rg-linux-lab --query id -o tsv) az role assignment create --role "Virtual Machine User Login" --assignee "$ME" --scope "$RG" sleep 60 && az ssh vm -g rg-linux-lab -n vm-linux-lab
$ az vm extension show -g rg-linux-lab --vm-name vm-linux-lab -n AADSSHLoginForLinux --query "{state:provisioningState,msg:instanceView.statuses[0].message}"
{ "state": "Failed", "msg": "… Non-zero exit code: 22 …" }
Symptom: you add the Entra sign-in extension to an existing VM. In the portal, the status stays at Transitioning for a long time, then fails.
Root cause: according to the documentation, exit code 22 means the VM has no system-assigned managed identity, which the extension uses to prove its identity to Entra. Exit code 23 means the old AADLoginForLinux extension is still installed. Other prerequisites: at least 1 GB of memory, a working VM agent (#31), and outbound access to packages.microsoft.com, 169.254.169.254, login.microsoftonline.com, and pas.windows.net (TCP 443). If you use a proxy, set the proxy environment variables for walinuxagent.service.
az vm show -g rg-linux-lab -n vm-linux-lab --query "{identity:identity.type, size:hardwareProfile.vmSize}" -o table
az vm extension list -g rg-linux-lab --vm-name vm-linux-lab --query "[].name" -o tsv
# inside the VM:
sudo tail -30 /var/log/azure/Microsoft.Azure.ActiveDirectory.AADSSHLoginForLinux/*.log 2>/dev/null | tail -5
curl -s -o /dev/null -w '%{http_code}\n' https://pas.windows.net
az vm extension delete -g rg-linux-lab --vm-name vm-linux-lab -n AADSSHLoginForLinux az vm identity assign -g rg-linux-lab -n vm-linux-lab # exit code 22 az vm extension delete -g rg-linux-lab --vm-name vm-linux-lab -n AADLoginForLinux 2>/dev/null # exit code 23 az vm extension set -g rg-linux-lab --vm-name vm-linux-lab --publisher Microsoft.Azure.ActiveDirectory --name AADSSHLoginForLinux
--assign-identity and the extension in the same template (Bicep/Terraform). Use the Azure Policy DeployIfNotExists effect to remediate automatically.See Hour 3 Module 2 cloud-init and extensions and Hour 3 Module 4.
[ TIME ] Timed out waiting for device dev-incorrect.device. [DEPEND] Dependency failed for /data. [DEPEND] Dependency failed for Local File Systems. … Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot into default mode. Give root password for maintenance (or type Control-D to continue)
Symptom: you added a data disk to vm-linux-lab and wrote /dev/sdc1 in fstab. After a maintenance reboot, the VM became unreachable. The portal shows "Running", and the resource health is normal.
Root cause: the same fstab dependency problem as #21, plus two cloud factors. (1) Device names such as /dev/sdX on Azure are not guaranteed to be stable. Use a UUID or /dev/disk/azure/scsi1/lunN instead. (2) Cloud images have no root password, so you cannot get in through "Give root password" in emergency mode. Microsoft's documentation lists these common causes: using a device name instead of a UUID, a wrong UUID, a missing nofail on a disk that might not be attached, and an incorrect entry format.
az vm boot-diagnostics get-boot-log -g rg-linux-lab -n vm-linux-lab | tail -20 az serial-console connect -g rg-linux-lab -n vm-linux-lab # requires the serial-console extension and boot diagnostics
systemd.unit=rescue.target or init=/bin/bash to the kernel line in GRUB), edit /etc/fstab, then run reboot -f.az extension add -n vm-repair; az vm repair repair-button --button-command 'fstab' --verbose -g rg-linux-lab -n vm-linux-lab (creates a temporary repair VM and a copy of the OS disk, and comments out the data mounts that are not needed to boot).ls -l /dev/disk/azure/scsi1/ # lun0 -> ../../../sdc UUID=5c0e… /data xfs defaults,nofail 0 2
disk_setup / fs_setup / mounts) or to configuration management, and use nofail consistently.See Hour 3 Module 7 Troubleshooting in the cloud and Hour 3 Module 3 Managed disks.
$ ls /mnt DATALOSS_WARNING_README.txt lost+found $ ls /mnt/redis-backup ls: cannot access '/mnt/redis-backup': No such file or directory
Symptom: to save money, you stopped (deallocated) the VM overnight, and in the morning the Redis backups under /mnt were gone. The same happens after a resize, platform maintenance, or a redeploy.
Root cause: most Azure sizes include a temporary disk (local to the host, not a managed disk). According to the official documentation, its data can be lost during maintenance events, redeployments, or when the VM is stopped. A normal reboot keeps it. On Linux, it is usually /dev/disk/azure/resource, and Ubuntu images have cloud-init mount it at /mnt. Sizes whose names do not include a "d" have no temporary disk.
ls -l /dev/disk/azure/ ; findmnt /mnt lsblk -o NAME,SIZE,MOUNTPOINTS,MODEL az vm show -g rg-linux-lab -n vm-linux-lab --query hardwareProfile.vmSize -o tsv
lrwxrwxrwx 1 root root 9 Nov 17 08:00 resource -> ../../sdb lrwxrwxrwx 1 root root 10 Nov 17 08:00 resource-part1 -> ../../sdb1 TARGET SOURCE FSTYPE OPTIONS /mnt /dev/sdb1 ext4 rw,relatime Standard_D2ds_v5
az vm disk attach -g rg-linux-lab --vm-name vm-linux-lab --name vm-linux-lab-data --new --size-gb 32 --sku StandardSSD_LRS # swap on the temporary disk: on Ubuntu, use cloud-init (mounts/swap); on RHEL-family systems, use ResourceDisk.EnableSwap in waagent.conf (see the documentation)
/mnt.See Hour 3 Module 3 Temporary disks and Hour 4 Module 3 Instance store.
$ cloud-init status --long status: error extended_status: error - done boot_status_code: enabled-by-generator detail: DataSourceAzure [seed=/dev/sr0] errors: - (scripts_user) Failed to run module scripts_user (scripts in /var/lib/cloud/instance/scripts) recoverable_errors: WARNING: - cloud-config failed schema validation! You may run 'sudo cloud-init schema --system' to check the details.
Symptom: the VM is created, but myapp is not installed. Or only part of the steps run (the user was created, but the service did not start).
Root cause: on first boot, cloud-init runs the cloud-config modules in four stages (local → network → config → final). Common failures: (1) YAML indentation or type errors, or the first line is not #cloud-config, so the file is treated as plain text and ignored; (2) a runcmd command fails because the network is not ready, the apt lock is held (#9), or there is a typo; (3) a script assumes an interactive environment (a sudo prompt, or $HOME). runcmd and scripts_user run as root in the final stage.
cloud-init status --long sudo cloud-init schema --system --annotate | head -30 sudo grep -nE 'WARNING|Traceback|Failed' /var/log/cloud-init.log | tail -10 sudo tail -40 /var/log/cloud-init-output.log # stdout/stderr of runcmd and scripts cloud-init analyze show | tail -15 # time spent in each stage
sudo cloud-init schema -c ./user-data.yaml --annotate # validate locally first # after the fix, rerun on a test VM (this reruns all first-boot modules, so use caution in production): sudo cloud-init clean --logs && sudo reboot
multipass launch --cloud-init user-data.yaml). Run cloud-init schema in CI.See Hour 3 Module 2 cloud-init, Hour 4 Module 2, and Hour 5 Module 3 Packer.
$ az vm get-instance-view -g rg-linux-lab -n vm-linux-lab --query "instanceView.vmAgent.statuses[0].{code:code,msg:message}"
{ "code": "ProvisioningState/Unavailable", "msg": "VM Agent is unresponsive." }
$ az vm run-command invoke -g rg-linux-lab -n vm-linux-lab --command-id RunShellScript --scripts "uptime"
(times out after a long wait)
Symptom: you can SSH into the VM, but everything that depends on extensions fails or times out. This includes the Entra sign-in extension, AMA, run-command, and Update Manager patch assessment and installation.
Root cause: the Azure Linux agent (walinuxagent; on Ubuntu the service name is walinuxagent, and on RHEL-family systems it is waagent) reports status and pulls extensions through 168.63.129.16 (WireServer). Common causes: the agent is disabled or removed, a host firewall or custom route blocks 168.63.129.16, its Python dependency is broken, a full disk (#18) prevents it from writing status, or the image is outdated and its agent version is no longer supported.
systemctl status walinuxagent --no-pager | head -5; waagent --version
sudo tail -30 /var/log/waagent.log | grep -iE 'error|exception|goal state'
curl -s -m5 -o /dev/null -w '%{http_code}\n' http://168.63.129.16/?comp=versions
sudo nft list ruleset | grep -n '168.63.129.16'; df -h /var
sudo systemctl enable --now walinuxagent sudo apt-get install --only-upgrade -y walinuxagent # RHEL-family: dnf update WALinuxAgent # allow 168.63.129.16 (TCP 80/32526), delete the blocking rules, then go to Update Manager and "Check for updates"
See Hour 3 Module 2 and Hour 3 Module 6 Azure Update Manager.
// Log Analytics Heartbeat | where Computer == "vm-linux-lab" | take 5 (no results) Syslog | where Computer == "vm-linux-lab" | summarize count() by Facility (no results)
Symptom: Azure Monitor Agent was installed in hour 3. Alerts never fire, and the workspace has no data at all for this VM.
Root cause: the data collection rule (DCR), not the AMA, decides what is collected and which workspace receives it. The VM also needs an association with the DCR (DCRA) before configuration is delivered. Other causes: the VM has no managed identity (AMA uses it to authenticate), outbound access to *.handler.control.monitor.azure.com and to the workspace data ingestion endpoint is blocked, the DCR's Syslog facility or level filters out the logs you need, or a leftover legacy Log Analytics agent (MMA/OMS, now retired) conflicts with it.
VMID=$(az vm show -g rg-linux-lab -n vm-linux-lab --query id -o tsv) az monitor data-collection rule association list --resource "$VMID" -o table az vm extension show -g rg-linux-lab --vm-name vm-linux-lab -n AzureMonitorLinuxAgent --query provisioningState -o tsv # inside the VM: systemctl status azuremonitoragent --no-pager | head -3 sudo ls /etc/opt/microsoft/azuremonitoragent/config-cache/configchunks/ 2>/dev/null | head
az monitor data-collection rule association create --name dcra-linux-lab --resource "$VMID" \ --rule-id "$(az monitor data-collection rule show -g rg-linux-lab -n dcr-linux-lab --query id -o tsv)" # a few minutes later: Heartbeat | where Computer == "vm-linux-lab" | top 1 by TimeGenerated
$ ssh -i ~/.ssh/linux-lab.pem ubuntu@3.98.12.34 ubuntu@3.98.12.34: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Symptom: the AL2023 instance linux-lab from hour 4 cannot be reached by SSH. Trying several different keys does not help.
Root cause, listed by frequency: (1) wrong username. AL2023 defaults to ec2-user, Ubuntu AMIs use ubuntu, and RHEL uses ec2-user. (2) The key pair chosen at launch does not match your private key (cloud-init writes it only on first boot). (3) The private key permissions are too open, so the client refuses to use it (UNPROTECTED PRIVATE KEY FILE!). (4) The permissions on ~/.ssh inside the instance were changed incorrectly (#7). A security group or NACL problem shows up as a timeout, not as Permission denied.
aws ec2 describe-instances --region ca-central-1 --filters Name=tag:Name,Values=linux-lab \
--query 'Reservations[].Instances[].{id:InstanceId,key:KeyName,ami:ImageId,state:State.Name}' -o table
aws ec2 describe-images --region ca-central-1 --image-ids <ami-id> --query 'Images[0].Name' -o text
ssh -v -i ~/.ssh/linux-lab.pem ec2-user@3.98.12.34 2>&1 | grep -E 'Offering|Server accepts|Authentications'
chmod 600 ~/.ssh/linux-lab.pem && ssh -i ~/.ssh/linux-lab.pem ec2-user@3.98.12.34 # If the key is lost, skip SSH and use SSM Session Manager (#35) or EC2 Instance Connect to push a temporary public key: aws ec2-instance-connect send-ssh-public-key --region ca-central-1 --instance-id i-0abc… --instance-os-user ec2-user --ssh-public-key file://~/.ssh/id_ed25519.pub
$ curl -s -w ' HTTP %{http_code}\n' http://169.254.169.254/latest/meta-data/instance-id
HTTP 401
$ docker run --rm --network bridge amazon/aws-cli sts get-caller-identity
Unable to locate credentials. You can configure credentials by running "aws configure".
Symptom: an old script that sends a plain GET to the metadata service fails on AL2023. The AWS CLI on the host works, but an older SDK in a Docker bridge network cannot get credentials.
Root cause: according to the official documentation, instances launched from the AL2023 AMI use only IMDSv2 by default (IMDSv1 is turned off), with a hop limit of 2 (set through the AMI's imds-support=v2.0). IMDSv2 first calls PUT /latest/api/token to get a session token (valid for 1 second to 6 hours), then sends requests with the X-aws-ec2-metadata-token header. A GET without a token returns 401. The hop limit controls how many network hops the token response can cross. A container bridge adds one hop, so with a hop limit of 1 the container cannot get a token. Some older SDKs do not support IMDSv2.
aws ec2 describe-instances --region ca-central-1 --instance-ids i-0abc… --query 'Reservations[0].Instances[0].MetadataOptions' TOKEN=$(curl -sX PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 300') curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/iam/security-credentials/
{ "State": "applied", "HttpTokens": "required", "HttpPutResponseHopLimit": 2, "HttpEndpoint": "enabled", … }
linux-lab-ssm-role
ec2-metadata (included in AL2023) or the SDK.HttpTokens back to optional just to support an old script. IMDSv1 is vulnerable to SSRF, which can be used to steal credentials.ec2:MetadataHttpTokens. Use the MetadataNoToken metric in CloudWatch to find programs that still use v1.$ aws ssm start-session --region ca-central-1 --target i-0abc123def4567890 An error occurred (TargetNotConnected) when calling the StartSession operation: i-0abc123def4567890 isn't connected. # on the instance, /var/log/amazon/ssm/amazon-ssm-agent.log: SSM Agent unable to acquire credentials: unexpected error getting instance profile role credentials or calling UpdateInstanceInformation. Skipping default host management fallback: retrieved credentials failed to report to ssm. Error: RequestError: send request failed
Symptom: linux-lab in a private subnet never shows up in Fleet Manager, or it could connect before and suddenly cannot.
Root cause: the AL2023 AMI comes with SSM Agent preinstalled. To come online, it needs: (1) an identity: the instance profile includes AmazonSSMManagedInstanceCore (or Default Host Management Configuration is turned on); (2) network access to the ssm and ssmmessages endpoints (before agent 3.3.40.0, ec2messages is also needed). A private subnet needs a NAT gateway or a VPC interface endpoint, and the endpoint's security group must allow 443. VPC Block Public Access also blocks traffic through the internet gateway (IGW); (3) the agent is running and resources are not exhausted (CPU, memory, or a full root volume). A target in another account or Region also reports this error.
aws ssm describe-instance-information --region ca-central-1 --filters Key=InstanceIds,Values=i-0abc… --query 'InstanceInformationList[].{ping:PingStatus,agent:AgentVersion}'
aws ec2 describe-iam-instance-profile-associations --region ca-central-1 --filters Name=instance-id,Values=i-0abc… --query 'IamInstanceProfileAssociations[].IamInstanceProfile.Arn'
aws ec2 describe-vpc-endpoints --region ca-central-1 --filters Name=vpc-id,Values=vpc-0123… --query 'VpcEndpoints[].ServiceName'
# on the instance (through the EC2 serial console): sudo systemctl status amazon-ssm-agent; sudo tail /var/log/amazon/ssm/amazon-ssm-agent.log
aws ec2 associate-iam-instance-profile --region ca-central-1 --instance-id i-0abc… --iam-instance-profile Name=linux-lab-ssm-profile for s in ssm ssmmessages; do aws ec2 create-vpc-endpoint --region ca-central-1 --vpc-id vpc-0123… --vpc-endpoint-type Interface \ --service-name com.amazonaws.ca-central-1.$s --subnet-ids subnet-0aa… --security-group-ids sg-0endpoint… --private-dns-enabled; done # on the instance: sudo systemctl restart amazon-ssm-agent
PingStatus != Online. SSM is also a prerequisite for Patch Manager and Run Command.$ sudo mkfs.xfs /dev/sdf Error accessing specified device /dev/sdf: No such file or directory $ lsblk nvme0n1 259:0 0 20G 0 disk ├─nvme0n1p1 259:1 0 20G 0 part / nvme1n1 259:4 0 50G 0 disk $ df -h / | tail -1 /dev/nvme0n1p1 8.0G 7.6G 0.4G 95% /
Symptom: operations using the console device name /dev/sdf fail; or the root volume was grown from 8 GiB to 20 GiB, but the system still shows 8 GiB.
Root cause: on Nitro, EBS appears as NVMe. The kernel names devices nvmeXn1 in discovery order, which has nothing to do with the /dev/sdf given in the API (the name can change after a reboot). AL2023 uses udev rules to create compatibility symlinks; the by-id names include the volume ID. Resizing takes two steps: enlarge the volume (modify-volume; usable once it is in the optimizing state), then grow the partition (growpart) and the filesystem (the AL2023 root defaults to XFS → xfs_growfs; ext4 → resize2fs). The cloud-init in Ubuntu and AL2023 images grows the root partition automatically at boot, so a reboot also works.
ls -l /dev/disk/by-id/ | grep -i 'Elastic_Block_Store' | head
sudo nvme list 2>/dev/null | head -5 # nvme-cli: show volume IDs
aws ec2 describe-volumes-modifications --region ca-central-1 --volume-ids vol-0abc… --query 'VolumesModifications[0].{state:ModificationState,target:TargetSize}'
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
sudo growpart /dev/nvme0n1 1 && sudo xfs_growfs -d / # root volume (XFS) DEV=/dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol0abc… # stable name for the data volume sudo mkfs.xfs "$DEV" && echo "UUID=$(sudo blkid -s UUID -o value "$DEV") /data xfs defaults,nofail 0 2" | sudo tee -a /etc/fstab sudo mkdir -p /data && sudo mount -a && df -h /data
nofail to fstab (#21).$ aws ec2 modify-instance-attribute --instance-id i-0abc… --attribute userData --value file://user-data-v2.b64 # the instance must be stopped first $ aws ec2 start-instances --instance-ids i-0abc… # On the instance: $ sudo grep -c 'myapp v2' /var/log/cloud-init-output.log 0 $ sudo ls /var/lib/cloud/instance/sem/ | grep -E 'scripts_user|runcmd' config_runcmd config_scripts_user
Symptom: you change the user data to update the configuration, then stop, modify and start the instance, and nothing changes. Changing custom data on Azure behaves the same way.
Root cause: most cloud-init modules (including runcmd, scripts_user, users and write_files) run once per instance. cloud-init writes a semaphore under /var/lib/cloud/instance/sem/ keyed by the instance ID, so the same ID never runs them again. Only bootcmd and the scripts under /var/lib/cloud/scripts/per-boot/ run on every boot. User data is first-boot provisioning, not a configuration management channel.
cloud-init query instance_id; cat /var/lib/cloud/data/instance-id sudo cloud-init query userdata | head -5 # the user data the instance currently sees (the new version) ls /var/lib/cloud/instance/sem/ /var/lib/cloud/scripts/per-boot/
bootcmd or a per-boot script (keep it idempotent). On a test machine, sudo cloud-init clean --logs --reboot makes cloud-init run again as if it were a first boot.[ 1.912345] VFS: Cannot open root device "UUID=…" or unknown-block(0,0): error -6 [ 1.912400] Please append a correct "root=" boot option; here are the available partitions: [ 1.913001] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Symptom: unattended upgrades installed a new kernel. After the reboot, the EC2 instance status check fails, or the Azure VM cannot be reached. The console output stops at a kernel panic.
Root cause: the kernel cannot find the root filesystem. unknown-block(0,0) is usually caused by a missing initramfs, or an initramfs without the storage driver (NVMe, Hyper-V storvsc/virtio). Typical triggers: the disk was full when the initramfs was generated, /boot is too small, the initramfs tool was changed (26.04 defaults to Dracut instead of initramfs-tools) and the configuration is incomplete, or the kernel was built by hand. Or the UUID in root= is wrong.
aws ec2 get-console-output --region ca-central-1 --instance-id i-0abc… --latest --output text | tail -20
aws ec2 describe-instance-status --region ca-central-1 --instance-ids i-0abc… --query 'InstanceStatuses[0].{sys:SystemStatus.Status,inst:InstanceStatus.Status}'
az vm boot-diagnostics get-boot-log -g rg-linux-lab -n vm-linux-lab | grep -iE 'panic|VFS'
# After the fix, check on the machine's kernel:
ls -l /boot/; lsinitrd /boot/initrd.img-$(uname -r) 2>/dev/null | grep -E 'nvme|hv_storvsc|virtio_blk' | head
sudo dracut --force --kver <version>; 24.04: sudo update-initramfs -u -k <version>) → sudo update-grub.az vm repair create), rebuild the initramfs in a chroot, then attach the volume back./boot (remove old kernels).See Hour 7, Module 6: boot failures, Hour 4, Module 7: EC2 serial console, Hour 3, Module 7.
Start from the first symptom. Branches are organized by “the earlier the failure, the sooner you need out-of-band tools.”
vm-linux-lab from hour 3 (Standard_B2s class, a few cents per hour, billed as used) and permission to assign roles on the resource group (Owner, or User Access Administrator / RBAC Administrator). Lab 3-D needs the linux-lab from hour 4 (t3.micro class, billed as used). Clean up or stop the resources as soon as you finish.cat > lab8-ci.yaml <<'EOF' #cloud-config packages: - redis-server runcmd: - echo "myapp v1 bootstrap" > /var/tmp/bootstrap.txt - /opt/myapp/install.sh # does not exist, fails on purpose write_files: - path: /etc/myapp/myapp.env content: REDIS_URL=redis://127.0.0.1:6379/0 EOF multipass launch --name lab8ci --cpus 1 --memory 1G --disk 8G --cloud-init lab8-ci.yaml multipass exec lab8ci -- cloud-init status --long | head -12
status: error extended_status: error - done … errors: - (scripts_user) Failed to run module scripts_user (scripts in /var/lib/cloud/instance/scripts)
multipass exec lab8ci -- sudo cloud-init schema --system --annotate | head -15 multipass exec lab8ci -- sudo tail -5 /var/log/cloud-init-output.log
/var/lib/cloud/instance/scripts/runcmd: 3: /opt/myapp/install.sh: not found 2026-11-17 11:02:41,123 - cc_scripts_user.py[WARNING]: Failed to run module scripts_user …
multipass restart lab8ci && multipass exec lab8ci -- ls /var/lib/cloud/instance/sem/ | grep -E 'runcmd|scripts_user' multipass delete --purge lab8ci
config_runcmd config_scripts_user
linuxlab, temporarily append to fstab an entry that points to a non-existent UUID. Run the pre-check only, without rebooting:sudo cp /etc/fstab /etc/fstab.lab8.bak echo 'UUID=00000000-0000-0000-0000-00000000lab8 /mnt/lab8data xfs defaults 0 2' | sudo tee -a /etc/fstab sudo findmnt --verify 2>&1 | tail -3 sudo systemctl daemon-reload && systemctl show 'mnt-lab8data.mount' -p RequiredBy -p WantedBy
[E] unreachable source: UUID=00000000-0000-0000-0000-00000000lab8 0 parse errors, 1 error, 0 warnings RequiredBy=local-fs.target WantedBy=
RequiredBy=local-fs.target is why the system enters emergency mode after a reboot.
nofail and check the dependencies again, then restore the original file:sudo sed -i 's#xfs defaults 0 2#xfs defaults,nofail 0 2#' /etc/fstab && sudo systemctl daemon-reload systemctl show 'mnt-lab8data.mount' -p RequiredBy -p WantedBy sudo cp /etc/fstab.lab8.bak /etc/fstab && sudo rm /etc/fstab.lab8.bak && sudo systemctl daemon-reload && sudo findmnt --verify | tail -1
RequiredBy= WantedBy=local-fs.target Success, no errors or warnings detected
ME=$(az ad signed-in-user show --query id -o tsv); RG=$(az group show -n rg-linux-lab --query id -o tsv) az role assignment delete --assignee "$ME" --role "Virtual Machine Administrator Login" --scope "$RG" sleep 120; az ssh vm -g rg-linux-lab -n vm-linux-lab -- -o ConnectTimeout=10 true
Connection closed by 20.151.x.x port 22
az role assignment create --assignee "$ME" --role "Virtual Machine Administrator Login" --scope "$RG" >/dev/null sleep 120; az ssh vm -g rg-linux-lab -n vm-linux-lab -- sudo -n true && echo "sudo OK"
sudo OK
az vm deallocate -g rg-linux-lab -n vm-linux-lab (or the az group delete -n rg-linux-lab --yes --no-wait from hour 3)linux-lab through SSM, and compare v1 and v2 requests:aws ssm start-session --region ca-central-1 --target $(aws ec2 describe-instances --region ca-central-1 --filters Name=tag:Name,Values=linux-lab Name=instance-state-name,Values=running --query 'Reservations[0].Instances[0].InstanceId' -o text)
# inside the session:
curl -s -o /dev/null -w 'v1: %{http_code}\n' http://169.254.169.254/latest/meta-data/instance-id
T=$(curl -sX PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 60')
curl -s -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/instance-id; echov1: 401 i-0abc123def4567890
sudo dnf install -y docker && sudo systemctl start docker), then set it back to 2:aws ec2 modify-instance-metadata-options --region ca-central-1 --instance-id i-0abc… --http-put-response-hop-limit 1 --http-tokens required
sudo docker run --rm public.ecr.aws/amazonlinux/amazonlinux:2023 curl -s -m 3 -X PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 60' || echo "no token (timeout)"
no token (timeout)
aws ec2 modify-instance-metadata-options --region ca-central-1 --instance-id i-0abc… --http-put-response-hop-limit 2 --http-tokens required
aws ec2 stop-instances --region ca-central-1 --instance-ids i-0abc… (or terminate all resources with the hour 4 cleanup script).No verified video covers Entra login roles, AMA/DCR association or IMDSv2 hop limits. Storyboard:
az ssh vm returns Connection closed. The portal IAM shows the user as Contributor but without the VM Login role. It succeeds after the role is assigned.dmesg: Killed process), cgroup limits (memory.max, pids.max, and systemd's MemoryMax=/TasksMax=), process rlimits (LimitNOFILE=), and kernel tables (conntrack, SYN/accept queues).blocked for more than 120 seconds, soft lockup and Remounting filesystem read-only are symptoms. The root cause is usually in storage, the virtualization host or a driver.EACCES; the evidence is in the audit log (avc: denied / apparmor="DENIED"). Never fix it by turning off SELinux or AppArmor.Filter by keyword (such as Killed process, fork, Too many open files, conntrack, SYN, blocked, avc, read-only). Click a row to jump to its explanation.
$ sudo journalctl -k -b | grep -iE 'oom|killed process' | tail -3 kernel: gunicorn invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0 kernel: Memory cgroup out of memory: Killed process 2210 (gunicorn) total-vm:1843200kB, anon-rss:1021440kB, file-rss:10240kB, shmem-rss:0kB, UID:998 pgtables:2280kB oom_score_adj:0 $ journalctl -u myapp -n 2 --no-pager -o cat myapp.service: The kernel OOM killer killed some processes in this unit. myapp.service: Failed with result 'oom-kill'.
Symptom: the service restarts at random, 502 errors increase, and the application log shows no errors. The process was killed with SIGKILL, so it had no time to write a log.
Root cause: ① global OOM (“Out of memory: Killed process”): memory and swap are exhausted, and the kernel picks a victim by oom_score (mainly RSS, adjusted by oom_score_adj). ② cgroup OOM (“Memory cgroup out of memory”): a unit exceeds MemoryMax= (cgroup v2 memory.max), and the victim is chosen only within that cgroup. 26.04 has removed cgroup v1. systemd-oomd can also kill a whole cgroup based on PSI memory pressure, before the kernel OOM killer acts (log: “killed by systemd-oomd”). Common root causes: memory leaks, too many workers, loading a large file at once, and unbounded caches.
sudo journalctl -k -b --no-pager | grep -A2 -iE 'invoked oom-killer|Killed process' | tail -8 systemctl show myapp -p MemoryMax -p MemoryHigh -p MemoryCurrent -p MemoryPeak -p OOMPolicy cat /sys/fs/cgroup/system.slice/myapp.service/memory.events free -m; cat /proc/pressure/memory
MemoryMax=1073741824 MemoryHigh=infinity MemoryCurrent=1048211456 MemoryPeak=1073741824 OOMPolicy=stop low 0 high 0 max 1832 oom 3 oom_kill 3 some avg10=12.40 avg60=8.10 avg300=2.03 total=91234567
sudo systemctl edit myapp # [Service] MemoryHigh=800M (throttles reclaim first), MemoryMax=1G (hard limit); reduce gunicorn -w, or add --max-requests 1000 --max-requests-jitter 100 sudo systemctl restart myapp # Find the leak: pidstat -r -p $(pgrep -d, -f gunicorn) 5; for Python, use tracemalloc / py-spy dump
MemoryHigh/MemoryMax on every service so the blast radius stays inside the unit and protects sshd and the proxy. Key system services can set OOMScoreAdjust=-500.memory.events and PSI. Plan capacity by peak RSS, not by average.See Hour 7, Module 3: memory and OOM, Hour 6, Module 7: cgroups.
$ ls -bash: fork: retry: Resource temporarily unavailable -bash: fork: retry: Resource temporarily unavailable -bash: fork: Resource temporarily unavailable myapp[2210]: RuntimeError: can't start new thread
Symptom: you can SSH in, but almost no command starts, and the application reports that it cannot create threads. Memory and CPU are not under pressure.
Root cause: fork()/clone() returns EAGAIN, which means a task limit has been reached. ① cgroup pids.max (systemd TasksMax=; services use DefaultTasksMax by default, and user sessions are limited by the user slice). ② the user's RLIMIT_NPROC (ulimit -u). ③ the global kernel.pid_max / kernel.threads-max. Typical triggers: thread leaks, fork bombs, scripts that recurse without limit. Threads count as tasks too.
systemctl show myapp -p TasksCurrent -p TasksMax cat /sys/fs/cgroup/system.slice/myapp.service/pids.events ps -eLo user | sort | uniq -c | sort -rn | head -3 # count threads per user cat /proc/sys/kernel/pid_max /proc/sys/kernel/threads-max; ulimit -u
TasksCurrent=4915 TasksMax=4915 max 2317 4921 myapp 212 root
sudo systemctl restart myapp # restore the service first (the shell cannot fork either: use exec, or switch user / use the console) # Locate the leaking threads: sudo py-spy dump --pid $(systemctl show -p MainPID --value myapp) | head -40 # A reasonable limit (not unlimited): sudo systemctl edit myapp # [Service] TasksMax=512
TasksMax for each service, so a runaway service only hurts itself. Monitor the TasksCurrent trend.echo, kill, read) still work. kill -9 <PID> is a built-in.See Hour 6, Module 6: sysctl and resource limits, Hour 1, Module 5: processes.
myapp[2210]: OSError: [Errno 24] Too many open files # When the global table is full (ENFILE, rare), the kernel prints: kernel: VFS: file-max limit 9223372036854775807 reached
Symptom: under high concurrency, accept fails and files cannot be opened. Operators raised nofile in /etc/security/limits.conf and restarted the service, but nothing changed.
Root cause: EMFILE means the per-process RLIMIT_NOFILE has been reached. limits.conf is applied by PAM (pam_limits) to login sessions and has no effect on systemd services. A service's limits come from its unit's LimitNOFILE= (the systemd defaults are a soft limit of 1024 and a hard limit of 524288; the soft limit stays at 1024 for compatibility with old programs that use select()). A program can raise its own soft limit up to the hard limit. Another cause is a file descriptor leak (connections or files that are never closed). Raising the limit only delays the failure.
PID=$(systemctl show -p MainPID --value myapp)
grep 'open files' /proc/$PID/limits
sudo ls /proc/$PID/fd | wc -l
sudo ls -l /proc/$PID/fd | awk '{print $NF}' | sed 's/[0-9]\+/N/g' | sort | uniq -c | sort -rn | head -5 # count by type
cat /proc/sys/fs/file-nr
Max open files 1024 524288 files
1024
998 socket:[N]
14 /dev/null
4352 0 9223372036854775807
sudo systemctl edit myapp # [Service] LimitNOFILE=65536 sudo systemctl restart myapp && grep 'open files' /proc/$(systemctl show -p MainPID --value myapp)/limits # If the socket count keeps rising: check whether the connection pool, keep-alive and Redis connections are being reused
process_open_fds).fs.file-max (ENFILE) → dedicated per-user limits such as inotify (for example, SSM's fs.inotify.max_user_instances).See Hour 6, Module 6.
$ sudo journalctl -k | tail -3 kernel: nf_conntrack: nf_conntrack: table full, dropping packet kernel: nf_conntrack: nf_conntrack: table full, dropping packet kernel: net_ratelimit: 1342 callbacks suppressed
Symptom: at peak hours, new connections time out at random (they are not refused), while existing connections work. The machine runs Docker or has a stateful firewall enabled (ufw/nftables/firewalld).
Root cause: once connection tracking is enabled, every flow takes one conntrack entry, including short connections during the TIME_WAIT period. When the table is full, the first packet of a new flow is dropped, and the client waits for retransmission until it times out. The table size is set by net.netfilter.nf_conntrack_max (the default depends on memory). Triggers: bursts of short connections, reverse proxies that do not reuse upstream connections, large numbers of UDP (DNS) queries, DDoS. The “nf_conntrack: ” prefix comes from pr_fmt, so repeated messages are normal.
sudo sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max
sudo conntrack -S | head -3 # conntrack-tools: insert_failed / drop counters
sudo conntrack -L 2>/dev/null | awk '{print $1, $4}' | sort | uniq -c | sort -rn | head
net.netfilter.nf_conntrack_count = 262144 net.netfilter.nf_conntrack_max = 262144 cpu=0 found=0 invalid=12 insert=0 insert_failed=0 drop=48211 early_drop=0 … 201833 tcp TIME_WAIT
echo 'net.netfilter.nf_conntrack_max = 1048576' | sudo tee /etc/sysctl.d/60-conntrack.conf && sudo sysctl --system >/dev/null # Also reduce the entries: reuse upstream connections (nginx keepalive), and shorten the TIME_WAIT tracking timeout: sudo sysctl -w net.netfilter.nf_conntrack_tcp_timeout_time_wait=30 # Stateless high-traffic ports can be set to notrack in the raw table (use with care, and only together with a firewall)
nf_conntrack_count / nf_conntrack_max (node_exporter provides the metrics) and alert above 75%.conntrack_allowance_exceeded counter is reported by the ENA driver and visible with ethtool -S eth0.kernel: TCP: request_sock_TCP: Possible SYN flooding on port 0.0.0.0:5000. Sending cookies. $ nstat -az TcpExtListenOverflows TcpExtListenDrops TcpExtListenOverflows 18322 0.0 TcpExtListenDrops 18322 0.0
Symptom: during traffic peaks (or when traffic is switched back after a release), p99 latency spikes and connections time out now and then. The kernel prints SYN flooding, but there is no attack.
Root cause: a listening socket has two queues. The SYN (half-open) queue and the accept (fully established) queue. If the application calls accept() too slowly (all workers busy, event loop blocked), the accept queue fills up. The kernel then drops handshakes and counts ListenOverflows. If the SYN queue fills, the kernel prints this message and enables SYN cookies. Accept queue length = min(backlog passed to listen(), net.core.somaxconn). gunicorn's default backlog is 2048. See the Send-Q column of ss -ltn.
ss -ltn 'sport = :5000' # LISTEN line: Recv-Q = currently queued, Send-Q = queue limit nstat -az | grep -E 'ListenOverflows|ListenDrops|SyncookiesSent' sysctl net.core.somaxconn net.ipv4.tcp_max_syn_backlog net.ipv4.tcp_syncookies pidstat -t -p $(pgrep -d, -f gunicorn) 1 3 | tail -5 # are the workers saturated?
State Recv-Q Send-Q Local Address:Port LISTEN 2049 2048 0.0.0.0:5000 net.core.somaxconn = 4096 net.ipv4.tcp_max_syn_backlog = 2048 net.ipv4.tcp_syncookies = 1
gunicorn --backlog 4096 with net.core.somaxconn ≥ the backlog. Keep tcp_syncookies=1.ListenOverflows and the Recv-Q of LISTEN sockets. Apply connection rate limiting and slow start at the load balancer (warm up new instances).kernel: INFO: task jbd2/sda1-8:245 blocked for more than 122 seconds. kernel: Not tainted 7.0.0-15-generic #15-Ubuntu kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kernel: task:jbd2/sda1-8 state:D stack:0 pid:245 tgid:245 ppid:2 flags:0x00004000
Symptom: the system freezes intermittently for tens of seconds to a few minutes. SSH connects but commands do not return, and every process that writes files hangs. Then the kernel prints hung task messages and call stacks.
Root cause: the hung task detector finds a task in D state (uninterruptible sleep) for longer than hung_task_timeout_secs (default 120 seconds). This is a symptom: the task is waiting for I/O or a lock. Common root causes: storage that is extremely slow or unresponsive (cloud disk IOPS or throughput at its limit and throttled, burst credits used up, host storage failure, unresponsive NFS), dirty pages being written back all at once, and filesystem or driver bugs.
iostat -xz 1 3 | tail -8 # await, %util, aqu-sz ps -eo state,pid,comm,wchan:32 | awk '$1=="D"' cat /proc/pressure/io; grep -E 'Dirty|Writeback' /proc/meminfo # Cloud side: Azure disk metric "Data Disk IOPS Consumed Percentage" / AWS EBS VolumeQueueLength, BurstBalance
Device r/s w/s rkB/s wkB/s r_await w_await aqu-sz %util sda 2.0 498.0 16.0 63744.0 12.30 1840.55 916.2 100.0 D 245 jbd2/sda1-8 jbd2_journal_commit_transaction D 2210 gunicorn folio_wait_bit_common
vm.dirty_background_ratio/vm.dirty_ratio (or use the *_bytes variants) to smooth out writeback.hard + timeo, with monitoring), and fix the server side.hung_task_timeout_secs to 0. Alert on IO PSI and disk latency.fio to confirm its actual IOPS and latency, and make sure you are not relying on burst credits.kernel: watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [kworker/1:2:1874] kernel: Modules linked in: … kernel: CPU: 1 UID: 0 PID: 1874 Comm: kworker/1:2 Not tainted 7.0.0-15-generic #15-Ubuntu
Symptom: a VM prints soft lockup when the host is busy, with clock jumps and application timeouts. On bare metal, this usually points to a driver bug.
Root cause: a soft lockup means a CPU has stayed in kernel mode beyond the threshold (about 2×watchdog_thresh, default 20 seconds) without yielding to the scheduler. In a VM, the most common cause is a vCPU not being scheduled by the host (high steal time: overcommitted host, exhausted burst credits, live migration). The guest kernel wakes up and finds that much time has passed. Other causes: long loops in a driver or kernel bug, and a flood of interrupts.
mpstat -P ALL 1 3 | tail -6 # %steal vmstat 1 5 # st column sudo journalctl -k -b | grep -E 'soft lockup|clocksource|hrtimer' | tail -5 # Cloud side: AWS T-series CPUCreditBalance; Azure B-series CPU Credits Remaining
CPU %usr %sys %iowait %steal %idle all 21.0 9.5 0.2 38.7 30.6
$ uptime 11:42:10 up 12 days, 3:01, 2 users, load average: 38.12, 35.80, 22.41 $ vmstat 1 3 procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu------- r b swpd free buff cache si so bi bo in cs us sy id wa st gu 1 36 0 812344 9120 1904112 0 0 0 2 310 402 3 2 80 15 0 0 kernel: nfs: server 10.0.0.10 not responding, still trying
Symptom: the monitoring alert says “load 38 on a 2-core machine.” On-call assumes the CPU is saturated, and adding capacity does not help.
Root cause: the Linux load average is an exponential moving average of the number of R (runnable) and D (uninterruptible sleep) tasks. Other Unix systems count only CPU. When many processes are stuck in D state (waiting for NFS, a slow disk (#44), or kernel locks), the load is high while the CPU is idle. See the b column and wa in vmstat.
ps -eo state,pid,comm,wchan:30 | awk '$1 ~ /D/' | head cat /proc/pressure/cpu /proc/pressure/io findmnt -t nfs,nfs4 -o TARGET,SOURCE,OPTIONS; nfsstat -m 2>/dev/null | head
kill -9 to them, because they cannot receive signals.See Hour 7, Module 1: USE method and 60-second analysis, Hour 7, Module 2.
2026/11/17 11:50:02 [crit] 3301#3301: *1 connect() to 127.0.0.1:5000 failed (13: Permission denied) while connecting to upstream, client: 10.0.0.9, …
$ sudo ausearch -m AVC -ts recent | tail -2
type=AVC msg=audit(1763380202.311:812): avc: denied { name_connect } for pid=3301 comm="nginx" dest=5000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:commplex_main_port_t:s0 tclass=tcp_socket permissive=0
Symptom: on Rocky/Alma 10, after adding an nginx reverse proxy in front of myapp, requests return 502. curl 127.0.0.1:5000 works, and the permission bits and the firewall are fine.
Root cause: with SELinux enforcing, nginx runs in the httpd_t domain. The default policy forbids it from actively connecting to arbitrary ports (name_connect). The errno is still 13 (EACCES), but DAC has already passed, so this is an LSM denial. Similar cases: listening on a non-standard port (name_bind, needs semanage port), or files in a non-standard directory with the wrong label (needs semanage fcontext + restorecon).
getenforce; sudo ausearch -m AVC,USER_AVC -ts recent | audit2why | head -15 getsebool httpd_can_network_connect sudo semanage port -l | grep -w 5000 ls -Zd /opt/myapp/app /opt/myapp/venv/bin/gunicorn
Enforcing Was caused by: One of the following booleans was set incorrectly. Description: Allow httpd to can network connect Allow access by executing: # setsebool -P httpd_can_network_connect 1 httpd_can_network_connect --> off
sudo setsebool -P httpd_can_network_connect 1 # allow httpd_t to make network connections (as audit2why suggests) # More restrictive: allow connections only to HTTP-type ports. Add 5000 to http_port_t (use -m if it is in use), and enable httpd_can_network_relay curl -sI http://127.0.0.1/ | head -1
audit2why first. Prefer booleans, then port and file labels, and only then a custom policy module (audit2allow -M, which needs manual review). Do not run setenforce 0. At most, set a single domain to permissive while you investigate.ansible.posix.seboolean, community.general.sefcontext).kernel: audit: type=1400 audit(1763381000.120:301): apparmor="DENIED" operation="open" class="file" profile="myapp" name="/etc/myapp/tls.key" pid=2210 comm="gunicorn" requested_mask="r" denied_mask="r" fsuid=998 ouid=0 myapp[2210]: PermissionError: [Errno 13] Permission denied: '/etc/myapp/tls.key'
Symptom: in hour 6 you enabled an AppArmor profile for myapp. Today TLS went live, and the new key file cannot be read, even though the myapp user owns it.
Root cause: AppArmor enforces access control by path. A process under the myapp profile can only access the paths and permissions listed in its rules, and new paths are denied by default. Also: distribution-provided profiles (such as mysqld and tcpdump) do not allow non-default data directories. Since Ubuntu 24.04, unprivileged user namespaces are restricted by default, so sandboxed programs such as browsers and some container tools need dedicated profiles.
sudo aa-status | grep -A3 -E 'profiles are in enforce mode' | head; sudo aa-status | grep myapp sudo journalctl -k --since -1h | grep 'apparmor="DENIED"' | tail -5 cat /proc/$(systemctl show -p MainPID --value myapp)/attr/current
myapp myapp (enforce)
sudo aa-complain myapp # during investigation: log only, do not block # Add minimal rules to /etc/apparmor.d/myapp: /etc/myapp/tls.key r, sudo apparmor_parser -r /etc/apparmor.d/myapp && sudo aa-enforce myapp sudo systemctl restart myapp
aa-logprof suggests rules → manual review → enforce.See Hour 6, Module 2.
$ sudo apt update E: Release file for http://archive.ubuntu.com/ubuntu/dists/resolute-updates/InRelease is not valid yet (invalid for another 3h 12min 5s). Updates for this repository will not be applied. $ curl https://pypi.org curl: (60) SSL certificate problem: certificate is not yet valid
Symptom: VMs restored from snapshots, laptop VMs resumed after a long suspend, and isolated machines without NTP access all have apt and TLS failures. Kerberos and Entra tokens and TOTP also fail because of the clock. Logs have wrong timestamps, which makes post-incident analysis hard.
Root cause: the clock is behind or ahead. On 26.04, new installs default to chrony (replacing systemd-timesyncd, and using NTS by default for Ubuntu time servers). Upgraded systems need a manual migration. Loss of sync happens when NTP is blocked (UDP 123, or the TCP 4460 used by NTS), or when a VM snapshot restore causes a jump larger than chrony's makestep threshold. In the cloud, Azure can use the host PTP clock source (/dev/ptp_hyperv), and AWS provides the Amazon Time Sync Service (169.254.169.123).
timedatectl chronyc tracking | grep -E 'Reference|System time|Leap' chronyc sources -v | tail -5 systemctl is-active chrony systemd-timesyncd 2>/dev/null
Local time: Mon 2026-11-17 08:30:10 UTC
System clock synchronized: no
NTP service: active
Reference ID : 00000000 ()
System time : 11525.120334 seconds slow of NTP time
Leap status : Not synchronised
sudo chronyc makestep # step the clock immediately (needs a reachable time source) # Allow outbound NTP/NTS, or use a time source inside the cloud (see the platform docs): # AWS: server 169.254.169.123 prefer iburst Azure: refclock PHC /dev/ptp_hyperv poll 3 dpoll -2 offset 0 sudo systemctl restart chrony && chronyc tracking | grep 'Leap'
chronyc tracking) and alert above 100 ms. Use UTC on all servers.kernel: EXT4-fs error (device sda1): ext4_lookup:1859: inode #131074: comm gunicorn: deleted inode referenced: 131080 kernel: EXT4-fs (sda1): Remounting filesystem read-only myapp[2210]: OSError: [Errno 30] Read-only file system: '/var/lib/myapp/state.json'
Symptom: a service suddenly cannot write. touch reports Read-only file system, and mount shows the root partition as ro.
Root cause: when ext4 finds inconsistent metadata, it acts according to errors=. The Ubuntu root partition defaults to errors=remount-ro, which switches to read-only to prevent further damage. Triggers: underlying I/O errors (disk or storage backend failure, a cloud disk detached unexpectedly), unclean power loss, kernel or driver bugs, memory errors. Read-only is a protective measure, not the fault itself. XFS can shut down a filesystem after serious errors, with similar symptoms.
findmnt -no OPTIONS / sudo journalctl -k -b | grep -E 'EXT4-fs|I/O error|blk_update_request|nvme|sd[a-z]' | tail -10 sudo dumpe2fs -h /dev/sda1 2>/dev/null | grep -iE 'state|errors|error count|last error' sudo smartctl -H /dev/sda 2>/dev/null | tail -2 # physical disk; for cloud disks, check the platform health events
ro,relatime,errors=remount-ro Filesystem state: clean with errors Errors behavior: Remount read-only FS Error count: 3
e2fsck -f /dev/sda1 (for XFS, use xfs_repair). Then boot normally.EXT4-fs error / I/O error. Take snapshots regularly and practice restores. Keep data on replaceable data disks so the root disk can be rebuilt at any time (immutable infrastructure).Choose a scenario and click “Run” to see which gate the myapp request fails at, and what the kernel or systemd records (the order is illustrative).
linuxlab (2 vCPU / 4 GB). All limits are added with l8_inject to myapp.service or to a one-off systemd-run transient unit, so the whole machine is not affected. Run l8_heal when you finish.sudo systemd-run --unit=lab8-oom -p MemoryMax=100M -p MemorySwapMax=0 --wait \
python3 -c 'b=bytearray(300*1024*1024); print("allocated")'; echo "exit=$?"
journalctl -u lab8-oom -n 3 --no-pager -o cat; sudo journalctl -k -n 2 --no-pager -o cat | grep -i killedRunning as unit: lab8-oom.service; invocation ID: … Finished with result: oom-kill Main processes terminated with: code=killed/status=KILL exit=137 lab8-oom.service: The kernel OOM killer killed some processes in this unit. lab8-oom.service: Failed with result 'oom-kill'. Memory cgroup out of memory: Killed process 5521 (python3) total-vm:…kB, anon-rss:…kB, …
137 = 128 + 9 (SIGKILL). Other processes on the machine are unaffected. That is the value of setting MemoryMax on each service.
sudo systemd-run --unit=lab8-pids -p TasksMax=20 --wait --pipe \
python3 -c '
import threading,time
n=0
try:
while True:
threading.Thread(target=time.sleep,args=(5,),daemon=True).start(); n+=1
except RuntimeError as e: print("threads:",n,"error:",e)'
threads: 19 error: can't start new thread
grep 'open files' /proc/$(systemctl show -p MainPID --value myapp)/limits
sudo systemd-run --unit=lab8-fd -p LimitNOFILE=1024 --wait --pipe \
python3 -c 'fs=[open("/dev/null") for _ in range(1100)]' 2>&1 | tail -1Max open files 1024 524288 files OSError: [Errno 24] Too many open files: '/dev/null'
printf '[Service]\nLimitNOFILE=65536\n' | l8_inject && sudo systemctl restart myapp grep 'open files' /proc/$(systemctl show -p MainPID --value myapp)/limits l8_heal
Max open files 65536 65536 files active
dm-delay to create an extremely slow loopback block device, which produces D-state tasks (needs dmsetup, installed by default on Ubuntu):DEV=$(l8_loop slow 64M) && S=$(sudo blockdev --getsz $DEV) echo "0 $S delay $DEV 0 2000" | sudo dmsetup create lab8slow # each I/O is delayed by 2 seconds for i in 1 2 3 4 5 6; do sudo dd if=/dev/mapper/lab8slow of=/dev/null bs=4k count=50 iflag=direct status=none & done sleep 8; ps -eo state,comm | awk '$1=="D"' | sort | uniq -c; uptime; vmstat 1 2 | tail -1
6 D dd 12:10:31 up 3:02, 1 user, load average: 5.12, 1.40, 0.52 0 6 0 2810232 … 0 0 4 0 210 302 0 1 99 0 0 0
wait; sudo dmsetup remove lab8slow; l8_clean
No verified video covers conntrack table full, SYN/accept queue overflow, or ext4 read-only. Storyboard:
nf_conntrack_count approaches the limit. The kernel starts printing table full, and clients time out instead of being refused.ss -ltn climbs to Send-Q, and ListenOverflows grows in nstat.dmsetup, showing Remounting filesystem read-only and the repair with e2fsck.rm does not free space, root is denied, load is high while the CPU is idle, and a container is not a virtual machine.Skim the questions and what they test first, and mark the ones you are unsure of. Click a row to jump to the detailed answer.
./deploy.sh > out.log in bash and press Enter, until the command finishes? Intermediatebash reads the line → splits words and expands them (variables, globs, command substitution), handles redirection → looks up the command (alias, function, builtin, PATH; a name containing / is treated as a path) → fork() (in practice clone()) → the child runs open("out.log") and dup2 onto fd 1 → execve(): the kernel checks path permissions and loads the interpreter named in #! → the program runs, calling into the kernel through system calls → exit() → the parent shell wait()s, and the exit code goes into $?.
out.log as the current user, so sudo cmd > /root/x fails.O_CLOEXEC is set).strace -f -e trace=clone,clone3,execve,openat,dup2,wait4 bash -c './deploy.sh > out.log'
cd has to change the shell's own directory, so builtins still work when fork fails (#40).hash -r).Match errno values to Part A: EACCES (#1, #4), ENOENT (#2, bad interpreter), E2BIG (#19), EAGAIN (#40).
“The shell runs the program directly.” This misses the separation of fork and exec, and the timing of redirection.
Firmware (UEFI, virtual in the cloud) → GRUB (Secure Boot via shim) loads the kernel and initramfs → the kernel initializes hardware and runs the initramfs init (loads storage drivers, unlocks LUKS, finds the real root) → switches to the real root and runs /sbin/init (systemd, PID 1) → starts units in parallel according to their dependencies, up to default.target (multi-user.target on servers) → sshd. In the cloud, cloud-init fetches configuration from the metadata service in stages during this time (hostname, users, keys, growing the root partition), and then the cloud agent registers.
VFS: Unable to mount root fs (#38)..mount units. A failed data disk drags down local-fs.target by default, which leads to emergency mode (#21, #28).systemd-analyze, systemd-analyze critical-chain, and cloud-init analyze show.Map each stage to an out-of-band tool (Figure 3-1), and mention how Secure Boot / trusted boot affects self-compiled kernel modules.
Describing SysV /etc/inittab and runlevels 0–6 with serial startup, and not mentioning systemd's parallel, dependency-based startup.
The CPU has privilege levels. The kernel runs in privileged mode, with direct access to hardware and all memory. Applications run in user mode. To use files, networking, processes or memory services, they trap into the kernel through a system call (the x86-64 syscall instruction). The kernel dispatches on the call number and returns a result or -errno. glibc stores errno in a thread-local variable. To observe calls: strace (ptrace, high overhead), perf trace, eBPF (bpftrace, syscount).
clock_gettime complete in user space without trapping into the kernel, so strace does not see them.sy (vmstat) and cs columns.strace -c -f -p $(systemctl show -p MainPID --value myapp) # after Ctrl-C, shows statistics per system call
sudo bpftrace -e 'tracepoint:raw_syscalls:sys_enter /comm == "gunicorn"/ { @[args.id] = count(); }' # count by call number; use ausyscall <number> to convert it to a name
# Older bpftrace versions use args->id. You can also use bcc's syscount (Ubuntu package bpfcc-tools, command syscount-bpfcc)
Discuss seccomp (restricting system calls), how it relates to the default seccomp profile in containers, and SystemCallFilter=.
“System calls are just calling library functions.” This confuses the libc wrapper functions with the actual kernel entry point.
On Linux, processes and threads are both tasks (task_struct). The difference is how much they share: threads share the address space, fds and more (clone flags). A zombie (Z) has exited, but its parent has not called wait(), so it only occupies a process table entry. An orphan has a parent that exited first, so it is adopted and reaped by init (or a subreaper). Many zombies mean the parent process is faulty. Fix or restart the parent. Killing the zombies does not help.
ps -eo pid,ppid,stat,comm | awk '$3 ~ /Z/' # find zombies and their parents ps -o pid,nlwp,cmd -p $(pgrep -f gunicorn | head -1) # thread count (NLWP)
tini or --init.pids.max/TasksMax (#40).Mention that systemd is a subreaper, and that KillMode=control-group cleans up the whole group when a service stops (#23).
“kill -9 the zombie process.”
SIGTERM (15) requests termination. It can be caught for a graceful exit (finish requests, close connections). SIGKILL (9) is enforced by the kernel directly; it cannot be caught and gets no cleanup. SIGHUP originally meant terminal hangup, and daemons often use it to reload configuration. systemctl stop: ExecStop= (if set) → send KillSignal= (default SIGTERM) to the cgroup → wait for TimeoutStopSec (default 90 seconds) → if the process is still running, SIGKILL (FinalKillSignal=).
docker stop often waits 10 seconds before sending SIGKILL.systemctl show myapp -p KillMode -p KillSignal -p TimeoutStopUSec sudo systemctl kill -s HUP myapp
Zero-downtime release: the load balancer removes the instance (draining connections) → SIGTERM → wait → add the new version back once its health check passes.
“SIGHUP just kills the process.”
An inode stores metadata (owner, permissions, times, size, block locations) and the link count, but not the file name. A directory maps “name → inode number.” A hard link is another name for the same inode; it cannot cross filesystems or link directories. A symbolic link is a separate file that stores the target path, and it can dangle. unlink only removes a name. Blocks are freed only when the link count reaches 0 and no process has the file open. This is #18.
stat -c '%i %h %n' file hardlink # same inode, link count 2 sudo lsof +L1 # files with link count 0 that are still open df -i # inode usage (#19)
mv only changes the directory entry, so it is atomic. Across filesystems it is a copy plus a delete. An “atomic replace” therefore has to use rename within the same filesystem.cp /proc/<PID>/fd/<N> /tmp/recovered.Tie together three production scenarios: inode exhaustion, deleted files that are still open, and atomic rename.
“Symbolic and hard links are both shortcuts.”
On a directory, r lists the names, w creates, deletes or renames entries (it requires x), and x enters the directory and accesses its entries (required for path resolution). SUID runs the program as the file owner (passwd). SGID on a directory makes new files inherit the directory's group (for team sharing). The sticky bit (the t in /tmp) lets only the owner delete their own files. umask removes bits from the default permissions (022 → files 644, directories 755). ACLs grant extra permissions to additional users and groups, limited by the mask.
install -d -m 2770 -g devs /srv/shared # SGID shared directory setfacl -m u:myapp:rx /srv/shared; setfacl -d -m g:devs:rwX /srv/shared # default ACL so new files inherit it namei -l /srv/shared/report.txt
SUID programs are a high-risk point for privilege escalation (audit with find / -perm -4000). They can be blocked with the nosuid mount option.
“If a directory has r, you can read the files inside it.”
See Hour 1, Module 3.
Capabilities split root's privileges into dozens of items: CAP_NET_BIND_SERVICE binds ports below 1024, CAP_NET_ADMIN configures networking, CAP_SYS_ADMIN is nearly root, CAP_LINUX_IMMUTABLE changes the i attribute (#3), and so on. Give a service only what it needs: systemd User=myapp + AmbientCapabilities=CAP_NET_BIND_SERVICE + CapabilityBoundingSet=CAP_NET_BIND_SERVICE. Or use file capabilities with setcap, or let a reverse proxy or load balancer listen on port 80.
[Service] User=myapp AmbientCapabilities=CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_BIND_SERVICE NoNewPrivileges=yes
grep Cap /proc/$(systemctl show -p MainPID --value myapp)/status | xargs -L1 echo; capsh --decode=0000000000000400
net.ipv4.ip_unprivileged_port_start can lower the privileged-port threshold globally (use with care).--privileged gives back nearly all of them.Mention systemd-analyze security myapp, which gives an exposure score, and tighten the settings one by one.
“Run it as root and chmod 777, and it's fine.”
See Hour 6, Module 1 and Hour 6, Module 7.
free -m: what is buff/cache? How should you read available? Should you enable swap? IntermediateFree memory is used as page cache (file data) and buffers, and it can be reclaimed. A low free value therefore does not mean you are short of memory. available is the kernel's estimate of how much memory can be allocated without swapping. When memory is tight, check it together with PSI. Swap gives anonymous pages somewhere to go. A moderate amount of swap (with vm.swappiness) lets the kernel move cold pages out and avoids premature OOM kills. But latency-sensitive services that swap heavily will thrash.
malloc only reserves address space. A physical page is allocated on the first write that causes a page fault. vm.overcommit_memory takes the values 0, 1, or 2.memory.high throttles and reclaims first, while memory.max triggers OOM (#39).free -m; cat /proc/pressure/memory; vmstat 1 5 # check the si/so columns for swap-in and swap-out grep -E 'MemAvailable|Dirty|AnonPages|Shmem' /proc/meminfo
Alert on memory using PSI (some/full) rather than a "free percentage." systemd-oomd is built on PSI.
"Free shows only 200 MB left, so we need more RAM." This ignores reclaimable cache.
See Hour 7, Module 3.
Load average is the exponentially weighted moving average, over 1, 5, and 15 minutes, of the number of runnable (R) plus uninterruptible sleep (D) tasks. Compare it with the CPU count and look at what makes it up. A high R count means the CPU is saturated (see the vmstat r column and PSI cpu). A high D count means tasks are waiting on I/O or locks (#46), and adding CPUs will not help. Whether a load of 8 is a problem depends on your latency targets, saturation, and errors.
uptime; nproc vmstat 1 5 # r = run queue, b = D state, wa = I/O wait, st = steal cat /proc/pressure/cpu /proc/pressure/io ps -eo state | sort | uniq -c
Mention Brendan Gregg's historical explanation of why Linux counts D-state tasks in the load average, and the USE method.
"Load is just CPU utilization."
See Hour 7, Module 1 and Hour 7, Module 2.
Package management: apt/dpkg vs. dnf/rpm. Default firewall front ends: ufw vs. firewalld (both built on nftables). Mandatory access control: AppArmor vs. SELinux. Networking: netplan (+ systemd-networkd) vs. NetworkManager. Lifecycle: Ubuntu LTS standard support for 5 years (10 years total with Pro) vs. 10 years for RHEL. 26.04 changes: sudo-rs by default; rust-coreutils (cp, mv, and rm are still GNU); chrony instead of timesyncd on new installs; Dracut instead of initramfs-tools; APT 3.1 removes apt-key; systemd 259 removes cgroup v1; kernel 7.0; and OpenSSH 10.2 no longer generates DSA host keys.
sudo-ldap. Scripts that parse coreutils error text may be affected. Time sync and custom initramfs configuration need to be migrated.Identify migration risks such as "26.04 is the last version to support SysV service scripts," and come up with a plan for them.
"Distributions only differ in their package managers."
See Hour 1, Module 1 and Sources and versions.
A container is a normal process plus namespaces (isolated views: pid, mnt, net, uts, ipc, user, cgroup, time), cgroups v2 (limits and accounting for CPU, memory, I/O, and pids), capability dropping, seccomp, and an LSM (to reduce the attack surface), and a union filesystem such as overlayfs as its root. Containers share the host kernel. A VM runs on virtual hardware provided by a hypervisor and has its own kernel. Containers are therefore fast and dense, but the isolation boundary is the kernel. A kernel vulnerability or excessive privileges (--privileged, mounting docker.sock) can lead to a container escape.
sudo unshare --pid --fork --mount-proc --uts --net bash -c 'hostname lab8; ps -ef; ip link' lsns | head; systemd-cgls --no-pager | head -20
MemoryMax/TasksMax use the same mechanism as the container flags --memory/--pids-limit (#39, #40).Be ready to demonstrate with unshare live, or explain that rootless containers depend on user namespaces, and that Ubuntu uses AppArmor to restrict unprivileged user namespaces.
"A container is a lightweight VM."
See Hour 6, Module 7 and Docker in 8 Hours.
Trusted sources: signed repositories bound with Signed-By (#11). Controlled versions: an internal mirror or snapshot repository, and when needed apt-mark hold, APT pinning, or dnf versionlock. Reproducible builds: Packer golden images that record the package manifest and SBOM. Auditable changes: patch platform compliance reports, /var/log/apt/history.log, and dnf history. For offline environments, build a local mirror with Pulp, Satellite, Landscape, or aptly/reposync.
apt-cache policy redis-server; sudo apt-mark hold redis-server
dpkg-query -W -f='${Package} ${Version}\n' > packages-$(date +%F).txt
# RHEL family: sudo dnf install python3-dnf-plugin-versionlock && sudo dnf versionlock add redis
Mention Ubuntu Pro's ESM and Livepatch, RHEL's EUS, and CVE scanning (pro fix, OVAL).
"Run apt upgrade -y to the latest version every time."
See Hour 1, Module 6 and Hour 5, Module 3.
A developer runs the Go-compiled myapp-worker from /tmp and it fails. Copied to /opt, it runs, but as a systemd service it cannot read /home/dev/config.yaml. Describe your troubleshooting approach and a deployment standard.
/tmp is mounted noexec (#1), and strace -e execve shows EACCES. Don't relax noexec. Instead, standardize the install path (/opt/<app> or /usr/local/bin, owned by root, mode 0755)./home/dev (0750, #4), or ProtectHome= makes /home invisible./etc/<app>/ (root:app 0640), store data with StateDirectory=, send logs to journald, and run as a system user inside a sandbox. Deploy through configuration management or the image pipeline, not by hand-copying files.The security team requires that "all services run isolated." The current setup includes systemd services on VMs, Docker containers, and execution environments for multi-tenant SaaS plugins. Give tiered recommendations.
DynamicUser, ProtectSystem=strict, PrivateTmp, NoNewPrivileges, CapabilityBoundingSet, SystemCallFilter, resource limits), and it has the lowest cost.systemd-analyze security, container baseline scans, and penetration testing.Third-party interview videos vary in quality and may be out of date. Use this hour and the official documentation as the reference. We recommend recording a mock interview and reviewing it yourself.
Skim the questions and focus areas first, and mark the ones you are unsure about. Click a row to jump to the full answer.
Key points: type and dependencies (Type=, After=/Wants=), least privilege (dedicated user, sandbox, capabilities), resource limits (memory, task count, file handles), restart policy (Restart=on-failure with a sensible RestartSec and start rate limiting), and writable directories managed by systemd.
[Unit] Description=myapp (Flask + gunicorn) Wants=network-online.target redis-server.service After=network-online.target redis-server.service StartLimitIntervalSec=60 StartLimitBurst=5 [Service] Type=exec # Counts as started only after execve succeeds (same as in hour 2) User=myapp Group=myapp WorkingDirectory=/opt/myapp/app SyslogIdentifier=myapp EnvironmentFile=/etc/myapp/myapp.env ExecStart=/opt/myapp/venv/bin/gunicorn -w 2 -b 0.0.0.0:5000 app:app ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=3 StateDirectory=myapp MemoryHigh=800M MemoryMax=1G TasksMax=512 LimitNOFILE=65536 NoNewPrivileges=yes ProtectSystem=strict ProtectHome=yes PrivateTmp=yes CapabilityBoundingSet= [Install] WantedBy=multi-user.target
Requires= is a hard dependency: if the other unit fails or stops, this unit goes down with it. Wants= is a soft dependency. Ordering is set only by After=/Before=, and it is independent of the dependency type.network-online.target only when you really need the network to be configured.systemctl start.Use systemd-analyze verify and systemd-analyze security myapp as checks in CI.
Running as root, using Restart=always with RestartSec=0, and using nohup.
See Hour 2, Module 1.
journald collects kernel messages, service stdout/stderr, syslog, and more, and stores them as structured binary logs with fields such as _SYSTEMD_UNIT and _PID. It rotates them automatically by size and time (SystemMaxUse, MaxRetentionSec). rsyslog can read from journald and write text files or forward logs remotely, and logrotate rotates those text files. In production, the local host only buffers logs, and everything is forwarded to a central platform (Azure Monitor Agent + DCR, CloudWatch Agent, Loki/Elastic).
journalctl -u myapp -p warning --since "1 hour ago" -o json-pretty | head -30 journalctl --disk-usage; journalctl --verify | tail -2
/var/log/journal or Storage=persistent (#17). Applications that write their own log files must handle reopening, or use copytruncate (#18).Mention structured logs (JSON) with correlation IDs, and log volume and cost control (sampling, log levels, DCR transformations).
"SSH into each machine and grep the logs."
See Hour 2, Module 2 and Hour 5, Module 7.
Grow each layer in turn: cloud disk → growpart to grow the partition → pvresize → lvextend -r (which also grows the filesystem). Without LVM, use resize2fs or xfs_growfs directly. ext4 can grow and shrink (shrinking requires unmounting), has mature tooling, and has a fixed inode count. XFS handles large files and parallel I/O well, has dynamic inodes, and can only grow. It is the default on the RHEL family and on AL2023. LVM provides online growth, pooling of multiple disks, snapshots, and migration (pvmove).
sudo growpart /dev/sdc 1 && sudo pvresize /dev/sdc1 && sudo lvextend -r -l +100%FREE /dev/vgdata/lvdata lsblk -f; sudo vgs; df -hT /data
Work #19 (inodes), #20 (duplicate XFS UUID), and #22 (forgetting to grow the filesystem) into your answer.
"Just reboot after growing the cloud disk." The root partition is grown automatically by cloud-init, but data disks are not.
See Hour 2, Module 3.
Six fields: device (UUID= recommended), mount point, type, options, dump (almost always 0), and fsck order (root 1, others 2, skip 0). To avoid boot failures, add nofail to data disks (you can also set x-systemd.device-timeout=), add _netdev to network filesystems, and pre-check changes with findmnt --verify and mount -a. If you're not sure about an entry, use noauto or automount (x-systemd.automount).
UUID=5c0e… /data xfs defaults,nofail,x-systemd.device-timeout=10s 0 2 //files/share /mnt/share cifs credentials=/etc/cifs.cred,_netdev,nofail,x-systemd.automount 0 0
.mount unit for each line. Without nofail, the mount becomes a Requires of local-fs.target (#21, lab 3-B).Describe an out-of-band recovery plan: serial console, ALAR, and rescue instances.
"If you get it wrong, just reboot and see."
See Hour 2, Module 4.
The application resolves the name with getaddrinfo() (nsswitch → systemd-resolved → upstream DNS). Then socket() and connect() run. The kernel looks up the route (ip rule policy → routing table) to choose the interface, next hop, source address, and ephemeral port. The SYN passes through netfilter (OUTPUT → POSTROUTING), where conntrack creates an entry and SNAT may apply. The neighbor subsystem (ARP/ND) resolves the next hop's MAC. Then comes the qdisc, the NIC driver (virtio, ENA, or MANA in the cloud, or accelerated networking), and the wire. Replies travel through PREROUTING → INPUT → the socket.
ip route get 151.101.0.223; ip rule; ip neigh ss -tni dst 151.101.0.223 # congestion window, RTT, retransmissions sudo conntrack -L -d 151.101.0.223 2>/dev/null | head -2 sudo tcpdump -ni eth0 host 151.101.0.223 -c 10
Mention eBPF/XDP processing packets at the driver layer, and cloud accelerated networking (SR-IOV) bypassing the host's virtual switch.
Only talks about the seven OSI layers without mapping them to Linux commands and components.
See Hour 2, Module 5 and Hour 7, Module 5.
TIME_WAIT appears on the side that closes actively. It lasts 2×MSL (fixed at about 60 seconds on Linux), so the final ACK and old packets can drain. This is normal. A large number means many short-lived connections, and clients may run out of ephemeral ports. CLOSE_WAIT appears on the side that closes passively. The peer has closed, but the local side has not called close(). This is almost always an application bug (a connection leak), and it eventually exhausts file descriptors (#41).
ss -s; ss -tan state time-wait | wc -l; ss -tanp state close-wait | head sysctl net.ipv4.ip_local_port_range net.ipv4.tcp_tw_reuse
ip_local_port_range, and enable tcp_tw_reuse on clients. Do not use tcp_tw_recycle, which has been removed.Be able to draw the four-way close and mark where each of the two states appears.
"Set the TIME_WAIT timeout to 1 second."
See Hour 7, Module 5.
glibc looks up names in the order given by hosts: in /etc/nsswitch.conf: files → /etc/hosts, resolve → systemd-resolved, and dns → the servers in resolv.conf. On Ubuntu, resolv.conf points to the 127.0.0.53 stub. resolved handles caching, per-domain routing (per-link DNS, ~corp.example), and DNSSEC/DoT, then forwards to the upstream servers. Intermittent failures come from upstream timeouts or rate limiting (cloud DNS enforces a query rate limit per interface), UDP drops caused by conntrack (#42), multiple lookups caused by search domains, and IPv6 AAAA timeouts.
getent ahosts pypi.org; resolvectl query pypi.org; resolvectl statistics sudo tcpdump -ni any port 53 -c 20 cat /etc/nsswitch.conf | grep hosts
Mention local caching (resolved or a node-local DNS cache) and cloud DNS quotas (the AWS Route 53 Resolver per-ENI queries-per-second limit; check the documentation for current values).
"Just add 8.8.8.8 to /etc/resolv.conf." (An anti-pattern, see #25.)
See Hour 2, Module 5.
The kernel packet filtering framework is netfilter. nftables is the current engine and tool (nft), and on modern distributions iptables is mostly the iptables-nft compatibility layer. ufw (Ubuntu) and firewalld (RHEL family, zone-based) are rule front ends. Cloud security groups and NSGs filter at the virtual network layer. A host firewall adds defense in depth (against lateral movement within a subnet and accidentally opened security groups). Manage both with IaC so they stay consistent.
sudo nft list ruleset | head -40 sudo ufw status numbered; sudo firewall-cmd --list-all # on Ubuntu / RHEL family respectively update-alternatives --display iptables 2>/dev/null | head -3
DOCKER-USER chain.Explain the conflict risk when two front ends manage rules at the same time, and standardize on a single entry point.
"With security groups in place, you can turn off the host firewall."
See Hour 6, Module 3 (firewalls).
The basics: disable password and root logins (PasswordAuthentication no, PermitRootLogin no), use only modern keys such as Ed25519, restrict access with AllowGroups, set MaxAuthTries, and keep SSH off the public internet (go through a bastion, VPN, or zero trust). At scale: use SSH certificates (a CA signs short-lived user certificates, with TrustedUserCAKeys; host certificates solve #8), or use cloud identity (Entra sign-in + RBAC #26, SSM Session Manager #35, EC2 Instance Connect), and audit sessions centrally.
sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin|pubkeyauthentication|allowgroups|kexalgorithms' ssh-keygen -s ca_key -I alice@corp -n labadmin -V +8h ~/.ssh/id_ed25519.pub # user certificate valid for 8 hours
sshd -t before applying them, and keep one logged-in session open (the same principle as #6).Mention the OpenSSH 10 changes (DSA removed, post-quantum hybrid key exchange on by default) and compliance requirements for session recording.
"Changing to a non-22 port makes it secure."
See Hour 2, Module 6 and Hour 6, Module 4.
cron is simple and universal. systemd timers send logs to journald, run in the same environment as services (user, sandbox, resource limits), use Persistent=true to run missed jobs, use RandomizedDelaySec to spread out load spikes at the top of the hour, support dependencies and locking (the same service never runs twice at once), and can all be listed with systemctl list-timers. Use a timer for new jobs.
# /etc/systemd/system/myapp-backup.timer [Timer] OnCalendar=*-*-* 02:30:00 RandomizedDelaySec=15m Persistent=true [Install] WantedBy=timers.target
systemd-analyze calendar '*-*-* 02:30:00'; systemctl list-timers --all | head
% must be escaped, output gets swallowed by email, and overlapping runs are not prevented (you need flock).Alert when a scheduled job does not succeed on time (dead man's switch or heartbeat monitoring).
"cron is enough, timers are too complicated." This ignores observability and catch-up runs.
See Hour 2, Module 7.
First, quantify and scope the problem: which endpoint, how slow (p50/p99), since when, whether all instances are affected, and any recent changes. Then work through the layers: client/CDN/LB → network (RTT, retransmissions, DNS) → host (USE: utilization, saturation, and errors for CPU, memory, disk, and network) → application (worker saturation, slow queries, locks, GC) → dependencies (Redis, databases, external APIs). Use data to narrow the scope.
curl -o /dev/null -s -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}\n' https://myapp.example.com/healthz
uptime; dmesg -T | tail; vmstat 1 5; mpstat -P ALL 1 3; pidstat 1 3; iostat -xz 1 3; free -m; sar -n DEV,TCP,ETCP 1 3
ss -ltn 'sport = :5000'; nstat -az | grep -E 'ListenOverflows|Retrans'
sudo py-spy dump --pid $(systemctl show -p MainPID --value myapp) | head -30
redis-cli --latency -i 1 | head -3
Be able to explain RED (Rate, Errors, Duration) for services and USE for resources, and share a real incident story.
Jumping straight to "restart the service / add machines."
See Hour 7, Module 1.
TLS certificate validity, Kerberos and OAuth tokens, TOTP, distributed databases and consensus protocols, and log correlation and auditing all depend on accurate time (#49). timesyncd is only an SNTP client. chrony is a full NTP implementation: it converges quickly, adapts to intermittent networks and VMs, can act as a server, and supports PHC hardware clocks and NTS (authenticated NTP). On new Ubuntu 26.04 installs, chrony is the default, and NTS is enabled for Ubuntu time servers. The RHEL family has always used chrony.
chronyc tracking; chronyc sources -v; timedatectl show-timesync 2>/dev/null | head -3
makestep to step the clock. Otherwise slew, which prevents time from going backward. Leap-second smearing must be consistent across the whole cluster./dev/ptp_hyperv).Set alerts for clock offset and include it in startup health checks.
"Just change it manually with date -s."
See Hour 2, Module 7.
Six hours after the new myapp version went live, it reports Too many open files, and ss shows more than 900 CLOSE_WAIT connections to Redis. Identify the root cause, stop the bleeding, and propose a long-term fix.
LimitNOFILE (#41).process_open_fds and the CLOSE_WAIT count.The nightly batch job on batch-03 intermittently fails with Temporary failure in name resolution, and the problem cannot be reproduced during the day. How do you investigate?
resolvectl statistics, and the nightly job (how many concurrent queries the batch run generates).Third-party interview videos vary in quality and may be out of date. Use this hour and the official documentation as the reference.
Skim the questions and focus areas first, and mark the ones you are unsure about. Click a row to jump to the full answer.
cloud-init is the cloud image initialization framework. It detects the data source (Azure, EC2, NoCloud, and so on), gets metadata and user data from the metadata service or an attached medium, and applies first-boot configuration module by module. Stages: generator (whether it is enabled) → local (no network yet: find the data source and write network configuration) → network (fetch metadata and user data, bootcmd, disk mounts, grow the root partition) → config (users, package sources, and so on) → final (install packages, runcmd, user scripts, final message).
cloud-init status --long; cloud-init analyze show | head -20
cloud-init query -a | jq '.v1 | {cloud_name, region, instance_id}'
sudo cloud-init schema --system --annotate
Stress that cloud-init should be thin: it only bootstraps, and complex logic belongs in the image or in configuration management. Validate the schema in CI.
"cloud-init runs the user data on every boot."
See Hour 3, Module 2 and Hour 4, Module 2.
The metadata service (169.254.169.254) gives any process on the instance its instance information and temporary cloud identity credentials. If an application has an SSRF (server-side request forgery) bug, an attacker can use it to request the credentials URL and steal the instance role. IMDSv2 requires you to first PUT to get a session token, and then include it in a header. Most SSRF bugs can only send GET requests and cannot add headers. The PUT response's IP TTL is limited by a hop limit, so the token cannot leave the host. Requests that carry X-Forwarded-For are rejected. AL2023 enforces IMDSv2 by default with a hop limit of 2 (#34).
Metadata: true and rejects requests that carry X-Forwarded-For, which serves a similar purpose.aws ec2 modify-instance-metadata-defaults --region ca-central-1 --http-tokens required --http-put-response-hop-limit 2 aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name MetadataNoToken --dimensions Name=InstanceId,Value=i-0abc… --statistics Sum --period 3600 --start-time $(date -u -d '-1 day' +%FT%TZ) --end-time $(date -u +%FT%TZ)
MetadataNoToken metric, and enforce v2 in a test environment to surface failures.Cite a real event where an SSRF was used to steal instance credentials (you don't need to name it), and explain organization-wide defaults and enforcement with SCPs.
"The metadata service is only reachable locally, so it is safe."
See Hour 4, Module 2.
Both let programs on an instance work without long-term keys. They request credentials from a local metadata endpoint and get short-lived tokens or credentials that rotate automatically. Azure: system-assigned (tied to the VM's lifecycle) or user-assigned (a standalone resource that multiple VMs can share) managed identities. They obtain Entra tokens from IMDS and are authorized through RBAC. AWS: an instance profile wraps an IAM role. IMDS returns temporary STS credentials, which are authorized by IAM policies. The SDK default credential chain uses these automatically.
# Azure (inside the VM) curl -s -H Metadata:true "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" | jq -r '.expires_on' # AWS (inside the VM) aws sts get-caller-identity
Mention that Entra sign-in (#26, #27) and SSM (#35) both depend on this mechanism.
"Put access keys in /etc/environment."
See Hour 3, Module 4 and Hour 4, Module 2.
AWS: SSM Session Manager (the agent makes outbound connections, access is authorized through IAM, sessions can be recorded to S3/CloudWatch, and port forwarding is supported), Run Command, and EC2 Instance Connect Endpoint. Azure: Azure Bastion (connect to private IPs through it from a browser or native client), az ssh vm with Entra sign-in, and az vm run-command. Common principles: centralized identity, no public IPs, and complete auditing. Prerequisites: a healthy agent and outbound reachability (#31, #35).
aws ssm start-session --target i-0abc… --document-name AWS-StartPortForwardingSession --parameters portNumber=5000,localPortNumber=15000 az network bastion ssh -n bas-linux-lab -g rg-linux-lab --target-resource-id "$VMID" --auth-type AAD az vm run-command invoke -g rg-linux-lab -n vm-linux-lab --command-id RunShellScript --scripts "systemctl is-active myapp"
Cover the break-glass process: who can use it, how it is approved, and how it is audited afterward.
"Opening port 22 and restricting the source IP is enough." This lacks identity and auditing.
See Hour 4, Module 4 and Hour 3, Module 4.
Tiers and cadence: set SLAs by severity (for example, critical vulnerabilities within 7 days). Roll out in batches (dev → staging → canary → production in waves), and check health after each batch. Use platform tooling: Azure Update Manager for periodic assessment and maintenance configurations; AWS SSM Patch Manager for patch baselines and maintenance windows; locally, unattended-upgrades, which installs only security updates. Kernel updates require a reboot, so use maintenance windows, rolling restarts, or Livepatch (Ubuntu Pro) / kpatch (RHEL) to reduce reboots. Rebuilding the image and replacing instances is the preferred approach.
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs # Ubuntu
needs-restarting -r 2>/dev/null # RHEL family
aws ssm describe-instance-patch-states --instance-ids i-0abc… --query 'InstancePatchStates[0].{missing:MissingCount,failed:FailedCount}'
pro fix, Inspector, Defender for Cloud).Distinguish between a patch being "available," "installed," and "in effect" (processes that need a restart have been restarted). Check with needrestart.
"Every machine automatically runs full-upgrade every night and reboots."
See Hour 3, Module 6, Hour 4, Module 6, and Hour 5, Module 5.
Layer by how often things change and how fast boot needs to be. Things that change slowly and are identical across instances (OS patches, hardening baselines, monitoring and security agents, runtimes) go into the image. Images boot fast, are repeatable, and are testable. A few environment-specific parameters (hostname, environment identifier, secret references) are injected at boot by cloud-init. The application version either comes with the image (fully immutable) or is pulled at boot. Changes at runtime go through configuration management or a rebuild.
build {
sources = ["source.azure-arm.ubuntu2604", "source.amazon-ebs.al2023"]
provisioner "shell" { script = "scripts/harden.sh" }
provisioner "ansible" { playbook_file = "playbooks/base.yml" }
post-processor "manifest" {}
}
Mention what to clean up from the image: SSH host keys, machine-id, and cloud-init state (cloud-init clean).
"Install everything with apt install at boot, and keep the image as bare as possible." This is slow to boot and depends on the availability of external repositories.
See Hour 5, Module 3: Building Azure and AWS golden images with Packer.
Nothing is changed in place after deployment. Patches, configuration changes, and application version changes all happen by replacing the image or instance with a new one. Benefits: no drift, repeatability, rollback by switching back to the old version, and bad machines are simply replaced. Operational changes: you fix the pipeline instead of SSHing into machines. State is kept outside the instance (in databases, object storage, or separate data disks). Logs and monitoring are centralized. Health checks and automatic replacement are required (VMSS / Auto Scaling).
Describe the "pets vs. cattle" trade-off and the migration steps you actually drove.
"Immutable means no SSH access."
See Hour 5, Module 4 (image generalization, hardening, and versioning).
Start with #!/usr/bin/env bash and set -Eeuo pipefail. Quote variable expansions. Use trap to clean up temporary files and report the failing line. Use mktemp. Split code into functions with a single responsibility. Check dependencies and arguments. Make scripts idempotent. Write timestamped logs to stderr. Use flock to prevent concurrent runs. Run ShellCheck and bats in CI.
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
log() { printf '%s %s\n' "$(date -u +%FT%TZ)" "$*" >&2; }
tmp=$(mktemp -d); trap 'rc=$?; rm -rf "$tmp"; [ $rc -ne 0 ] && log "failed at line $LINENO (rc=$rc)"; exit $rc' EXIT
exec 9>/run/lock/deploy.lock; flock -n 9 || { log "another deploy running"; exit 1; }
command -v jq >/dev/null || { log "jq required"; exit 1; }
: "${APP_VERSION:?APP_VERSION is required}"
log "deploying $APP_VERSION"
set -e: commands inside if, &&, and ||, and failures inside command substitutions. It does not replace explicit error handling.Be able to name a few ShellCheck codes (SC2086 unquoted variable, SC2155 declaring and assigning in one line, SC1017 carriage return).
"Adding set -e makes it robust."
See Hour 5, Module 1 and Bash in 8 Hours.
Terraform (or Bicep/CloudFormation) declares cloud resources. Packer builds images. Ansible configures systems and applications idempotently (across many hosts, with state checks and dry-run support). Bash handles glue and small local tasks (a few dozen lines, calling CLIs). Python/Go handles tools with complex logic, API calls, error handling, and tests. Decision criteria: declarative vs. procedural, idempotence, team skills, and testability.
remote-exec for configuration management, and don't let Ansible's shell module do everything (you lose idempotence).--check --diff.Describe how you would migrate a 300-line Bash script into an Ansible role plus a small amount of Python.
"One tool solves every problem."
See Hour 5, Module 6, Ansible in 8 Hours, and Terraform in 8 Hours.
Drift: the actual state diverges from the desired state defined in code, caused by manual changes, emergency fixes, and automatic software updates. Detection: run check mode regularly (ansible-playbook --check --diff), use file integrity monitoring (AIDE, auditd rules), and use cloud compliance and policy scanning (Azure Policy Guest Configuration / Machine Configuration, AWS Config + SSM State Manager). Correction: automatically reapply the desired state, or replace instances in an immutable environment. Also trace where the drift came from and fix the process.
ansible-playbook -i inventory site.yml --check --diff --limit linuxlab | grep -E 'changed=|^---|^\+\+\+' sudo aide --check 2>/dev/null | head; sudo ausearch -k etc-changes -ts today | tail -3
Publish drift as a platform metric (for example, the share of hosts reporting changed in the weekly check-mode run).
"Blocking everyone from logging in prevents drift." Automatic software updates and platform agents also change state.
See Hour 5, Module 6 and Hour 6, Module 5.
Azure: Azure Monitor Agent with data collection rules (DCR) defines what is collected (Syslog facility/level, performance counters, text logs) and the target Log Analytics workspace. VMs must be associated with a DCR (#32), and AMA authenticates with a managed identity. AWS: the CloudWatch Agent (its configuration can be stored in SSM Parameter Store) collects metrics and logs into CloudWatch and authenticates with the instance role. Platform metrics (CPU, network, EBS) need no agent. Open-source alternatives: node_exporter + Prometheus, and Fluent Bit/Vector + Loki.
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a status az monitor data-collection rule association list --resource "$VMID" -o table
Use Policy or State Manager to automatically ensure every instance has the agent installed and the rules associated.
"Installing the agent automatically collects every log."
See Hour 3, Module 5, Hour 4, Module 5, and Prometheus & Grafana: 8 + 1 Hours.
Start by measuring the workload: small random I/O for IOPS and latency, and large sequential I/O for throughput. A cloud disk's limits are set by both the disk itself (type and size, or provisioned values) and the VM size (per-VM disk IOPS and throughput caps). The lower of the two applies. Burstable disks and instances use credits to deliver short-term high performance. When the credits run out, performance drops back to baseline. This is often the root cause of periodic slowdowns and is related to #44. For selection: for general use, choose Azure Premium SSD v2 or AWS gp3 (IOPS and throughput can be configured independently). For the lowest latency, choose Ultra Disk or io2. For temporary high-speed cache, use local temporary disks or instance store (volatile, #29).
sudo fio --name=randrw --filename=/data/fio.test --size=2G --rw=randrw --bs=4k --iodepth=32 --direct=1 --runtime=60 --time_based --group_reporting iostat -xz 1 # r_await / w_await / aqu-sz
Mention the "consumed IOPS percentage" on Azure, and VolumeQueueLength / BurstBalance on AWS.
"Bigger disks are faster." This holds for some disk types (performance scales linearly with capacity), but it is capped by VM limits.
See Hour 3, Module 3 and Hour 4, Module 3.
Cloud disk snapshots are crash-consistent by default (like a sudden power loss). For application consistency: ① the application makes a consistent backup itself (a native database backup or export, or Redis BGSAVE); ② or freeze before the snapshot: flush the database and stop writes (for example, FLUSH TABLES WITH READ LOCK) → fsfreeze -f → snapshot → fsfreeze -u; ③ multi-disk setups (LVM striping, data and logs on separate disks) need a consistent multi-disk snapshot (Azure restore points, AWS multi-volume snapshots). A backup only proves itself through restore drills.
redis-cli BGSAVE && redis-cli LASTSAVE sudo fsfreeze -f /data && aws ec2 create-snapshots --instance-specification InstanceId=i-0abc…,ExcludeBootVolume=true --description lab8; sudo fsfreeze -u /data
Describe automated recovery tests on a regular schedule (restore into an isolated environment and verify the data).
"Cloud disks have three replicas, so backups aren't needed." Replicas protect against hardware failure, not against accidental deletion or corruption.
See Hour 3, Module 3 and Hour 4, Module 3.
The company has about 100 "pet" Linux VMs on Azure and about 100 on AWS. Their configurations differ, and patching is done by hand. Give a 6-month migration plan.
The security team reports that the "URL preview" feature in myapp has an SSRF vulnerability. It runs on AWS (AL2023) and Azure (Ubuntu). Assess the impact and fix it.
HttpTokens with describe-instances). Azure IMDS requires the Metadata: true header, so assess whether the SSRF can set custom headers. Check CloudTrail and Entra sign-in logs for unusual use of instance identities.After a Patch Manager maintenance window, about 30% of Ubuntu instances failed their status checks. How do you handle it, and how do you run the postmortem?
/boot, custom initramfs configuration). Why did the canary miss it (it was not representative)? Improvements: canaries layered by instance type, automated reboot verification after patching, and automatic halting when a maintenance window exceeds a failure threshold.No verified video was found that specifically covers the IMDSv2 hop limit, golden image layering trade-offs, or multi-disk consistent snapshots. Storyboard:
Skim the questions and focus areas first, and mark the ones you are unsure about. Click a row to jump to the full answer.
Use the CIS baseline as the reference, ordered by risk. (1) Identity and access: disable password and root SSH, centralize identity (Entra sign-in / SSM), and apply minimal sudo. (2) Attack surface: install only the packages you need, disable unnecessary services and ports, and default-deny the host firewall. (3) Patching: automatic security updates and platform-managed patching. (4) Mandatory access control: keep AppArmor or SELinux in enforcing mode. (5) Filesystem and kernel: mount /tmp with nodev,nosuid,noexec, and apply sysctl network hardening. (6) Service sandboxing: systemd Protect*, NoNewPrivileges, and capabilities. (7) Observability and auditing: auditd, centralized logs, and time sync. (8) Continuous validation: baseline scanning (OpenSCAP / usg (Ubuntu Security Guide) / Defender for Cloud / Inspector).
sudo ss -ltnup; systemctl list-unit-files --state=enabled --type=service | head -30 sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin' sysctl net.ipv4.conf.all.rp_filter net.ipv4.conf.all.accept_redirects kernel.kptr_restrict systemd-analyze security --no-pager | head -15
Emphasize "baseline as code" (Ansible roles or images), plus compliance scan reports and an exception process.
"Turn off SELinux, enable the firewall, and change the SSH port."
See Hour 6, Module 1: Linux Security Model and Hardening Baseline (CIS), Hour 6, Module 8.
Both are LSM-based mandatory access control systems. SELinux (the default on the RHEL family) is label-based: processes have domains, and files and ports have types. Policy defines which operations each domain may perform on each type. It is powerful and fine-grained (including MLS/MCS, where container isolation uses MCS categories), but has a steep learning curve. AppArmor (the default on Ubuntu and SUSE) is path-based and profile-driven. It is easier to read and write, but protects less against things like hard links and renames. To handle a denial: confirm it is an LSM denial (audit log) → check the suggestions (audit2why / aa-logprof) → prefer booleans, labels, and minimal rules → verify → keep the change under version control. Never disable enforcement globally (#47, #48).
sudo ausearch -m AVC -ts recent | audit2why # SELinux sudo semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?' && sudo restorecon -Rv /srv/www sudo aa-status; sudo aa-complain /etc/apparmor.d/myapp; sudo aa-logprof # AppArmor
mv keeps the original label, while cp inherits the label of the target directory. Container volume mounts need :z/:Z relabeling.semanage permissive -a httpd_t).Describe an experience where you dealt with a “security event after SELinux was turned off” or precisely fixed a problem using audit2why.
“When you hit an SELinux problem, run setenforce 0.”
See Hour 6, Module 2.
You must set this up in advance: auditd file watch rules (-w /etc/sudoers -p wa -k sudoers) record syscall-level events, including auid (the login UID, which is still the original user after sudo), the process, and the time. Supplement with sudo command records in journald, SSH/SSM session logs, and configuration management run records. After the fact, you can only rely on file timestamps (which can be tampered with), package manager logs, and comparison with backups. Logs must be forwarded in real time and stored centrally.
echo '-w /etc/sudoers -p wa -k sudoers -w /etc/sudoers.d/ -p wa -k sudoers -w /etc/ssh/sshd_config -p wa -k sshd' | sudo tee /etc/audit/rules.d/50-lab8.rules sudo augenrules --load sudo ausearch -k sudoers -i | tail -20 # -i: resolve UIDs and similar values to names sudo aureport -f -i --summary | head
-e 2 to lock the rules until the next reboot.Mention cloud audit logs (Azure Activity Log / AWS CloudTrail). They record control-plane operations such as run-command and SSM sessions, and complement host auditing.
“Check ~/.bash_history.”
See Hour 6, Module 5: Auditing with auditd and log forensics.
Follow the incident response process, and do not reboot or delete anything first. ① Notify the team and start the incident process; ② Isolate: change the security group/NSG to allow only forensic access, remove the instance from the load balancer, and revoke its identity sessions (on AWS, revoke the role sessions; on Azure, remove the role assignments from the managed identity); ③ Preserve evidence: take disk snapshots, capture memory if needed (volatile data first), and export logs; ④ Investigate: analyze the snapshots in an isolated environment (login records, new users and keys, scheduled tasks and systemd units, suspicious processes and connections, recently modified files); ⑤ Eradicate and recover: rebuild from a trusted image rather than “cleaning up,” and rotate every credential that may have leaked; ⑥ Post-incident review and hardening.
# Read-only, low-impact initial triage (write results to an external location, not the local disk) last -Fai | head; sudo journalctl -u ssh --since -7d | grep -E 'Accepted|Failed' | tail sudo ss -tunap | grep -v -E '127.0.0.1|::1'; ps -eo pid,ppid,user,lstart,cmd --sort=lstart | tail -20 systemctl list-timers --all; ls -la /etc/cron.* /var/spool/cron/crontabs 2>/dev/null sudo find / -xdev -newer /etc/hostname -type f -perm -u+x 2>/dev/null | grep -vE '^/(proc|sys|run)' | head
Mention advance preparation: an isolated subnet and account for forensics, automated snapshot scripts, a credential rotation runbook, and drill records.
“Immediately kill the suspicious processes, delete the files, and reboot.”
See Hour 6, Module 5.
USE (Brendan Gregg): for each resource (CPU, memory, disks, network, and software resources such as file descriptors and connection queues), check Utilization, Saturation (queuing), and Errors. 60-second checklist: uptime → dmesg -T | tail → vmstat 1 → mpstat -P ALL 1 → pidstat 1 → iostat -xz 1 → free -m → sar -n DEV 1 → sar -n TCP,ETCP 1 → top.
| Resource | Utilization | Saturation | Errors |
|---|---|---|---|
| CPU | mpstat %usr+%sys | vmstat r, PSI cpu, %steal | soft lockup #45 |
| Memory | free available | si/so, PSI memory | OOM #39 |
| Disk | iostat %util | aqu-sz, await, PSI io | I/O error, #50 |
| Network | sar -n DEV | ListenOverflows #43, retransmissions | drops, conntrack #42 |
| Software resources | fd count, task count | Queue length | EMFILE #41, EAGAIN #40 |
Emphasize that dmesg comes first in the list, because OOM kills, I/O errors, and a full conntrack table all show up there.
“Just check top.” It shows only CPU and misses saturation and errors.
See Hour 7, Module 1.
First determine whether the time is spent in user mode (%usr) or kernel mode (%sys), and whether it is one thread or all threads (top -H, pidstat -t). Then sample-profile it: perf record -F 99 -g -p PID plus a flame graph (FlameGraph, or feed perf script into a visualization tool). For interpreted languages, use language-specific tools (Python py-spy, Java async-profiler, Node --perf-basic-prof). If kernel-mode time is high, look at the system call distribution (perf trace -s, syscount) and softirqs (/proc/softirqs).
top -H -p $(systemctl show -p MainPID --value myapp) sudo perf top -p <PID> sudo perf record -F 99 -g -p <PID> -- sleep 30 && sudo perf report --stdio | head -40 sudo py-spy record -o /tmp/myapp.svg --pid <PID> --duration 30
offcputime (bcc) or bpftrace.Read flame graphs correctly: width is the share of samples, not time order. Look for flat tops.
“Add more CPU cores.”
See Hour 7, Module 7: Advanced tools: strace, perf, and eBPF.
Confirm which memory is growing (anonymous RSS, page cache, shared memory, kernel slab), how fast it grows, and whether it correlates with traffic. Find the OOM evidence (the dmesg output in #39 and memory.events). Locate the source: per process with pidstat -r and /proc/PID/smaps_rollup; use language-level tools to find the objects (Python tracemalloc/memray, Java heap dumps); on the kernel side, use slabtop (for example, a spike in dentries). Mitigate: limit the blast radius with MemoryHigh/MemoryMax, recycle workers periodically (gunicorn --max-requests), and then fix the leak.
pidstat -r -p $(pgrep -d, -f gunicorn) 60 # RSS every minute sudo grep -E 'Rss|Pss|Anonymous' /proc/<PID>/smaps_rollup cat /sys/fs/cgroup/system.slice/myapp.service/memory.stat | grep -E '^(anon|file|shmem|slab) ' sudo slabtop -o | head -15
memory.current of a cgroup includes page cache. The reclaimable file portion is not a leak.Mention PSI alerts and systemd-oomd, which let you handle memory pressure in a more controlled way before the kernel OOM killer acts.
“Add swap, or restart every day on a schedule” as the final fix.
See Hour 7, Module 3.
iostat -xz 1 shows r/w IOPS, throughput, await (latency), aqu-sz (queue), and %util for each device. pidstat -d or iotop shows which process is reading and writing. PSI io shows overall pressure. High await with IOPS or throughput near the cloud disk or VM limit → platform quota (Q37). High await without high IOPS → a backend problem or exhausted burst credits. A storm of synchronous writes (fsync) from one process → the application. Many metadata operations (lots of small files) → the file system layer (#19).
iostat -xz 1 5; pidstat -d 1 5; cat /proc/pressure/io sudo biolatency-bpfcc 10 1 2>/dev/null | tail -15 # bcc: block I/O latency distribution sudo strace -f -e trace=fsync,fdatasync -c -p <PID>
VolumeQueueLength and BurstBalance.Discussing the latency distribution (histogram) is more valuable than discussing the average.
“Just switch to an SSD.”
See Hour 7, Module 4.
eBPF loads small programs into the kernel, and the verifier checks them first. They run when attached to kprobe/uprobe, tracepoints, network hooks (XDP, tc), LSM hooks, and similar points, and they exchange data with user space through maps. Uses: low-overhead observability (bcc/bpftrace tools such as execsnoop, opensnoop, tcpretrans, biolatency, runqlat), networking (Cilium, load balancing), and security detection (Falco, Tetragon). Risks: it requires privileges (CAP_BPF and similar), kernel version compatibility (mitigated by CO-RE), and overhead from badly written probes on hot paths.
sudo execsnoop-bpfcc -T | head # which processes are forking and exec-ing frequently
sudo bpftrace -e 'tracepoint:syscalls:sys_exit_openat /args.ret < 0/ { @[comm, args.ret] = count(); }' # errno statistics for failed opens
sudo tcpretrans-bpfcc | head
kernel.unprivileged_bpf_disabled).For example, use opensnoop to find the files leaked in #41, or use execsnoop to find short-lived processes that are saturating the CPU.
“eBPF is just the new iptables.”
See Hour 7, Module 7.
Locate the problem layer by layer. Network layer (timeout → check the security group/NSG, routing, and whether the instance is running). SSH service layer (connection refused → sshd is not running, or it is misconfigured). Authentication layer (Permission denied → keys, user, or permissions; #7, #33, #26). System layer (connects but hangs → resource exhaustion, #40, or a full disk, #18). Escalate through the tools in order, from those that depend least on software inside the instance to those that depend most: cloud agent channels (SSM, run-command) → serial console → boot diagnostics and console output → offline repair (ALAR, attaching the disk to a rescue instance) → rebuild from a snapshot or image.
ssh -vvv -o ConnectTimeout=5 labadmin@10.0.0.4 2>&1 | grep -E 'Connecting|Connection|Authenticat|debug1: Server' az network watcher test-ip-flow --vm vm-linux-lab -g rg-linux-lab --direction Inbound --protocol TCP --local 10.0.0.4:22 --remote 203.0.113.10:50000 aws ec2 get-console-output --instance-id i-0abc… --latest --output text | tail -30 az vm run-command invoke -g rg-linux-lab -n vm-linux-lab --command-id RunShellScript --scripts "systemctl status ssh --no-pager | head; df -h /; free -m"
Proactively mention preparation: boot diagnostics, the serial console, the account-level EC2 serial console setting, a break-glass account, and an approval process.
Trying “a reboot” as the first step may turn emergency mode (#21) into a complete failure to boot, and it destroys the evidence on the machine.
See Hour 3, Module 7 and Hour 4, Module 7.
Start by clarifying the constraints: compliance, team size, SLA, budget, and the number of OS types. Four main threads. ① Images: a dual-cloud Packer pipeline (Ubuntu 26.04, AL2023/Rocky 10), rebuilt weekly, scanned, signed, and versioned. ② Access: no public SSH; Entra sign-in with Bastion, and SSM Session Manager; group-based authorization and session auditing. ③ Patching and configuration: Azure Update Manager and SSM Patch Manager, rolled out in batches by environment; Ansible (AWX/AAP) manages runtime configuration and detects drift. ④ Observability: AMA + DCR or the CloudWatch Agent, or a unified OpenTelemetry/Prometheus stack, with centralized logs and SLO-based alerts. Deliver everything as IaC, with Azure Policy and AWS Config for continuous compliance.
Give a side-by-side comparison of the two clouds' capabilities, and point out that Arc and SSM hybrid nodes can bring on-premises servers under management.
Listing only tool names, without discussing the process, metrics, and failure handling.
See Hour 5, Module 8 and Hour 6, Module 8: Comprehensive hardening architecture review.
Stop the bleeding first, then find the root cause. Confirm the scope of impact (how many machines, which users), and notify people if necessary. If there are multiple instances, first pull the failing instance out of the load balancer, or scale out and replace it. On the failing machine, free space: find the directories that are growing fastest and files that were deleted but are still held open (#18). Truncate logs that are still being written to rather than deleting them, and check inodes (#19). After recovery, verify the health checks and error rate. Then find the root cause: why the logs grew so fast (DEBUG left on? an error loop?), why the alert did not fire earlier (it only alerts at 100%, with no growth-rate alert), and follow through on the improvements in the post-incident review.
df -h; df -i sudo du -xh --max-depth=2 /var 2>/dev/null | sort -h | tail -8 sudo lsof -nP +L1 | sort -k7 -n | tail -5 journalctl --disk-usage; sudo journalctl --vacuum-size=500M sudo truncate -s0 /var/log/myapp/debug.log; sudo systemctl restart myapp; curl -fsS localhost:5000/healthz
Talk about communication: the incident channel, status page updates, and handoff records, and a “blameless post-incident review.”
“rm -rf /var/log/*”.
See Module 2 of this hour (#17–#19) and Hour 7, Module 8: Comprehensive fault blind box.
After the new myapp release, p99 latency rose from 80 ms to 600 ms, and CPU went from 30% to 45%, with no errors. How do you reach a conclusion within 30 minutes?
perf/py-spy), off-CPU time (waiting on locks or I/O), the number of dependency calls (N+1 queries against Redis?), and ListenOverflows (#43).The audit requires a list of everyone who could obtain root on each server over the past 90 days, along with records of actual use. Design the data sources and the report.
auid privilege escalation events, and cloud control-plane audit logs (run-command entries in the Activity Log or CloudTrail).Last quarter there were four disk-related incidents (logs, inodes, temporary disks, and capacity expansion). Propose a systematic improvement plan.
lvextend -r as the standard procedure (#22).No verified video specifically covering cloud intrusion response or platform design at the scale of a thousand machines was found. Third-party interview videos vary in quality, so rely on this hour and the official documentation.
Type keywords to filter (such as denied, systemctl, No space, nvme, or oom). Click a number to jump to the matching module.
Read the question and recall your answer first, then expand the card to compare it with the one-line key point. For details, see the “interview question details” in the matching module.
namei -l /path/to/file; sudo -u myapp test -r FILE findmnt -T FILE -no OPTIONS; lsattr FILE; getfacl FILE id USER; sudo -l -U USER; sudo visudo -c sudo fuser -v /var/lib/dpkg/lock-frontend; dpkg --audit apt-cache policy PKG; dnf repolist -v
systemctl status myapp; systemctl show myapp -p Result -p ExecMainStatus -p NRestarts journalctl -u myapp -b -n 50 --no-pager; journalctl -k -b -p warning systemctl cat myapp; systemctl edit myapp; systemd-analyze verify myapp.service sudo systemctl reset-failed myapp; systemd-analyze security myapp journalctl --disk-usage; systemd-cgtop
df -hT; df -i; sudo lsof -nP +L1 lsblk -f; sudo blkid; sudo pvs; sudo vgs; sudo lvs sudo lvextend -r -L +5G VG/LV; sudo growpart DISK N; sudo xfs_growfs /MNT sudo findmnt --verify; sudo mount -a iostat -xz 1; cat /proc/pressure/io
ss -ltnp; ss -s; ip -br a; ip route get IP resolvectl status; resolvectl query NAME; getent ahosts NAME sudo nft list ruleset; sudo ufw status verbose sudo tcpdump -ni any 'tcp port 5000' -c 20 nstat -az | grep -E 'ListenOverflows|Retrans'; sudo conntrack -S
az vm boot-diagnostics get-boot-log -g RG -n VM az serial-console connect -g RG -n VM az vm run-command invoke -g RG -n VM --command-id RunShellScript --scripts "…" az vm repair repair-button --button-command fstab -g RG -n VM aws ec2 get-console-output --instance-id ID --latest --output text aws ssm describe-instance-information; aws ssm start-session --target ID TOKEN=$(curl -sX PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 60')
uptime; dmesg -T | tail; vmstat 1; mpstat -P ALL 1; pidstat 1; free -m cat /sys/fs/cgroup/system.slice/myapp.service/memory.events grep 'open files' /proc/PID/limits; systemctl show myapp -p TasksCurrent -p TasksMax sudo perf top; sudo py-spy dump --pid PID sudo ausearch -m AVC -ts recent | audit2why; sudo aa-status chronyc tracking; timedatectl
Each scenario combines several questions from Part A. Write down the first diagnostic command and your judgment before expanding the answer.
deploy.sh: /bin/bash^M: bad interpreter: No such file or directory (after fixing the line endings) Job for myapp.service failed because the control process exited with error code. myapp.service: Main process exited, code=exited, status=203/EXEC ls /opt/myapp/venv/bin/ → empty directory (the deploy script ran rm -rf on venv first)
Answer: the script was edited on Windows, so it has CRLF line endings (#2) → pin LF with .gitattributes. The script deleted the old venv first and then failed midway, so the gunicorn that ExecStart points to does not exist (#13) → rebuild the venv. Improvements: atomic release (a new directory plus switching a symlink), set -Eeuo pipefail and ShellCheck (Q33), and automatic rollback when the post-deploy health check fails.
df -h / → 100%; still 100% after sudo rm /var/log/myapp/debug.log lsof +L1 → myapp 7w … /var/log/myapp/debug.log (deleted) myapp.service: Start request repeated too quickly.
Answer: the deleted log is still held open by the process (#18) → truncate /proc/PID/fd/N or restart the process. While the disk was full, the service kept crashing and hit the start rate limit (#14) → run reset-failed, then start it. Root fix: send logs to journald with a size cap (#17), alert on growth rate, and never leave DEBUG on permanently.
Boot diagnostics: [DEPEND] Dependency failed for /data. … emergency mode /etc/fstab: /dev/sdc1 /data xfs defaults 0 2 /mnt/redis-backup does not exist; /mnt/DATALOSS_WARNING_README.txt
Answer: the device name changed during maintenance and there is no nofail (#28/#21) → repair it from the serial console or with ALAR, and switch to UUID=…,nofail. The backup was on the temporary disk and was lost during maintenance or redeployment (#29) → move it to a managed data disk or Blob. Review: on Azure, do not use /dev/sdX or /mnt to store persistent data.
An error occurred (TargetNotConnected) when calling the StartSession operation: i-0abc… isn't connected. ubuntu@10.20.1.15: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Container: Unable to locate credentials; MetadataOptions.HttpPutResponseHopLimit = 1
Answer: the instance profile or the ssm/ssmmessages endpoints are missing (#35) → add them. The AL2023 username should be ec2-user (#33). The launch template set the hop limit to 1, so containers cannot obtain the IMDSv2 token (#34) → set it back to 2, or give the container its own workload identity.
az ssh vm … → Connection closed by 10.0.0.4 port 22
rhellab: connect() to 127.0.0.1:5000 failed (13: Permission denied) while connecting to upstream
avc: denied { name_connect } … scontext=system_u:system_r:httpd_t:s0 …
Answer: the new colleague is a Contributor but does not have the “Virtual Machine User/Administrator Login” role (#26) → assign it by group. SELinux does not allow httpd_t to connect to port 5000 (#47) → use setsebool -P httpd_can_network_connect 1 or adjust the port label, rather than turning SELinux off.
kernel: nf_conntrack: nf_conntrack: table full, dropping packet kernel: TCP: request_sock_TCP: Possible SYN flooding on port 0.0.0.0:5000. Sending cookies. kernel: Memory cgroup out of memory: Killed process 2210 (gunicorn) … myapp.service: Failed with result 'oom-kill'.
Answer: a storm of short-lived connections fills conntrack (#42) → increase the table size and have upstream services reuse connections. Workers cannot keep up, so the accept queue overflows (#43) → improve processing capacity and the backlog. After adding workers, memory exceeds MemoryMax (#39) → plan memory by peak RSS, or scale out horizontally. Conclusion: capacity planning must cover connections, queues, and memory together.
VM-A: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) VM-B: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. VM-C: Release file … is not valid yet (invalid for another 3h 12min 5s).
Answer: A: initramfs generation failed because /boot is full (#38) → pick the old kernel from the serial console, clean up /boot, and rebuild the initramfs. B: the upgrade was interrupted (#10) → dpkg --configure -a. C: after restoring from a snapshot, the clock is behind and chrony has not synchronized (#49) → chronyc makestep, and allow NTP/NTS traffic. Improvements: check /boot and disk space before patching, and use batches with verified automatic reboots (scenario question 7-3).
load average: 40.12 …; vmstat b=38 wa=55 kernel: INFO: task jbd2/sda1-8:245 blocked for more than 122 seconds. kernel: EXT4-fs (sda1): Remounting filesystem read-only
Answer: tasks piling up in D state inflate the load average (#46). The root cause is storage: severe latency or failure on the cloud disk (#44), after which ext4 detected errors and switched to read-only (#50). Response: preserve a snapshot → run e2fsck in a rescue environment → check the platform disk health and quotas. In immutable environments, replace the instance and disk directly.
Two-minute countdown per question. Answer out loud first (you can write key points in the text box), then expand the reference answer and self-rate as “answered / partial / didn't know.” At the end, the round's score and the cumulative mastery rate for each module are shown. Self-ratings are stored in this browser.
./deploy.sh from pressing Enter to the exit code. Mark the step where #1, #2, #4, #13, #19, and #40 each occur, and the errno or exit code that goes with each.| Item | Facts used in this hour | Sources (accessed 2026-11-17) |
|---|---|---|
| Ubuntu 26.04 LTS | Resolute Raccoon, released 2026-04-23. Standard support runs five years to 2031-04, with Ubuntu Pro ESM for 10 years in total. Upgrading from 24.04: GA kernel 6.8→7.0 (HWE 6.17→7.0); systemd 255→259 (cgroup v1 removed; the last version that supports SysV service scripts); APT 2.7→3.1 (apt-key removed); sudo-rs is the default sudo (the original is renamed sudo.ws, and sudo-ldap is removed); core tools come from rust-coreutils (GNU versions are available with a gnu prefix, while cp/mv/rm are still GNU); new installs default to chrony (NTS); the default initramfs is Dracut; OpenSSH 10.2 (no longer generates DSA host keys); Netplan 1.2; Python 3.14. | Ubuntu Releases · 26.04 release notes · Summary for LTS users |
| RHEL-family comparison | Rocky Linux 10.2 and AlmaLinux 10.2 have been released (compatible with RHEL 10.2, mid-2026). The 10.x series is based on the 6.12 LTS kernel. | Rocky Linux 10.2 · AlmaLinux blog |
| Linux kernel (upstream) | mainline 7.4-rc3; stable 7.3.4 (2026-11-10); longterm 6.18.63, 6.12.117, 6.6.162, 6.1.192, 5.15.225, 5.10.274 | kernel.org releases.json |
| systemd (upstream) | Latest v262.2 (2026-11-05); Ubuntu 26.04 ships 259 | systemd releases |
| Multipass | v1.17.1 (2026-11-13). Launches the current LTS when no image is specified; snapshot/restore require the instance to be stopped first. | Multipass releases |
| Amazon Linux 2023 | Latest version 2023.12.20261112. Instances launched from the AL2023 AMI require IMDSv2 by default, with a hop limit of 2 (the AMI's imds-support=v2.0). Token lifetime is 1 second to 6 hours. SSM Agent is preinstalled (AL2023, Ubuntu Server, and others). | AL2023 release notes · AL2023 IMDSv2 · AMIs with SSM Agent preinstalled |
| AWS Session Manager | TargetNotConnected message and causes (configuration, cross-account/region, the ssm/ssmmessages endpoints, and before agent 3.3.40.0 also ec2messages, VPC BPA, resource pressure, agent not running, and a missing instance profile); agent log lines | Troubleshooting Session Manager |
| Azure Entra sign-in | Extension Microsoft.Azure.ActiveDirectory/AADSSHLoginForLinux. Requires a system-assigned managed identity. Roles: Virtual Machine Administrator Login / User Login; Owner and Contributor do not grant these automatically. Exit codes 22 (no managed identity) / 23 (old extension). “Connection closed by <ip> port 22”. Supports Ubuntu 16.04–26.04 and Rocky/Alma 10. VM needs at least 1 GB of memory. | Sign in to a Linux VM with Entra ID |
| Azure fstab and temporary disk | Example emergency-mode serial log, UUID + nofail, the serial console, az vm repair repair-button --button-command 'fstab' (ALAR). The temporary disk may lose data during maintenance, redeployment, or stop; on Linux it is usually /dev/disk/azure/resource. | fstab boot issues · Managed disks overview |
| Error / message | Location (default branches upstream, 2026-11-17) |
|---|---|
| Job for %s failed because %s. See "%s status %s" and "%s -xeu %s" for details. · Explanatory text: the control process exited with error code / start of the service was attempted too often / of an out-of-memory (OOM) situation | systemd: src/shared/bus-wait-for-jobs.c |
| Start request repeated too quickly. · Failed with result '%s'. | systemd: src/core/unit.c |
| The kernel OOM killer killed some processes in this unit. · Scheduled restart job, restart counter is at %u. | systemd: src/core/cgroup.c, src/core/service.c |
| Warning: The unit file, source configuration file or drop-ins of %s changed on disk. Run 'systemctl%s daemon-reload' to reload units. | systemd: src/systemctl/systemctl-util.c |
| Exit code names EXEC (203), CHDIR (200), USER (217), NAMESPACE (226) | systemd: src/shared/exit-status.c; numbering in systemd.exec(5) |
| You are in %s mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, or "exit" to continue bootup. | systemd: src/sulogin-shell/sulogin-shell.c |
| %s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%d · Memory cgroup out of memory | linux: mm/oom_kill.c |
| INFO: task %s:%d blocked%s for more than %ld seconds. (%s is empty, or “ in I/O wait”) | linux: kernel/hung_task.c |
| BUG: soft lockup - CPU#%d stuck for %us! [%s:%d] | linux: kernel/watchdog.c |
| nf_conntrack: table full, dropping packet | linux: net/netfilter/nf_conntrack_core.c |
| %s: Possible SYN flooding on port %pI4:%u. %s. (Sending cookies / Dropping request) | linux: net/ipv4/tcp_input.c |
| VFS: Unable to mount root fs on %s · VFS: file-max limit %lu reached · Remounting filesystem read-only | linux: init/do_mounts.c, fs/file_table.c, fs/ext4/super.c |
| Authentication refused: %s · bad ownership or modes for directory %s · WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! | openssh-portable: auth2-pubkeyfile.c, misc.c, sshconnect.c |
| Could not get lock %s. It is held by process %d (%s) · Unable to acquire the dpkg frontend lock (%s), … · dpkg was interrupted, you must manually run '%s' to correct the problem. · The following signatures couldn't be verified because the public key is not available: · Release file for %s is not valid yet (invalid for another %s). | apt: apt-pkg/contrib/fileutl.cc, apt-pkg/deb/debsystem.cc, methods/gpgv.cc, apt-pkg/acquire-item.cc |
| wrong fs type, bad option, bad superblock on %s, missing codepage or helper program, or other error | util-linux: libmount/src/context_mount.c |
| %s is not in the sudoers file. (sudo.ws) · I'm sorry {user}. I'm afraid I can't do that (sudo-rs) | sudo: plugins/sudoers/logging.c; sudo-rs: src/common/error.rs, src/sudo/pipeline.rs |
| Connection in use: %s · Retrying in 1 second. · Can't connect to %s | gunicorn: gunicorn/sock.py |
| errno text: Permission denied, Operation not permitted, No space left on device, Argument list too long, Too many open files, Resource temporarily unavailable, Read-only file system, Temporary failure in name resolution | errno(3), getaddrinfo(3) (glibc strerror / gai_strerror) |
All videos were checked on 2026-11-17 through the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json) for titles and channels. oEmbed does not return duration or publication date, so those are not listed. Verified: Learn Linux TV, “Linux Crash Course - Understanding File & Directory Permissions” (4e669hSjaX8), “journalctl Basics: How to Easily Check Your Linux Logs” (0dG3vUYt7Uk), “Getting Started with cloud-init” (exeuvgPxd-E), “Linux Load Average: Simple Explanation for Beginners” (7Tx0DsHEuTM); Akamai Developers, “How to use chmod | Manage File Permissions in Linux” (ngJG6Ix5FR4), “Linux for Programmers #6 | Networking Commands” (vDWY3PuHMX8); SERVER LAB, “Fix Could Not Get Lock on Ubuntu 24.04: apt and dpkg” (eag5YHHE9F8); GEEKrar Guides, “FIXED: User is not in the sudoers file. This incident will be reported” (ZxOwFOtcaaA); Bo Morgan Tech, “fixing broken systemd services” (XPpj3VWNwnk), “Learn journalctl in 7 Minutes — Become the Linux Troubleshooting Hero” (iD0xmhJAjwk); Incidentverse Tech, “Linux Inode Exhaustion 🚨 | No Space Left on Device Even With Free Disk Space | SRE Incident” (xjqL8fOBgfY); Mike's Tech Tips, “How to get your Linux system out of emergency mode” (-2wca_0CpXY); DevOps Made Simple, “Linux Networking Troubleshooting Simply Explained (ip, ss, ufw)” (rupdY714Jaw); Microsoft Developer, “Troubleshoot and diagnose Azure Virtual Machines with Serial Console | Azure Friday” (KxKZW3VAcU4); Microsoft Azure, “How to use GRUB and the Azure Serial Console on a Linux Virtual Machine | Azure Tips and Tricks” (SnqwTqlvYkc); Amazon Web Services, “Why can't I connect to my Amazon EC2 Linux instance using SSH?” (ey4JtaoObqE), “How do I troubleshoot issues with AWS Systems Manager Session Manager?” (g7dp2rWj-3g); AiceBreakers, “Understanding cloud-init - Azure Virtual Machines” (YdlhpZonbrM); Dennis Traub, “How to connect to an EC2 instance without a key pair / Access EC2 with the AWS SSM Session Manager” (f5daHmVGyC8); Brendan Gregg, “Linux Performance Analysis in 60 seconds” (ZdVpKx6Wmc8), “Linux Performance Tools, Brendan Gregg, part 1 of 2” (FJW8nGV4jxY), “part 2 of 2” (zrr2nUln9Kk), “SCALE14x Broken Linux Performance Tools (2016)” (OPio8V-z03c); Nir Lichtman, “What Happens When Linux Runs Out of Memory?” (Cm3-6cOwICU); Red Hat, “Solve SELinux errors: Troubleshooting basics” (Rm1BeVChABE); ByteByteGo, “How Does Linux Boot Process Work?” (XpFsMB6FoOs); Joe Collins (EzeeLinux), “How Linux Boots” (EjrAzulPsT4); The Linux Foundation, “Tutorial: Debugging with Strace - A Peek Behind the Scenes of Linux Processes - Avikam Rozenfeld” (SUO0rQerpMk); tutoriaLinux, “Popular Linux Interview Questions for DevOps Interviews” (GdrjTVDelI0), “Top 10 Linux Job Interview Questions” (l0QGLMwR-lY); grobelDev, “Linux Performance Troubleshooting Demos” (rwVLa9me7e4); Mark Alexander, “The Most Useful Tool You Have Never Heard Of (STRACE)” (quQmdgIUCaU); LaurieWired, “Using Strace to Trace Linux Syscalls” (mBfurelWwPQ); Intellipaat, “20 Most Asked Linux Interview Questions 2026 …” (MxfLlmSofNc); onlineexamprep, “Top 50 Senior Linux Engineer Interview Questions & Answers …” (3E_AOdmxlUc). Not found: verified videos that specifically cover the CRLF interpreter error and chattr, the APT 3 key migration, deleted files that are still held open and LVM tiered expansion, Entra login roles and AMA/DCR association, the IMDSv2 hop limit, conntrack and accept queue overflow with ext4 read-only, trade-offs in golden image layering, or cloud intrusion response. The related pages provide storyboard scripts instead. Third-party videos, especially interview-style ones, vary in quality and may be based on older versions; use them for reference only.
The “Voice” tab uses the browser's built-in Web Speech API (en-US English voice). No data is uploaded, and the courseware has no embedded audio. An English voice pack must be installed on the system; otherwise, read the script directly or use another TTS tool.
TCP: / watchdog: / nf_conntrack: prefixes before kernel messages, the mount: /data: prefix, and the sudo: prefix for sudo and sudo-rs.fork: retry text in bash, the error wording for /usr/bin/env under rust-coreutils, the text after the parentheses in curl errors, the dnf repository metadata error format, the status --long fields of cloud-init, the Azure VM agent status message and the full AADSSHLoginForLinux status text, the list of SSH authentication methods for EC2, the IMDS 401 response body, growpart output, the field order in SELinux AVC and AppArmor audit records, the NFS “not responding” kernel message, and the “Main process exited, code=…” and “Failed at step EXEC spawning …” lines in systemd.ResourceDisk.EnableSwap; the chrony configuration syntax for the Azure PTP clock source and AWS Time Sync; the query rate limit for AWS Route 53 Resolver; or Kubernetes' support status for swap. The ext4 default of 5% reserved blocks and the journald SystemMaxUse default (10%, capped at 4G) come from the general description in the man pages. The systemd DefaultLimitNOFILE default of 1024:524288 and DefaultStartLimitIntervalSec=10s / Burst=5 come from the general description in the systemd documentation.update-initramfs), and APT (2.7, which still has apt-key but deprecates it) differ from the 26.04 descriptions in this hour. These differences are noted in the relevant questions. WSL2 is not suitable for storage and kernel-level labs.dm_delay for dm-delay. It is usually provided by the generic Ubuntu kernel; verify on your system.