Back to lessons

Cybersecurity Triage

Find Warnings in Apt Terminal Logs

A patch run completed and you need to spot warnings, errors, failed maintainer scripts, or restart clues.

Command

grep -Ei 'warning|error|failed|dpkg' /var/log/apt/term.log

What changed

Nothing changes. grep filters the terminal log for warning and failure terms.

Danger

safe

When to use it

Use after unattended-upgrades, manual patching, or package repair to catch non-fatal but important output.

When not to use it

Do not treat a quiet grep as a complete health check; also verify services and package state.

Undo or recovery

No undo needed because the command is read-only.

Expected output

Matching warning, error, failed, or dpkg-related lines from apt terminal logs.

demo script

Disposable terminal steps

  1. cat /var/log/apt/term.log
  2. grep -Ei 'warning|error|failed|dpkg' /var/log/apt/term.log

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ cat /var/log/apt/term.log
Log started: 2026-06-25  02:10:01
Preparing to unpack .../openssl_3.0.13-0ubuntu3.6_amd64.deb ...
Unpacking openssl (3.0.13-0ubuntu3.6) over (3.0.13-0ubuntu3.5) ...
Setting up openssl (3.0.13-0ubuntu3.6) ...
Warning: service nginx needs restart after library update
Processing triggers for man-db (2.12.0-4build2) ...
Log ended: 2026-06-25  02:10:18
::exit-code::0
$ grep -Ei 'warning|error|failed|dpkg' /var/log/apt/term.log
Warning: service nginx needs restart after library update
::exit-code::0

YouTube Short

Read apt warnings.

A package run can finish and still leave useful warnings. Search the apt terminal log before closing the patch ticket.

LinkedIn hook

The package installed, but the terminal log may still contain the warning that matters.

Question: Do your patch checks include apt term.log warnings?

experiments

A/B tests to run

Metric: completion_rate

A: The warning is in term.log.

B: Do not close patch work without logs.