Skip to content

Fix sparse vmlinuz boot failure on XFS by changing cp --sparse to auto#706

Merged
liulanze merged 2 commits into
mainfrom
user/lanzeliu/sparse-vmlinuz-xfs-boot
Apr 23, 2026
Merged

Fix sparse vmlinuz boot failure on XFS by changing cp --sparse to auto#706
liulanze merged 2 commits into
mainfrom
user/lanzeliu/sparse-vmlinuz-xfs-boot

Conversation

@liulanze
Copy link
Copy Markdown
Contributor

@liulanze liulanze commented Apr 23, 2026

Fix boot failure caused by sparse vmlinuz kernel files on XFS partitions.

When Image Customizer repartitions an image (via storage: config), it copies
all files from the old image to the new one using cp --sparse always. This
flag aggressively scans file content for zero-byte runs and converts them into
filesystem holes.

The AZL 3.0 vmlinuz kernel binary contains a legitimate run of zero bytes.
cp --sparse always turns this into a sparse hole in the destination file.
GRUB cannot read sparse files on XFS, causing a boot failure.


Verification

Reproduced and verified with Azure Linux 3.0 core-efi image
(core-3.0.20260401.vhdx) using the partitions-xfs-boot.yaml test config.

Before fix (--sparse always):

filefrag -v /mnt/boot/vmlinuz-6.6.130.1-3.azl3
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..    3566:      34935..     38501:   3567:
   1:     3568..    3702:      38503..     38637:    135:             last,eof

Logical block 3567 is a sparse hole.

After fix (--sparse auto):

filefrag -v /mnt/boot/vmlinuz-6.6.130.1-3.azl3
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..    3702:      31809..     35511:   3703:             last,eof

Single contiguous extent, no holes.

Comment thread toolkit/tools/pkg/imagecustomizerlib/customizepartitionsfilecopy.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/customizepartitionsfilecopy.go
@liulanze liulanze merged commit f60b567 into main Apr 23, 2026
39 checks passed
@liulanze liulanze deleted the user/lanzeliu/sparse-vmlinuz-xfs-boot branch April 23, 2026 22:59
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