Repository navigation
fix: run host apt installs without prompts so core upgrades cannot hang - #229
Merged
Merged
Conversation
enable_unattended_upgrades.sh ran `apt-get install -y needrestart` without DEBIAN_FRONTEND=noninteractive. When a newer kernel is installed but not yet booted, needrestart's apt hook opens a "Pending kernel upgrade" whiptail dialog. Core runs this script with `docker run -t` (a TTY but no input), so the dialog waits forever while holding the dpkg lock. Every later upgrade script then blocks on that lock, as do unattended-upgrades runs, until the host reboots. Run the scripts' apt calls with DEBIAN_FRONTEND=noninteractive, NEEDRESTART_SUSPEND=1 (no needrestart prompts or service restarts from these installs) and a 300s dpkg lock timeout, so a lock held by something else delays the core upgrade instead of blocking it forever. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Dappnode bot has built and pinned the built packages to an IPFS node, for commit: 6ab126c This is a development version and should only be installed for testing purposes.
Hash: (by dappnodebot/build-action) |
Make it obvious at each call site that apt-get runs non-interactively. A hyphenated name is not possible: the script runs under /bin/sh (dash), which rejects it as a bad function name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3alpha
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
src/scripts/enable_unattended_upgrades.shrunsapt-get install -y needrestartwithoutDEBIAN_FRONTEND=noninteractive.When a newer kernel is installed but the host hasn't rebooted yet, needrestart's apt hook opens a "Pending kernel upgrade" whiptail dialog waiting for
<Ok>. Core runs the script throughdocker run --rm --privileged --pid=host -t alpine nsenter …— a TTY but no input — so nobody can answer it. The dialog then:upgrade_*.shscripts never run;It only clears on a host reboot. Seen on a real Ubuntu 26.04 node: the dialog had been waiting for 5 days (
/usr/share/debconf/frontend /usr/sbin/needrestart -m u), with kernel and libc6 updates pending since unattended-upgrades installed them.Fix
The scripts' apt calls now run with:
DEBIAN_FRONTEND=noninteractive— no debconf prompts;NEEDRESTART_SUSPEND=1— needrestart's apt hook is skipped, so these installs neither prompt nor restart services (service restarts after library upgrades remain with unattended-upgrades, configured torestart = 'a'as before);-o DPkg::Lock::Timeout=300— if something else holds the dpkg lock, the upgrade fails after 5 minutes and the loop continues, instead of blocking forever.Nothing about reboots changes:
Unattended-Upgrade::Automatic-Reboot "false"stays as is, and needrestart never reboots the host.Testing
Reproduced in an
ubuntu:26.04container run withdocker run -t(TTY, no input), withwhiptailand a reallinux-image-virtualinstalled so needrestart reports a pending kernel (NEEDRESTART-KSTA: 3):apt-get install --reinstall -y needrestart<Ok>" dialog, hung until killed by a 60 s timeoutapt_get_noninteractivewrapperenable_unattended_upgrades.sh, same conditionsrestart = 'a'andAutomatic-Reboot falsewritten as beforeNot covered: Debian hosts, and the lock-timeout path against a real held lock.
Nodes that are already stuck stay stuck until the hanging process ends or the host reboots; with this change, the new core's upgrades wait at most 5 minutes per apt call instead of forever.
🤖 Generated with Claude Code