slim icon indicating copy to clipboard operation
slim copied to clipboard

slim: Unable to uncompress kernel

Open sertys3 opened this issue 3 years ago • 1 comments

Greetings, i'm trying to build qcow2 images from the ubuntu-20.04-cloud-init image, but am running into an issue.

Uncompressing compressed kernel events.js:291 throw er; // Unhandled 'error' event ^

Error: incorrect header check at Zlib.zlibOnError [as onerror] (zlib.js:182:17) Emitted 'error' event on Gunzip instance at: at errorOrDestroy (internal/streams/destroy.js:108:12) at Gunzip.onerror (_stream_readable.js:754:7) at Gunzip.emit (events.js:314:20) at Zlib.zlibOnError [as onerror] (zlib.js:185:8) { errno: -3, code: 'Z_DATA_ERROR' }

From what i can see the vmlinuz file is not compressed and the library is raising an error.

Are we certain that the docker kernel is at all compressed?

Regards, Daniel

sertys3 avatar Feb 23 '22 15:02 sertys3

There have been quite a few big changes in the code base, so the qcow2 build pipeline might have been fully tested.

My guess for this issue: Differences in arm64/intel releases of the linux use different formats for the kernel.

  • For, arm64, vmlinuz is gzipped, and the new MacOS hypervisor bootloader needs the kernel to be uncompressed.
  • For, intel, vmlinuz a bzImage with containing a compressed kernel.

The quick work around is to use -f raw which would build a raw disk image, that can be manually converted to qcow2 using qemu-convert, etc.

const formatSteps = {
    'vhd': [dockerBuild, dockerExport, buildEfiImage, makeVhd],
    'raw': [dockerBuild, dockerExport, buildRootfsImage, cleanup],
    'initrd-m1': [dockerBuild, dockerExtract, uncompressKernel, cpioPack],
    'initrd': [dockerBuild, dockerExtract, cpioPack],
    'special': [dockerBuild, dockerExport, buildRootfsImage, dockerExtract, uncompressKernel, cpioPack],
    'iso': [dockerBuild, dockerExtract, uncompressKernel, rawExtract, buildRootfsImage, isoBuild, cleanup],
    'qcow2': [dockerBuild, dockerExtract, uncompressKernel, rawExtract, buildRootfsImage, isoBuild, qcowBuild, cleanup]
};

Simply removing the uncompressKernel step for qcow2 will probably work.

Longer term, I want to introduce the idea of pipelines to make it easier to pick what processing steps you want to do on images.

chrisparnin avatar Feb 23 '22 15:02 chrisparnin