Skip to content

Commit 450b2ad

Browse files
committed
Pin guest kernel to 6.12 LTS with CONFIG_DUMMY=y
The standard x86_64/firecracker lane was pulling the guest kernel straight from `nixpkgs#linuxPackages_latest`, which currently resolves to 7.0.3. That is both a moving target and not yet bootable under PVM, and it shipped without `CONFIG_DUMMY=y`, so the K3s install proof's `ip link add port0 type dummy` aborted with `Error: Unknown device type.` and the cluster never came up. Introduce a small port-owned `nix/guest-kernel.nix` that takes `linuxPackages_6_12.kernel` and overrides `structuredExtraConfig.DUMMY = yes`, exposed through `legacyPackages.<sys>.linuxPackages-port-guest` so callers retain `.kernel.dev` and `.kernel.modules`. The artifact build/validate scripts now resolve the standard lane through that attr, with `PORT_GUEST_KERNEL_ATTR` / `PORT_GUEST_KERNEL_MODULES_ATTR` override hooks. PVM and aarch64 lanes are unchanged.
1 parent b7ff825 commit 450b2ad

5 files changed

Lines changed: 25 additions & 4 deletions

File tree

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@
238238
firecracker-pvm-host-kit = awsPvmHostKitPkg;
239239
};
240240

241+
legacyPackages = pkgs.lib.optionalAttrs isLinux {
242+
linuxPackages-port-guest = pkgs.callPackage ./nix/guest-kernel.nix { };
243+
};
244+
241245
checks = pkgs.lib.optionalAttrs isLinux {
242246
aws-pvm-host-module-eval = pkgs.writeText "aws-pvm-host-module-eval.json" (
243247
builtins.toJSON {

nix/guest-kernel.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ lib, linuxPackages_6_12, linuxPackagesFor }:
2+
3+
# Port-owned guest kernel for the standard x86_64/firecracker lane.
4+
#
5+
# Pinned to the 6.12 LTS series (kernel 7.x does not yet boot under PVM)
6+
# and overridden with `CONFIG_DUMMY=y` so the guest's K3s install proof
7+
# can `ip link add port0 type dummy` without needing the dummy.ko module
8+
# on the rootfs. The result is a full `linuxPackages` set so callers
9+
# retain `.kernel.dev` and `.kernel.modules`.
10+
linuxPackagesFor (linuxPackages_6_12.kernel.override {
11+
structuredExtraConfig = with lib.kernel; {
12+
DUMMY = yes;
13+
};
14+
})

scripts/artifacts/build-guest-image.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ EOF
321321
chmod 0755 "$staging_dir/opt/credential-provider/bin/ecr-credential-provider"
322322

323323
if [[ "$copy_kernel_modules_into_guest" -eq 1 ]]; then
324-
kernel_modules_store="$(nix build --option eval-cache false --no-link --print-out-paths nixpkgs#linuxPackages_latest.kernel.modules)"
324+
guest_kernel_modules_attr="${PORT_GUEST_KERNEL_MODULES_ATTR:-legacyPackages.x86_64-linux.linuxPackages-port-guest.kernel.modules}"
325+
kernel_modules_store="$(nix build --option eval-cache false --no-link --print-out-paths ".#${guest_kernel_modules_attr}")"
325326
if [[ ! -d "${kernel_modules_store}/lib/modules" ]]; then
326327
echo "missing kernel modules in ${kernel_modules_store}/lib/modules" >&2
327328
exit 1

scripts/artifacts/build-kernel.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ resolve_pvm_build_flake_ref() {
2929
case "$output_path" in
3030
*/x86_64/firecracker/standard/*)
3131
arch="x86_64"
32-
kernel_source="$(nix build --option eval-cache false --no-link --print-out-paths nixpkgs#linuxPackages_latest.kernel.dev)"
32+
guest_kernel_attr="${PORT_GUEST_KERNEL_ATTR:-legacyPackages.x86_64-linux.linuxPackages-port-guest.kernel.dev}"
33+
kernel_source="$(nix build --option eval-cache false --no-link --print-out-paths ".#${guest_kernel_attr}")"
3334
kernel_path="${kernel_source}/vmlinux"
34-
kernel_origin="nixpkgs#linuxPackages_latest.kernel.dev"
35+
kernel_origin=".#${guest_kernel_attr}"
3536
;;
3637
*/x86_64/firecracker/pvm/*)
3738
arch="x86_64"

scripts/artifacts/validate-kernel.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ resolve_pvm_build_flake_ref() {
3434
case "$kernel_path" in
3535
*/x86_64/firecracker/standard/*)
3636
arch="x86_64"
37-
expected_path="$(nix build --option eval-cache false --no-link --print-out-paths nixpkgs#linuxPackages_latest.kernel.dev)/vmlinux"
37+
guest_kernel_attr="${PORT_GUEST_KERNEL_ATTR:-legacyPackages.x86_64-linux.linuxPackages-port-guest.kernel.dev}"
38+
expected_path="$(nix build --option eval-cache false --no-link --print-out-paths ".#${guest_kernel_attr}")/vmlinux"
3839
;;
3940
*/x86_64/firecracker/pvm/*)
4041
arch="x86_64"

0 commit comments

Comments
 (0)