go-debos / fakemachine

fake a machine
Apache License 2.0
34 stars 37 forks source link

fakemachine fails on debian kernel version 6.6.13 because kernel modules are now xz compressed #194

Closed obbardc closed 6 months ago

obbardc commented 6 months ago

fakemachine fails with:

[    1.099950] Run /init as init process
modprobe: can't load module virtio_console (/usr/lib/modules/6.6.13-amd64/kernel/drivers/char/virtio_console.ko): No such file or directory
modprobe: can't load module 9pnet (/usr/lib/modules/6.6.13-amd64/kernel/ne[   t 1.113319/] Kerne9l ppanic -/ not sync9ing: pAttempted to knill init! exitcode=0x00007f00

This is because the kernel modules are now xz compressed e.g: /usr/lib/modules/6.6.13-amd64/kernel/net/9p/9pnet.ko.xz

This change happened in 6.6.3-1~exp1; https://salsa.debian.org/kernel-team/linux/-/commit/e8b64e4b4318aaaf7222f47922c8dfe91b1dd869

obbardc commented 6 months ago

So we do handle compressed modules; but I believe we currently attempt to extract them into the created initrd.

I think this was because busybox's modprobe didn't handle loading compressed kernel modules out-of-the box?

obbardc commented 6 months ago

OK seems like the module copying/extraction code is flawed https://github.com/go-debos/fakemachine/blob/377f277b4c55fa867544335a6cef617db96518a5/machine.go#L119

We prepend /usr and essentially extract e.g. /usr/lib/modules/6.6.13-amd64/kernel/fs/netfs/netfs.ko.xz to /usr/usr/lib/modules/6.6.13-amd64/kernel/fs/netfs/netfs.ko

obbardc commented 6 months ago

Extracting the compressed modules into the initrd was introduced in https://github.com/go-debos/fakemachine/commit/fe55af6b6f95455c0d659463bcecdb433c4d4539