fix(update): use kernel from updated root instead of boot partition #41
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.
When updating the bootloader configuration, the code was using filepath.Glob() to find kernels on the boot partition. This returned files in alphabetical order, which caused the wrong kernel to be selected when multiple versions existed.
For example, with kernels 6.18.2-surface-1 and 6.18.3-surface-2 on the boot partition, the bootloader would point to 6.18.2 (alphabetically first) even though the updated root filesystem contained 6.18.3. This caused boot failures because the kernel modules didn't match the booted kernel.
The fix adds getUpdatedRootKernelVersion() which reads the kernel version from the updated root's /usr/lib/modules directory, ensuring the bootloader always references the kernel that matches the newly extracted container image.
Includes regression tests that verify: