Skip to content

Quiz: Package Management

← Back to quiz index

4 questions

L0 (1 questions)

1. What is the difference between dpkg/rpm and apt/dnf?

Show answer dpkg and rpm are low-level tools that operate on individual package files without resolving dependencies. apt (Debian) and dnf (RHEL) are high-level tools that resolve dependencies, fetch from repositories, and handle upgrades automatically. Use apt/dnf for 99% of operations; use dpkg/rpm for inspection, forensics, and emergencies.

L1 (1 questions)

1. How do you prevent a critical package from being accidentally upgraded in production?

Show answer Debian/Ubuntu: 'apt-mark hold nginx' prevents upgrades (check with 'apt-mark showhold'). RHEL: use the versionlock plugin: 'dnf versionlock add nginx-1.24.0-1.el9'. Alternatively, use excludepkgs=nginx* in /etc/dnf/dnf.conf. Warning: a held package can block apt upgrade if other packages depend on a newer version.

L2 (1 questions)

1. A dpkg install left a package in a half-configured broken state. What is the triage sequence to fix it?

Show answer 1. dpkg --audit — identify what is broken.
2. apt --fix-broken install — let apt resolve dependencies.
3. dpkg --configure -a — finish any pending configurations.
4. If still broken: dpkg --remove --force-remove-reinstreq then reinstall cleanly.
5. Check /var/log/dpkg.log and /var/log/apt/history.log for the timeline of what happened.

L3 (1 questions)

1. Why is dnf history undo a strong advantage over Debian for production rollbacks, and what is the Debian workaround?

Show answer dnf tracks every transaction with an ID. 'dnf history undo 127' reverts all changes from transaction 127 (downgrades, removes additions). Debian has no native transaction rollback. Workarounds: track changes externally with Ansible, use etckeeper for /etc changes, parse /var/log/apt/history.log to manually identify and downgrade packages. This is why RHEL-family distributions are often preferred for production.