Skip to content

Conversation

@nohajc
Copy link
Contributor

@nohajc nohajc commented Jul 25, 2025

I was playing with different VM configurations and was able to run a system from a raw disk image instead of virtiofs.
It basically works, I just need a custom cmdline and an actual copy of init.krun on the image filesystem.

The only issue is that init assumes root is always virtiofs and uses the KRUN_EXIT_CODE_IOCTL which will fail.
To avoid the error on conventional filesystems, we can first call statfs and check f_type.

@nohajc nohajc force-pushed the exit-code-ioctl-check branch 2 times, most recently from cd81951 to 7298634 Compare July 25, 2025 19:17
@nohajc nohajc marked this pull request as draft July 25, 2025 19:23
@ggoodman
Copy link
Contributor

@nohajc not related to reviewing this PR, but if you have any examples of your setup to boot from an image it would be a valuable resource to share with the community 😄.

@nohajc
Copy link
Contributor Author

nohajc commented Jul 25, 2025

@ggoodman Sure, my setup is very crude at this point. Just a couple of shell scripts to prepare the root filesystem and a lua script to interact with the C API. I also have a project built on top of libkrun but that's in Rust. Now I'm basically trying to make the microVMs scriptable but without using krunvm. I was definitely planning to share my results.

Signed-off-by: Jan Noha <nohajc@gmail.com>
@nohajc nohajc force-pushed the exit-code-ioctl-check branch 2 times, most recently from 857f047 to 5f2e3cd Compare July 25, 2025 21:03
@nohajc
Copy link
Contributor Author

nohajc commented Jul 25, 2025

@ggoodman I've seen your krun_set_rootfs_kernel_args pull request. The reason it works for me is that I already use a custom kernel image (krun_set_kernel) which lets me specify the entire kernel command line too.

Could be something like this

reboot=k panic=-1 panic_print=0 nomodule console=hvc0 root=/dev/vda rw quiet no-kvmapf init=/init.krun KRUN_INIT=/bin/bash KRUN_WORKDIR=/

@nohajc nohajc marked this pull request as ready for review July 25, 2025 21:09
@nohajc
Copy link
Contributor Author

nohajc commented Jul 26, 2025

@ggoodman You can check out my setup here:
https://github.com/nohajc/anylinuxfs/tree/main/kernel-builder

Copy link
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@slp slp merged commit 9b8e9eb into containers:main Jul 31, 2025
10 of 11 checks passed
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.

3 participants