Ubuntu uses background systemd timers and service units to automate security updates and package repository caching. Among these units, apt-daily-upgrade.service and apt-daily.service execute on periodic daily schedules triggered by systemd.timer. During system boots or while reviewing system health via systemctl --failed, system administrators frequently observe the error: Failed to start Daily apt upgrade and clean activities or apt-daily-upgrade.service: Main process exited, code=exited, status=100/n/a.
Why Does the Daily apt Upgrade Activity Service Fail?
The apt-daily-upgrade service triggers /usr/lib/apt/apt.systemd.daily. It typically crashes due to lock file contention, interrupted dpkg operations, or repository metadata corruption. Common causes include:
- Dpkg Frontend Lock Contention: A manual
aptorunattended-upgradesprocess is already executing in the background, locking/var/lib/dpkg/lock-frontend. - Interrupted Package Configuration: A previous installation or kernel upgrade crashed halfway, leaving unconfigured packages requiring
dpkg --configure -a. - Broken Third-Party APT PPA Repositories: Deprecated or unreachable external package sources returning HTTP 404 or GPG signature verification errors.
- Full Root Filesystem (/var/cache/apt): Insufficient remaining disk space inside
/varpreventing the download and extraction of new deb packages. - Corrupted APT Lists Cache: Binary database corruption inside
/var/lib/apt/lists/.
Method 1: Check Systemd Journal Logs for Detailed Error Codes
Inspect the specific exit code and crash trace generated by the systemd unit.
- Open your terminal and query the unit status:
systemctl status apt-daily-upgrade.service - View the detailed execution log using
journalctl:journalctl -u apt-daily-upgrade.service -e --no-pager - Check if the log reports
Could not get lock /var/lib/dpkg/lock-frontendorE: Problem parsing dependency.
Method 2: Remove Stale APT and DPKG Lock Files
If previous upgrade processes terminated unexpectedly, leftover lock files prevent the daily timer from executing.
- First, verify whether any apt process is currently running:
ps aux | grep -i apt - If no legitimate update is in progress, remove any 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* - Reconfigure pending packages:
sudo dpkg --configure -a
Method 3: Clear and Rebuild Corrupted APT Package Lists
Corrupted repository index files prevent automated update routines from resolving dependencies.
- Purge cached package list files:
sudo rm -rf /var/lib/apt/lists/* - Clean the local apt archive cache:
sudo apt clean && sudo apt autoclean - Rebuild the package index:
sudo apt update - Verify that no unreachable PPA repositories or 404 errors appear during the index rebuild.
Method 4: Manually Test the Daily Script Execution
Run the underlying maintenance shell script manually to confirm error-free execution.
- Execute the script in debug mode:
sudo /usr/lib/apt/apt.systemd.daily - If the script completes without outputting errors, start the systemd service manually:
sudo systemctl start apt-daily-upgrade.service - Check its status to verify it now reports
active (exited)with success:systemctl status apt-daily-upgrade.service
Method 5: Reset Systemd Failed State and Verify Timers
Clear the systemd degraded status flag and verify the associated timers are active.
- Reset systemd failed units:
sudo systemctl reset-failed apt-daily-upgrade.service - Verify that both related timers are running normally:
systemctl list-timers | grep -E "apt-daily|apt-daily-upgrade" - If the timers are inactive or masked, re-enable them:
sudo systemctl unmask apt-daily-upgrade.timer sudo systemctl enable --now apt-daily-upgrade.timer