Inspecting system health on an Ubuntu desktop or cloud server using systemctl status or reviewing the system journal via journalctl frequently reveals an alarming red degraded status reporting Failed to start Daily apt upgrade and clean activities (apt-daily-upgrade.service). Ubuntu schedules automatic background package index refreshes and unattended security upgrades via dual systemd timers: apt-daily.timer and apt-daily-upgrade.timer. When an automated task collides with a manual package installation, runs during unresolvable network dropouts, or encounters locked dpkg database files, systemd marks the unit in a failed state. Clearing locked package databases, fixing broken dependency transactions, and resetting the maintenance service restores clean automated updates.
Inspect Service Failure Logs in the Systemd Journal
Before modifying package configurations, identify the exact fatal error code recorded by the apt-daily-upgrade service.
- Open your terminal and query the journal logs for the specific unit:
journalctl -u apt-daily-upgrade.service -e --no-pager - Check the exit status code. Common causes include status=100 (package database lock held by another process) or network connection timeouts resolving security repository mirrors.
- Review the status of the related systemd timers:
systemctl list-timers | grep apt
Clear Stale APT and DPKG Lock Files
If an interrupted manual upgrade or abrupt power cycle left orphaned lock files on disk, background maintenance scripts cannot acquire database handles.
- Check if another background process is currently holding the package lock:
sudo lsof /var/lib/dpkg/lock-frontend - If no active package management processes are running, safely remove orphaned lock files:
sudo rm -f /var/lib/apt/lists/lock sudo rm -f /var/cache/apt/archives/lock sudo rm -f /var/lib/dpkg/lock sudo rm -f /var/lib/dpkg/lock-frontend - Reconfigure interrupted packages and repair broken dependencies:
sudo dpkg --configure -a sudo apt-get install -f
Test Manual Execution and Reset Failed Systemd Units
Once package locks and dependency states are healthy, execute the daily upgrade script manually to verify error-free execution.
- Trigger the unattended upgrade script manually with verbose debugging:
sudo /usr/lib/apt/apt.systemd.daily - Verify that the script completes silently with an exit code of 0 (check with
echo $?). - Reset the systemd failed unit state counter:
sudo systemctl reset-failed apt-daily-upgrade.service - Restart the upgrade service and confirm it enters an active or inactive (dead) success state without errors:
sudo systemctl start apt-daily-upgrade.service systemctl status apt-daily-upgrade.service