feat: disable kernel updates in setup script#519
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds kernel package holds to the Ubuntu 22.04 setup script to prevent automatic kernel upgrades that could break driver/module compatibility.
Changes:
- Hold Ubuntu kernel metapackages (
linux-image-generic,linux-headers-generic,linux-generic) viaapt-mark hold. - Also hold the currently-running kernel image/headers packages and print an
apt-mark unholdcommand for reversal.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sudo apt-mark hold \ | ||
| linux-image-generic linux-headers-generic linux-generic \ | ||
| "linux-image-$(uname -r)" "linux-headers-$(uname -r)" 2>/dev/null || true | ||
| echo "Kernel packages held. Run 'sudo apt-mark unhold linux-image-generic linux-headers-generic linux-generic linux-image-$(uname -r) linux-headers-$(uname -r)' to re-enable." |
There was a problem hiding this comment.
The apt-mark hold call suppresses errors (2>/dev/null || true), but the next line always prints "Kernel packages held". If apt-mark fails (e.g., dpkg lock, missing package names, sudo issues), the script will claim success while not actually pinning the kernel. Consider removing the error suppression or checking the command exit status and printing a warning / aborting when the hold step fails; alternatively, validate with apt-mark showhold before printing the success message.
| sudo apt-mark hold \ | |
| linux-image-generic linux-headers-generic linux-generic \ | |
| "linux-image-$(uname -r)" "linux-headers-$(uname -r)" 2>/dev/null || true | |
| echo "Kernel packages held. Run 'sudo apt-mark unhold linux-image-generic linux-headers-generic linux-generic linux-image-$(uname -r) linux-headers-$(uname -r)' to re-enable." | |
| if sudo apt-mark hold \ | |
| linux-image-generic linux-headers-generic linux-generic \ | |
| "linux-image-$(uname -r)" "linux-headers-$(uname -r)"; then | |
| echo "Kernel packages held. Run 'sudo apt-mark unhold linux-image-generic linux-headers-generic linux-generic linux-image-$(uname -r) linux-headers-$(uname -r)' to re-enable." | |
| else | |
| echo "Warning: Failed to hold kernel packages; automatic kernel updates remain enabled." >&2 | |
| fi |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
apt-mark holdtosetup_22.04.shto pin the current kernel and generic kernel metapackages, preventing automatic kernel updates that can break driver/module compatibilityTest plan
setup_22.04.shon a fresh Ubuntu 22.04 install and verify kernel packages are heldapt-mark showholdlists the expected packages after setup🤖 Generated with Claude Code