fix(convert): support GCP-style images with a separate ESP grub.cfg and vendor kernels#130
Open
Wilbert957 wants to merge 1 commit into
Open
fix(convert): support GCP-style images with a separate ESP grub.cfg and vendor kernels#130Wilbert957 wants to merge 1 commit into
Wilbert957 wants to merge 1 commit into
Conversation
…nd vendor kernels Two issues prevented cryptpilot-convert from producing a bootable image on GCP Ubuntu cloud images: 1. Stale ESP grub.cfg. GCP images keep a full, firmware-read grub.cfg on the EFI System Partition (/boot/efi/EFI/<distro>/grub.cfg), while convert only regenerates the boot-partition copy (/boot/grub/grub.cfg). After convert the ESP copy still references the pre-conversion kernel, so the firmware boots a stale (often already-removed) kernel and fails with "vmlinuz-... not found" / "*.mod not found". Propagate the regenerated grub.cfg and the grub module directory to each separate ESP grub.cfg. This is a no-op when there is no separate ESP copy, and skips the case where grub-mkconfig already wrote straight to the ESP (e.g. the alinux symlink), detected with -ef. 2. zram kernel-module detection hard-coded "-generic". On images whose only kernel is a cloud-vendor flavor (e.g. -gcp, -aws) the detection returned empty and aborted with "Could not determine kernel version". Select the highest-versioned installed vmlinuz regardless of flavor, matching the kernel chosen for the initrd later. Verified end-to-end on a GCP Ubuntu 24.04 image converted with a -gcp kernel: the ESP grub.cfg and module set become byte-equivalent to a known-bootable image, and zram detection resolves the -gcp kernel.
|
@Wilbert957 ,您好,您的请求已接收,请耐心等待结果。 |
|
@Wilbert957 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
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
cryptpilot-convertcannot produce a bootable image from a GCP Ubuntu 24.04 cloud image. Two independent issues:Stale ESP
grub.cfg. GCP images keep a full, firmware-readgrub.cfgon the EFI System Partition (/boot/efi/EFI/<distro>/grub.cfg), while convert only regenerates the boot-partition copy (/boot/grub/grub.cfg). After conversion the ESP copy still references the pre-conversion kernel, so the firmware boots a stale (often already-removed) kernel and the boot fails witherror: file '/vmlinuz-...' not found/error: file '/EFI/ubuntu/x86_64-efi/bli.mod' not found.zram module detection hard-codes
-generic.install_zram_module_if_neededgrepsdpkg -lforlinux-image-...-generic. On an image whose only kernel is a cloud-vendor flavor (e.g.-gcp,-aws), the match is empty and convert aborts withCould not determine kernel version.Fix
grub.cfg, propagate it (and the grub module directory, e.g.x86_64-efi) to each separate ESPgrub.cfg. No-op when there is no separate ESP copy; skips the case wheregrub-mkconfigalready wrote straight to the ESP (e.g. the alinux symlink), detected with-ef.vmlinuzregardless of flavor, matching the kernel already chosen for the initrd later (ls /boot/vmlinuz-* | sort -V | tail -1).Both changes are scoped to behavior that was already broken for these images and are no-ops on layouts that already worked (e.g. alinux UEFI, single-grub.cfg images).
Testing
End-to-end on a GCP Ubuntu 24.04 image converted with a
6.17.0-1018-gcpkernel, with the equivalent out-of-tree post-processing removed so convert alone is exercised:Syncing regenerated grub.cfg to ESP: /boot/efi/EFI/ubuntu/grub.cfg; the ESPgrub.cfgdefault entry now points at the-gcpkernel and thex86_64-efimodule dir (incl.bli.mod) is present.6.17.0-1018-gcpinstead of aborting.cryptpilot-fdebefore-sysroot sets up dm-verity + zram + dm-snapshot,/sysrootmounts, after-sysroot completes, switch-root succeeds, and the system reaches multi-user.