Back to lessons

Cybersecurity Triage

Risk: safe

Check Whether Patches Require Reboot

After package updates, you need to know whether the system is signaling a required reboot and which packages triggered it.

Command

test -f /var/run/reboot-required && printf 'reboot-required\n' && cat /var/run/reboot-required.pkgs

Before you run this

Risk: safe. Do not reboot immediately from this output alone; coordinate service impact and maintenance policy.

Expected output

A reboot-required marker plus package names that requested a reboot.

System impact

Nothing changes. The command checks marker files and prints packages associated with the reboot requirement.

Recovery / rollback: no state is changed.

When to use it

Use after kernel, libc, OpenSSL, or unattended security updates to plan reboot timing.

When not to use it

Do not reboot immediately from this output alone; coordinate service impact and maintenance policy.

Watch this command run

Example output from a temporary Linux lab

This example uses disposable sample files and sanitized output so you can inspect the shape of the result before touching a real system.

demo@lab:~$

$ cat /var/run/reboot-required.pkgs

linux-image-6.8.0-63-generic
libc6

$ test -f /var/run/reboot-required && printf 'reboot-required\n' && cat /var/run/reboot-required.pkgs

reboot-required
linux-image-6.8.0-63-generic
libc6
View reproducible demo details

This page shows the sanitized shell transcript and the setup steps needed to reproduce the example.

Lab setup steps

  1. cat /var/run/reboot-required.pkgs
  2. test -f /var/run/reboot-required && printf 'reboot-required\n' && cat /var/run/reboot-required.pkgs

next steps

Related commands

Cybersecurity Triage Risk: safe

Build a Recent Apt Patch Timeline

Apt history turns patch claims into timestamps and package names.

awk '/^(Start-Date|Commandline|Upgrade|End-Date)/ {print}' /var/log/apt/history.log
Cybersecurity Triage Risk: safe

Find SSH Keys for nologin Users

A nologin shell does not automatically mean SSH keys are irrelevant.

comm -12 <(awk -F: '$7 !~ /(bash|sh|zsh)$/ {print $1}' fixtures/user-access-audit/etc/passwd | sort) <(find fixtures/user-access-audit/home -path '*/.ssh/authorized_keys' -printf '%h\n' | awk -F/ '{print $(NF-1)}' | sort)
Cybersecurity Triage Risk: safe

Preview Security Impact of dist-upgrade

Kernel and dependency security fixes may only appear in the broader upgrade plan.

apt-get -s dist-upgrade | awk '/^Inst/ {print}'
Cybersecurity Triage Risk: safe

Find Held Packages Blocking Patches

A held package can quietly keep a security update out of production.

apt-mark showhold | sed 's/^/held: /'
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:110-security
  • lfcs:security-hygiene
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.