Public bug reported:

On Ubuntu 26.04, apt upgrade repeatedly hangs indefinitely in the
needrestart APT post-invoke hook after kernel upgrades. needrestart
remains blocked in n_tty_write() writing to the original pseudo-
terminal, leaving the APT shutdown inhibitor active and packages
partially configured. This has now been reproduced on multiple VMs and
bare-metal hosts. The process remained stuck for multiple hours,
including in excess of 24 hours on one bare metal installation. Killing
needrestart and the stranded APT processes followed by dpkg --configure
-a recovers the system(s). Furthermore, executing needrestart -r l
immediately produced the traditional "Pending kernel upgrade"
dialog/prompt. Please note that Tailscale SSH was used to access all
relevant machines/VMs and may have some relevance or impact, but debug
reports did not indicate it was the source of the problem. Logs are
available upon request.

1) Release version: 26.04 (server)
2) Package: 
needrestart:
  Installed: 3.11-1ubuntu2
  Candidate: 3.11-1ubuntu2
  Version table:
 *** 3.11-1ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu resolute/main amd64 Packages
        100 /var/lib/dpkg/status

apt:
  Installed: 3.2.0
  Candidate: 3.2.0
  Version table:
 *** 3.2.0 500
        500 http://us.archive.ubuntu.com/ubuntu resolute/main amd64 Packages
        100 /var/lib/dpkg/status

Linux VM-name-redacted 7.0.0-30-generic #30-Ubuntu SMP PREEMPT_DYNAMIC
Fri Jul 31 18:22:54 UTC 2026 x86_64 GNU/Linux

3) Expected behaviour: apt upgrade completes and releases the shutdown 
inhibitor.
4) Actual behaviour: needrestart remains blocked writing to the TTY, leaving 
apt active and packages partially configured.
5) Steps to reproduce:
   a. Run apt upgrade.
   b. Upgrade installs a new kernel.
   c. needrestart is invoked.
   d. needrestart hangs indefinitely.

Process tree:
  apt
    └─ apt
        └─ apt-pinvoke
            └─ needrestart
Observed stack:
  wait_woken
  n_tty_write
  tty_write
  vfs_write

** Affects: needrestart (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "needrestart-debug.txt"
   
https://bugs.launchpad.net/bugs/2164687/+attachment/5993969/+files/needrestart-debug.txt

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

Title:
  needrestart hangs during apt upgrade

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


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

Reply via email to