Loading...

Lab 73: Advanced Package Management

Perform package-level triage by verifying installed files, enumerating package contents, and using controlled reinstall and overwrite workflows across RPM, dpkg, and pacman-based systems. Use these checks to separate on-disk drift from metadata or dependency issues before escalation.

packages troubleshooting core

Scenario

A production host is behaving inconsistently and you suspect package corruption or drift. Your task is to verify package integrity, inspect installed file lists, perform a controlled overwrite install of an RPM, and validate package consistency on an Arch-based system.

Operator context

Package verification is an evidence-gathering step. If you see modified checksums or missing files, you can justify a reinstall or rollback instead of treating symptoms at the application layer.

Objective

  • Verify an RPM package’s installed file integrity using rpm -V.
  • List installed files for a Debian package using dpkg -L.
  • Perform a forced RPM install for a known test package.
  • Identify missing files in installed packages on Arch using pacman -Qk.
  • Reinstall a package on Arch to restore a known-good state.

Concepts

  • Verification versus inventory: prove file integrity (rpm -V) and enumerate ownership (dpkg -L).
  • Drift signals: checksum changes, permission changes, and missing files usually point to manual edits or filesystem events.
  • Overwrite installs are disruptive: forcing an install can replace files unexpectedly and should be treated as a controlled operation.
  • Cross-distro differences matter: the same symptom looks different across rpm/dpkg/pacman ecosystems.
  • Evidence first: capture verification output before reinstalling so you can explain what changed and why.

Walkthrough

Step 1 : Verify an RPM package’s integrity (example: bash).
Command
rpm -V bash

rpm -V compares installed files against the RPM database (size, permissions, checksum, timestamps, etc.). Any output is a drift signal and should be reviewed before you reinstall or overwrite files.

S.5....T.  c /etc/bashrc
Step 2 : List installed files for a Debian package (example: bash).
Command
dpkg -L bash

This enumerates the files owned by the package. Use it to confirm expected paths, verify binaries exist, and understand scope before a reinstall or removal.

/.
/bin
/bin/bash
/usr/share/doc/bash
Step 3 : Force install an RPM (example: test.rpm).
Safety note

Forced installs can overwrite files and destabilize running services. Do this only for known test packages or when you understand exactly what will be replaced.

Command
rpm -ivh --force test.rpm

This forces the install even if conflicts exist. In operations, pair this with prior evidence and a rollback plan.

Preparing...                          ################################# [100%]
Updating / installing...
   1:test.rpm                        ################################# [100%]
Step 4 : Check for missing package files on Arch.
Command
pacman -Qk

This verifies that files tracked by installed packages exist on disk. Missing file counts are common when files were deleted manually or a filesystem event truncated content.

bash: 0 missing files
coreutils: 0 missing files
Step 5 : Reinstall a package on Arch (example: bash).
Command
sudo pacman -S bash --noconfirm

A reinstall is a fast remediation path when you have confirmed drift and want to restore known-good package contents from the repository.

:: Retrieving packages...
:: bash-5.2.15-1-x86_64 downloaded
:: Installing bash...

Common breakpoints

rpm -V outputs changes for config files

Config drift is common and not automatically “corruption.” Check whether the file is marked with c in the verify output, and validate changes against expected config management or documented overrides.

rpm -V shows missing files

Missing files are a stronger signal. Capture the output, then plan a reinstall or restore from backup. Investigate why the files disappeared (manual deletes, cleanup jobs, disk issues).

rpm --force overwrites critical binaries

Do not force install over core packages without a rollback plan. Use controlled maintenance windows, confirm the package origin, and prefer a managed reinstall path when possible.

pacman -Qk reports missing files across many packages

If many packages report missing files, treat it as a broader filesystem or cleanup event. Verify disk health and recent maintenance actions before attempting mass reinstalls.

Cleanup checklist

This lab is read-only unless you perform the forced RPM install or a reinstall. Remove the test RPM package if it was used and keep the verification output as evidence for your ticket or incident notes.

Commands
# If you installed a test RPM, remove it:
sudo rpm -e test

# Re-run verification after remediation:
rpm -V bash
pacman -Qk
Success signal

Verification output aligns with expectations (only intended config drift), and missing-file reports are cleared after reinstalling or restoring content.

Reference

  • rpm -V <pkg> : Verifies installed package files against the RPM database.
    • Output lines indicate drift (checksum, mode, size, timestamps, etc.).
    • c marks configuration files, which are often intentionally modified.
  • dpkg -L <pkg> : Lists files owned by a Debian package.
  • rpm -ivh --force <file.rpm> : Installs an RPM while forcing overwrite behavior (use with care).
    • -i : Install.
    • -v : Verbose output.
    • -h : Print hash marks to show progress.
    • --force : Overwrite files and ignore some conflicts.
  • pacman -Qk : Checks the presence of files owned by installed packages.
    • Reports missing files per package, which can indicate deletes or disk issues.
  • pacman -S <pkg> : Installs or reinstalls a package from configured repositories.
    • --noconfirm : Proceed without prompts (common in automation).
  • rpm -e <pkg> : Removes an installed RPM package.