The unattended-upgrades service encountered an error during automatic package updates. This typically indicates broken dependencies, held packages, or insufficient disk space preventing the upgrade process from completing successfully.
The "Unattended upgrade returned False" error occurs when the unattended-upgrades package manager fails to complete automatic system updates on Debian/Ubuntu systems. This error is logged when the upgrade process exits with a failure status, signaling that the automatic update cycle did not succeed. The unattended-upgrades service runs in the background (usually via cron) to apply security patches and updates without user intervention. When it encounters a problem—such as broken package dependencies, conflicting package versions, held packages preventing updates, or insufficient disk space—the upgrade process terminates and returns a failure status. This is a critical issue because it means your system is not receiving automatic security updates, potentially leaving it vulnerable to known security vulnerabilities.
View the detailed error log to understand what failed:
sudo cat /var/log/unattended-upgrades/unattended-upgrades.logLook for the last few lines that indicate the specific error. Common patterns include "Cache has broken packages" or dependency-related messages.
First, check if packages are being held:
apt-mark showholdIf packages are held, unhold them:
sudo apt-mark unhold <package-name>Then fix broken dependencies:
sudo apt --fix-broken install
sudo dpkg --configure -aRun the update and upgrade process manually to test:
sudo apt update
sudo apt upgradeThis allows you to see the actual error messages and confirm whether the issue is resolved. If apt prompts about changes, review and confirm.
Verify available disk space, particularly in / and /var:
df -hIf space is low (less than 10% available), clean up:
sudo apt clean # Remove all cached .deb files
sudo apt autoclean # Remove old cached versions only
sudo apt autoremove # Remove unused dependenciesCheck if apt or dpkg is already running:
ps aux | grep -i apt
ps aux | grep -i dpkgIf no processes are shown, safely remove stale lock files:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*Then retry apt update and upgrade.
After resolving the issues above, manually trigger unattended-upgrades:
sudo unattended-upgrade -dThe -d flag enables debug output. Check for "All packages are up to date" or other success messages. If still failing, the error details will help identify remaining issues.
On systems with SELinux or AppArmor enabled, security policies may prevent unattended-upgrades from running certain operations. Check security logs with "sudo grep unattended /var/log/audit/audit.log" (SELinux) or "sudo grep unattended /var/log/syslog" (AppArmor).
For servers on metered connections, the Unattended-Upgrade configuration file (/etc/apt/apt.conf.d/50unattended-upgrades) includes options like "Skip-Updates-On-Metered-Connections" that may pause upgrades.
If running in a container, the parent image's package sources may be stale or missing. Rebuild the container from an updated base image.
Consider configuring unattended-upgrades to send email notifications when errors occur, using the "Mail" directive in /etc/apt/apt.conf.d/50unattended-upgrades to stay aware of these failures.
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt