Back to problems

problem hub

Preview first

APT or dpkg repair needed

Inspect package state, held packages, candidates, and simulated changes before running repair commands.

Safest first command

apt-get -s upgrade

Before you run this

Expected output: A simulated package transaction showing packages that would be upgraded, kept back, installed, removed, or configured.

When not to use it: Do not run fix-broken, dist-upgrade, configure, purge, or remove commands until the simulated action makes sense.

Expected output example

Inst openssl [3.0.2-0ubuntu1] (3.0.2-0ubuntu1.18 Ubuntu:22.04/jammy-updates)
Conf openssl (3.0.2-0ubuntu1.18 Ubuntu:22.04/jammy-updates)

How to read the result

Simulation output shows what APT would do without changing packages. Look for removals, held packages, broken states, or unexpected repositories before running a real repair.

Preview package changes

APT and dpkg repairs can remove packages or restart services. Use simulation and package-state inspection first.

  1. apt-get -s upgrade
  2. dpkg -l | awk '$1 !~ /^ii/ {print}'
  3. apt-mark showhold

Check package origin

Repository, pinning, architecture, and signing issues often show up as unexpected package candidates.

Common causes

  • Interrupted dpkg configure step
  • APT lock held by another package process
  • Held packages
  • Unsigned or stale repository
  • Mixed distro releases or third-party repos

What not to change yet

  • Do not remove packages because a forum command says so.
  • Do not run dist-upgrade on production before reading the simulation.
  • Do not delete lock files until you know no package manager is running.

platform notes

Distro and service notes

Debian/Ubuntu

Use apt-get -s and dpkg status checks before repair commands.

Services

Package upgrades can restart services; schedule maintenance when needed.

Rollback

Know how the package was installed before purging or downgrading.

supporting commands

Command path