Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

dpkg was interrupted, you must manually run 'sudo dpkg --configure -a': what it checks and how to clear it

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

The full message is E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. In apt-pkg/deb/debsystem.cc (tag 2.6.1), debSystem::Lock() prints it when CheckUpdates() finds a file with an all-digit name in the updates/ directory beside dpkg's status file. This is a reading of the code. Our reading, which neither apt nor dpkg documents: such files are left behind when a dpkg run stops part way, for example after a dropped SSH session, a power loss or a full disk. The sections below cover how to check that no package tool is still running, how to read the package states, and how the command apt names is run with a save step and a Risk paragraph first.

What the error means

apt does not guess. After it takes the dpkg locks, it looks in the updates/ directory that sits beside dpkg's status file. Reading apt's source (debSystem::Lock and debSystem::CheckUpdates in apt-pkg/deb/debsystem.cc, tag 2.6.1), a file in that directory whose name consists only of digits marks a "dirty journal", and apt then stops with this message. The dpkg-query manual names /var/lib/dpkg/status as the status file, so the directory is normally /var/lib/dpkg/updates/; apt takes the location from its Dir::State::status setting.

The message adds sudo only when the SUDO_USER environment variable is set. As root without sudo, it shows dpkg --configure -a.

The dpkg manual describes what the command does: --configure package...|-a|--pending configures a package "which has been unpacked but not yet configured", and with -a or --pending it configures all unpacked but unconfigured packages. Configuring consists of unpacking the conffiles while backing up the old ones, then running the package's postinst script.

dpkg uses these package states, shown in the manual:

  • unpacked: the package is unpacked, but not configured.
  • half-configured: configuration has started but has not completed.
  • triggers-awaited and triggers-pending: the package waits on, or has, trigger processing.
  • installed: correctly unpacked and configured.

This error is different from the lock error covered in “Could not get lock /var/lib/dpkg/lock-frontend”: find the process holding it. There another process is holding the lock. Here nothing may be running at all, and the leftover journal is the problem.

Likely causes

Cause What you see How to confirm
dpkg or apt was killed or the host lost power during an upgrade The message appears on the next apt command; packages in state U or F dpkg-query -l shows letters other than ii in the status column; the end of /var/log/dpkg.log stops mid-run
A postinst script failed earlier dpkg --configure -a fails on one named package The error names the package and its maintainer script
The disk, or /boot, filled during unpacking Write errors during unpack, then the message df -h shows a full file system; /boot is full and the kernel update will not install: remove old kernels the safe way covers /boot
An upgrade is still running in another session Processes named apt, apt-get or dpkg exist ps shows them; wait for them instead of acting
Triggers were left pending Status letters W or t dpkg-query -l shows them

Prove the cause before changing anything

All of these only read. Run them as root.

1. Is a package tool still running?

ps -C apt,apt-get,dpkg -o pid,etime,args

The ps manual says -C selects by command name and -o sets the output columns, here process ID, elapsed time and the command line. A good result is only the header line. A bad result lists a process; do not interrupt it, and use the lock guide named above instead.

2. List the update journal.

ls -l /var/lib/dpkg/updates/

An empty directory means this check would pass. Files whose names are only digits are what apt reacts to.

3. Ask dpkg for its consistency check.

dpkg --audit

The manual says -C, --audit searches for "packages that have been installed only partially" and that "dpkg will suggest what to do with them". Read the package names it lists.

4. List packages that are not fully installed.

dpkg-query -l | grep -v '^ii '

The dpkg-query manual says the first three columns show the desired action, the package status and error flags. Header lines appear in the output. rc marks a removed package whose configuration files remain. Letters U, F, W, t or H in the status column, or R in the error column, are the ones to act on; the manual says an uppercase status or error letter indicates the package is likely to cause severe problems.

5. Read what dpkg last did.

tail -n 50 /var/log/dpkg.log

The dpkg manual gives /var/log/dpkg.log as the default log file. Look for the last package with an unpack or configure line and no matching completed line.

6. Check free space.

df -h /var /boot

Fix

Run the command apt names

First save the settings files and the package list, so you can restore a configuration file that a maintainer script changes:

cp -a /etc /root/etc-before.2026-12-01
dpkg-query -l > /root/dpkg-list-before.2026-12-01.txt

Risk: the next command runs the postinst script of every unpacked package that is not yet configured. Those scripts can change configuration files and can start or restart services. dpkg cannot reverse them.

Run it only after step 1 showed no running package tool. The manual says -a configures all unpacked but unconfigured packages:

dpkg --configure -a

To back out: dpkg has no undo. If a service misbehaves afterwards, restore only the file you identify from the saved copy and restart that service. The path here is an example:

ls -l /root/etc-before.2026-12-01/example/example.conf
cp -p /root/etc-before.2026-12-01/example/example.conf /etc/example/example.conf

Then check the service's own configuration test, if it has one, and restart that service.

If dpkg --configure -a fails on one package

The error names the package and the script that failed. What corrects it follows from that message, such as free space, a missing dependency or a configuration file that does not parse. Each of those is a change to the system that depends on the package, so this guide gives no command for it. Once the cause is corrected, the same save step and Risk as above apply to a second dpkg --configure -a run.

If dpkg reports broken dependencies, the apt-get manual describes -f, --fix-broken as an attempt "to correct a system with broken dependencies in place", and warns that a dependency structure can be corrupt enough to need manual intervention. See the exact plan first. The simulation changes nothing; the manual says it performs "a simulation of events":

apt-get -s -f install

Read which packages it would install, remove or configure. If it would remove a package you need, stop here.

First save the package list again if you changed anything since the earlier save:

dpkg-query -l > /root/dpkg-list-before-fix.2026-12-01.txt

Disruptive step: the next command can install, upgrade or remove packages to repair dependencies, and it runs maintainer scripts that can restart services.

Run it only if the simulated plan was acceptable:

apt-get -f install

To back out: packages it installed or removed are not reversed automatically. Compare dpkg-query -l with the saved list, and reinstall any package you need with apt-get install package-name, using the exact name from the saved list. The saved list gives names and versions; it does not hold the packages or their configuration files.

Example (illustrative): web01 loses its SSH session while apt-get upgrade is unpacking a web server package. The next apt-get update prints the dpkg-was-interrupted message. ps -C apt,apt-get,dpkg -o pid,etime,args shows only the header. ls -l /var/lib/dpkg/updates/ lists one file with a numeric name. dpkg --audit lists the web server package as unpacked but not configured. After cp -a /etc /root/etc-before.2026-12-01, dpkg --configure -a finishes without errors. The directory is then expected to be empty (expected, not documented), and apt-get update runs.

Confirm the fix

  1. ls -l /var/lib/dpkg/updates/ shows no files with numeric names.
  2. dpkg --audit lists no packages.
  3. dpkg-query -l | grep -v '^ii ' shows no U, F, W, t or H status letters and no R error flag.
  4. apt-get update runs without the message. This is the command that failed.
  5. The services of the packages that were configured are running, using your usual status check.

What to watch afterwards

  • Run upgrades in screen, tmux or a console that survives a dropped session, or from a maintenance window, so a disconnect cannot interrupt dpkg.
  • If the message returns without an interruption, read /var/log/dpkg.log for the package that fails to configure each time.
  • Keep the saved /etc copy until the configured services have run normally for a day, then remove it yourself, naming the exact folder.

Risks and limits

  • These commands have not been run or lab-tested.
  • The check behind the message is read from apt's source code. The manual pages do not describe it, and a later apt release can change it.
  • The manual pages do not say when dpkg removes the files in the updates directory. The checks above show their state before and after rather than assuming it.
  • dpkg --configure -a runs scripts written by package maintainers and by third-party repositories. Their effects are outside what a manual page can predict.
  • Ubuntu and other derivatives use the same dpkg and apt, but version numbers differ.

Sources

  • dpkg(1) — Debian Manpages, bookworm (dpkg 1.21.22), source updated 2023-05-11, accessed 1 December 2026
  • dpkg-query(1) — Debian Manpages, bookworm (dpkg 1.21.22), source updated 2023-05-11, accessed 1 December 2026
  • apt-get(8) — Debian Manpages, bookworm (apt 2.6.1), source updated 2023-05-25, accessed 1 December 2026
  • apt.conf(5) — Debian Manpages, bookworm (apt 2.6.1), source updated 2023-05-25, accessed 1 December 2026
  • apt-pkg/deb/debsystem.cc (tag 2.6.1) — apt source at tag 2.6.1, Debian apt repository mirror on GitHub, no date shown, accessed 1 December 2026
  • ps(1) — man7.org copy, HTML rendering created 2026-09-09, accessed 1 December 2026