Thanks Peter, the fact that libc6.postinst calls daemon-reexec directly
explains why needrestart settings were bypassed.

The /proc/1/stack trace (`do_wait` -> `kernel_waitid`) matches systemd's freeze 
behavior:
1. In `src/core/manager.c`, PID 1 forks `(sd-gens)` via `safe_fork(..., 
FORK_WAIT)`.
2. Inside `(sd-gens)`, `manager_execute_generators()` sets `alarm(90)`.
3. When a generator hangs past 90s, the kernel terminates the child with 
`SIGALRM`.
4. In `process-util.c`, `wait_for_terminate_and_check()` catches `CLD_KILLED` 
and returns `-EPROTO`.
5. Because `-EPROTO` is not treated as a recoverable privilege error, 
`manager_startup()` fails completely and `main.c` calls 
`freeze_or_exit_or_reboot()`, leaving PID 1 parked in an infinite `do_wait()` 
loop.

The Hyper-V live migration the previous evening is a huge clue. After
migration, stale TCP connections to remote targets (NFS exports, SMB
mounts, or Active Directory/SSSD) often cause blocking I/O syscalls.

Did you have a chance to run the test loop from comment #7 on this VM?
Running it will immediately identify which generator blocks:

mkdir -p /tmp/test-gens
for g in /usr/lib/systemd/system-generators/*; do
    [ -x "$g" ] || continue
    echo "=== Testing $(basename "$g") ==="
    timeout 5s "$g" /tmp/test-gens /tmp/test-gens /tmp/test-gens && echo "OK" 
|| echo "FAILED/TIMED OUT"
done
rm -rf /tmp/test-gens

My primary suspects remain `rpc-pipefs-generator` (NFS) and `systemd-
fstab-generator` (remote mounts).

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

Title:
  systemd freezes after daemon-reexec triggered by unattended-upgrades /
  needrestart on Ubuntu 24.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2165295/+subscriptions


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

Reply via email to