Public bug reported:

### Problem
unattended-upgrades starts but hangs indefinitely inside `apt.Cache.__init__()` 
with no CPU usage. The system becomes almost         
completely unresponsive in userspace (soft lockup) while the kernel still 
responds to ACPI power button events. This led to a 4+ hour
 hang requiring a manual power button shutdown.                                 
                                                     
                                                                
**Environment:** Ubuntu 24.04 (Noble) on VPS (QEMU/KVM), unattended-upgrades 
2.9.1+nmu4ubuntu1, NOT subscribed to Ubuntu Pro.

### Steps to Reproduce / Timeline
1. systemd-networkd-wait-online timed out (default 120s timeout exceeds VPS 
interface bringup time)
2. ESM cache step failed with DNS errors for esm.ubuntu.com (Ubuntu Pro/ESM 
hooks active despite no subscription)                    
3. unattended-upgrades started at 08:01:23 → hung at `apt.Cache(rootdir=...)` 
after "Initial whitelist..." log line
                                                                                
                                                     
Exact timeline from logs:                                       
- 06:13 & 08:01: systemd-networkd-wait-online timeout
- 08:01:21: ESM DNS failure ("Temporary failure resolving 'esm.ubuntu.com'")
- 08:01:23: unattended-upgrades starts → hangs at apt.Cache.__init__()
                                                                                
                                                     
### Workaround that resolved it
1. Disabled ESM lines in /etc/apt/apt.conf.d/50unattended-upgrades (Ubuntu Pro 
not subscribed)                                       
2. Overrode systemd-networkd-wait-online with `--any --timeout=10` 
(VPS-friendly)
3. Added hardening options (Mail on error, Remove-Unused-Dependencies, Debug 
logging)

After these changes, `unattended-upgrades --dry-run` completes
successfully and `apt update` no longer shows ESM DNS errors.

### Expected Behaviour
unattended-upgrades should either succeed, fail gracefully with clear error 
messages, or have a reasonable timeout instead of hanging
 indefinitely and causing system unresponsiveness.                              
                                                     
 
### Additional Info                                                             
                                                     
- This appears specific to VPS/cloud environments where 
systemd-networkd-wait-online timeout occurs
- The hang occurs in apt.Cache.__init__() when it tries to initialize package 
cache with ESM repositories that have DNS resolution
failures
- No OOM or resource exhaustion - system had 28% memory usage at crash
- Affects systems WITHOUT Ubuntu Pro subscription where ESM is still enabled in 
unattended-upgrades

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: unattended-upgrades 2.9.1+nmu4ubuntu1
ProcVersionSignature: Ubuntu 6.8.0-106.106-generic 6.8.12
Uname: Linux 6.8.0-106-generic x86_64
ApportVersion: 2.28.1-0ubuntu3.8
Architecture: amd64
CasperMD5CheckResult: unknown
CloudArchitecture: x86_64
CloudBuildName: server
CloudID: nocloud
CloudName: unknown
CloudPlatform: nocloud
CloudSerial: 20260307
CloudSubPlatform: seed-dir (/var/lib/cloud/seed/nocloud)
Date: Fri Apr  3 12:56:25 2026
PackageArchitecture: all
ProcEnviron:
 LANG=C.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=tmux-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: unattended-upgrades
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: unattended-upgrades (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug cloud-image noble

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2147202

Title:
  unattended-upgrades hangs indefinitely at apt.Cache.__init__() after
  systemd-networkd-wait-online timeout and ESM DNS failure (Ubuntu 24.04
  VPS)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/2147202/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to