containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
889 stars 74 forks source link

chroot_vm example failes with a kernel panic #208

Closed aFuerst closed 3 months ago

aFuerst commented 3 months ago

I built libkrunfw and libkrun successfully, init/init exists after the build, and making the rootfs with podman all worked. When I run the first example using ./chroot_vm ./rootfs_fedora /bin/sh I just get a panic.

Looks like the rootfs or init program isn't being mounted? Any idea? Running on Ubuntu 22.04, kernel 6.5.0-41-generic

[    0.430300] List of all bdev filesystems:
[    0.430418]  ext3
[    0.430420]  ext2
[    0.430447]  ext4
[    0.430480]  vfat
[    0.430521]  xfs
[    0.430565] 
[    0.430642] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.430757] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.32 #1
[    0.430848] Call Trace:
[    0.430889]  <TASK>
[    0.430925]  dump_stack_lvl+0x37/0x50
[    0.431020]  dump_stack+0x10/0x20
[    0.431087]  panic+0x227/0x310
[    0.431167]  mount_root_generic+0x183/0x2b0
[    0.431234]  ? x64_sys_call+0x730/0x2010
[    0.431301]  mount_root+0x8f/0xe0
[    0.431361]  prepare_namespace+0x5e/0x270
[    0.431426]  ? srso_return_thunk+0x5/0x5f
[    0.431487]  kernel_init_freeable+0x132/0x160
[    0.431562]  ? __pfx_kernel_init+0x10/0x10
[    0.431617]  kernel_init+0x15/0x1a0
[    0.431666]  ret_from_fork+0x37/0x60
[    0.431720]  ? __pfx_kernel_init+0x10/0x10
[    0.431802]  ret_from_fork_asm+0x1b/0x30
[    0.431872]  </TASK>
[    0.432043] Kernel Offset: disabled
slp commented 3 months ago

Looks like the kernel in libkrunfw was built without virtiofs support. Did you attempt to change the kernel's config when building libkrunfw?

aFuerst commented 3 months ago

That was the problem. I had to manually set CONFIG_FUSE_FS=y and CONFIG_VIRTIO_FS=y in the libkrunfw kernel config. Boots like a charm! Thank you