How to fix E: dpkg was interrupted during unattended-upgrades in APT
This error occurs when a previous package installation was interrupted and left dpkg in an inconsistent state. Running `sudo dpkg --configure -a` recovers the system and allows updates to continue.
Quick fix
Fixes E: dpkg was interrupted during unattended-upgrades
sudo apt-get update- Verify the interrupted state
- Run dpkg configuration recovery
- Update package lists
- Install any missing dependencies
sudo apt-get updateE: dpkg was interrupted during unattended-upgrades
What this error means
The dpkg package manager on Debian/Ubuntu systems maintains a lock file and internal state during package installations. When an installation is interrupted (due to power failure, network issues, manual termination, or a conflicting unattended-upgrades process), dpkg cannot proceed with new operations and refuses to install or remove packages until the interrupted state is resolved. The unattended-upgrades system detects this broken state and prevents further updates to avoid data corruption.
Typical symptoms
- apt-get update or apt-get upgrade commands fail with "dpkg was interrupted" error
- Package manager refuses to install or remove any packages
- System shows pending configuration steps that must be completed
- Updates fail to install even when manually triggered
- Unattended-upgrades background service cannot proceed with security updates
Common causes
- Previous apt or unattended-upgrades process was forcefully killed before completing
- System power failure or kernel panic during package installation
- Network timeout or connection loss mid-upgrade
- Manual interrupt (Ctrl+C) during apt operations
- Multiple package managers trying to access dpkg simultaneously
- Race condition between user-initiated updates and unattended-upgrades daemon
How to fix "E: dpkg was interrupted during unattended-upgrades"
First, check if dpkg is actually in an interrupted state:
sudo apt-get updateThis will show you the exact error message and confirm the dpkg lock issue.
The primary fix is to run the dpkg configure command with the -a flag (configure all):
sudo dpkg --configure -aThis command unpacks and configures all packages that were left in an incomplete state. You may see prompts asking about configuration file changes—typically pressing Y or accepting defaults is safe.
After dpkg is repaired, refresh your package lists:
sudo apt-get updateThis downloads the latest package metadata from your configured repositories.
Fix any remaining package dependency issues:
sudo apt-get install -fThe -f flag stands for "fix" and will install missing dependencies or remove conflicting packages.
Now your system is ready for updates:
sudo apt-get upgradeor for a full distribution upgrade:
sudo apt-get dist-upgradeAdvanced notes
For persistent issues where dpkg --configure -a fails repeatedly, check the dpkg log files: sudo cat /var/log/dpkg.log and sudo ls -la /var/log/unattended-upgrades/. If you see lock files that are stale, you can manually remove them as a last resort:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
cd /var/lib/dpkg/updates
sudo rm *
sudo apt-get updateAlso check for hung processes: ps aux | grep apt and kill them if necessary with sudo kill -9 <PID> before retrying.
For unattended-upgrades specifically, you can enable automatic dpkg recovery by adding Unattended-Upgrade::AutoFixInterruptedDpkg "true"; to /etc/apt/apt.conf.d/50unattended-upgrades to prevent this issue in the future.
Frequently asked questions
- What does "E: dpkg was interrupted during unattended-upgrades" mean?
- The dpkg package manager on Debian/Ubuntu systems maintains a lock file and internal state during package installations. When an installation is interrupted (due to power failure, network issues, manual termination, or a conflicting unattended-upgrades process), dpkg cannot proceed with new operations and refuses to install or remove packages until the interrupted state is resolved. The unattended-upgrades system detects this broken state and prevents further updates to avoid data corruption.
- How do I fix "E: dpkg was interrupted during unattended-upgrades"?
- This error occurs when a previous package installation was interrupted and left dpkg in an inconsistent state. Running sudo dpkg --configure -a recovers the system and allows updates to continue.
- What causes "E: dpkg was interrupted during unattended-upgrades"?
- Previous apt or unattended-upgrades process was forcefully killed before completing System power failure or kernel panic during package installation Network timeout or connection loss mid-upgrade
- Is the "E: dpkg was interrupted during unattended-upgrades" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚APT Official Documentation
- 📖Automox upgrade failure documentation(Official Docs)
- 📖unattended-upgrades GitHub README(Official Docs)