Skip to content

Fix kernel panic after unattended kernel upgrade#3

Open
pnc wants to merge 7 commits into
eleostech:mainfrom
pnc:kernel-panic
Open

Fix kernel panic after unattended kernel upgrade#3
pnc wants to merge 7 commits into
eleostech:mainfrom
pnc:kernel-panic

Conversation

@pnc
Copy link
Copy Markdown
Member

@pnc pnc commented May 15, 2026

The update-initramfs symlink (to /bin/true) made the machine unbootable after updating the kernel (no real surprise there.)

Claude explanation:

When unattended-upgrades installed a new kernel, its postinst called update-initramfs which silently did nothing. GRUB picked up the new vmlinuz but with no initrd line. On next boot the kernel couldn't load virtio_blk (module in initramfs), so the root disk was invisible and it panicked with "VFS: Unable to mount root fs".

Fix: divert only during first-boot provisioning (guarded by boot-finished), then restore in runcmd so future kernel upgrades generate a working initramfs.

Add e2e test that installs a second kernel flavor, verifies the initrd is created, reboots, and confirms the VM comes back on the new kernel.

The update-initramfs diversion (to /bin/true) was permanent — applied
in bootcmd with no restore.  When unattended-upgrades installed a new
kernel, its postinst called update-initramfs which silently did nothing.
GRUB picked up the new vmlinuz but with no initrd line.  On next boot
the kernel couldn't load virtio_blk (module in initramfs), so the root
disk was invisible and it panicked with "VFS: Unable to mount root fs".

Fix: divert only during first-boot provisioning (guarded by
boot-finished), then restore in runcmd so future kernel upgrades
generate a working initramfs.

Add e2e test that installs a second kernel flavor, verifies the initrd
is created, reboots, and confirms the VM comes back on the new kernel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pnc pnc requested a review from ddellacosta May 15, 2026 12:05
@pnc
Copy link
Copy Markdown
Member Author

pnc commented May 15, 2026

@ddellacosta I finally had a little time to dig into the kernel panic we both saw. The call was coming from inside the house (overzealous "speed" hack!)

@pnc
Copy link
Copy Markdown
Member Author

pnc commented May 15, 2026

@ddellacosta You will probably want to undivert/unsymlink (per the "Undo" bit) your current VM and re-run update-initramfs so you don't lose your work again.

@ddellacosta
Copy link
Copy Markdown

Gotcha, will give it a shot!

pnc and others added 6 commits May 15, 2026 14:14
The cloud kernel package name includes the arch suffix
(linux-image-cloud-arm64 vs linux-image-cloud-amd64). Use
dpkg --print-architecture inside the guest to pick the right one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set MODULES=dep in initramfs-tools so only modules for detected
hardware (virtio) are included, instead of hundreds of bare-metal
drivers. Also bump the kernel install test timeout from 300s to 600s
as a safety margin under TCG emulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The kernel reboot test hardcoded a partition UUID specific to the
current Debian cloud image. Query it from the running VM via
grub-probe so the test survives base image updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous /v2/* wildcard allowed pulling any Docker image — too
broad for a security-focused sandbox.  Scope to library/hello-world
(used by the e2e test) and add the bare /v2/ endpoint required for
registry version checks.  Also add CloudFront CDN (some Docker blob
redirects land there instead of R2) and the uv installer redirect
path on releases.astral.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The official install script runs `claude install` after downloading
the binary, which maps ~70 GB of virtual memory and gets OOM-killed
in 512 MB VMs.  Download the binary directly via curl and create
the symlink ourselves, bypassing the problematic subcommand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that both tools are installed and on PATH after cloud-init
provisioning.  Also update CLAUDE.md to note that tests run inside
this VM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants