Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Qemu: with guest root on 9p / kernel params?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3536

PostPosted: Sat Mar 01, 2025 9:23 pm    Post subject: Qemu: with guest root on 9p / kernel params? Reply with quote

I want to put VM guest root on 9p because reasons.
Using direct boot, optionally dracut initramfs (shouldn't be required though), and virtio-9p to pass an FS from host to guest.
What params should I put on kernel boot line to get it to work?

9p is compiled in the kernel, and I can mount the fs inside dracut, with:
mount /9proot -t 9p /sysroot
but when I boot it with those options on kernel command line:
root=/9proot rootfstype=9p
dmesg reports "dracut: don't know how to handle root=/9proot" (or just kernel panic due to missing root if I go without initramfs).
Either way, looks like I've got all the pieces, but somehow they just don't click together. Any ideas?
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5460
Location: Bavaria

PostPosted: Sat Mar 01, 2025 10:43 pm    Post subject: Reply with quote

One possibility would of course be to create a bug report for dracut.

But if it is urgent, you can unpack the intramfs-image (which dracut has created) again and manually enter the mount of 9p in the init-srcipt (then pack it again and move it back to the old place). Helpful links:
Extracting: https://wiki.gentoo.org/wiki/Custom_Initramfs#Extracting_the_cpio_archive
Building from extracted pieces: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview#External_CPIO_archive_with_a_directory
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3536

PostPosted: Sat Mar 01, 2025 11:22 pm    Post subject: Reply with quote

Well, it is true I could just modify that initramfs, but I don't really think dracut is at fault here. I actually only put it there to help me figure out how to use 9p, and now that I've figured it out, I'd be perfectly happy to ditch it.
Root and rootfstype are kernel parameters, I pulled them from kernel's docs. I though they'd be enough for kernel to mount the actual root without going through initramfs in the first place, but no dice.



Edit: Ok, so the first problem was that root must be /dev/root.
Funny, I think I used to put /dev/hda2 back in the days.... I wonder if it's 9p thing or has this been abandoned. Anyway; gotta figure out why it can't run init now that it finally finds it...
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3536

PostPosted: Sun Mar 02, 2025 3:46 pm    Post subject: Reply with quote

Alright, I think I've got it, after converting permissions to xattrs it looks like it's going to work (qemu running as an unprivileged user, so has to use some fakeroot tricks).
So, if anyone wanted to put guest's root on 9p, this particular device must be named /dev/root and then initramfs is not required. Other mountpoints don't have this restriction.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum