This is a short guide on getting started with running a Serpent VM using virtiofs as the rootfs. The benefit of this is that the Serpent root is essentially just a folder on your host machine. You are completely unrestricted in using host tools/editors on the Serpent root even while the virtual machine is running. You can also start a systemd-nspawn container from the same root for when you want to be developing SerpentOS but don't need to be testing the full kernel/boot stack (though I would advise you not to run a systemd-nspawn container at the same time you have a VM booted, if it works at all it's likely to lead to corruption).
This guide uses virt-manager because it automatically manages virtiofsd on the host for you. You can do all of these steps without it but you're going to need to figure out the exact CLI syntax and/or XML config syntax to make everything happy.
Make the Serpent root (adjust paths as desired)
sudo mkdir /mnt/serpent # This folder MUST be owned by root otherwise a bunch of things in systemd error out
sudo moss -D /mnt/serpent ar volatile https://dev.serpentos.com/volatile/x86_64/stone.index -p10
# If you intend to install local packages:
sudo moss -D /mnt/serpent ar local file:///var/cache/boulder/collections/local-x86_64/stone.index -p20
Initial packages (adjust to your liking)
sudo moss -D /mnt/serpent it moss systemd coreutils util-linux nss dash bash dbus dbus-broker nano which shadow file git grep gzip less procps python screen sed unzip vim wget openssh iproute2 inetutils sudo vim linux-kvm
Networking workaround (until glibc gets fixed)
sudo cp -va /etc/protocols /mnt/serpent/etc/
Until you do the above, you won't be able to e.g. use
ping from within your VM instance.
Set up virt-manager virtual machine instance
Once that is done open virt-manager and select "New Virtual Machine"
Choose Manual install:
Search for and select "Generic Linux 2020" (if your distribution ships a "Generic Linux 2022" profile you can use that instead)
The default of 2 CPU cores and 4GB of memory is probably sufficient for initial testing though you can certainly adjust these to your liking.
Uncheck "Enable storage for this virtual machine" (Where we're going we don't need storage).
Name the VM something like "Serpent-BIOS" as for now we're going to be using BIOS as UEFI does not currently work. In the future UEFI will be the only supported option. Also check "Customize configuration before install" and if you like you can edit the network configuration now or go with the default NAT setting.
The configuration screen for the VM will appear. In this initial window make sure "Firmware" is set to "BIOS". After each setting you change make sure you hit "Apply" to save that setting.
Select "Boot Options". Expand "Direct kernel boot" and check "Enable direct kernel boot". Now, you'll need the paths to the initrd and kernel, both of these can be found in the
usr/lib/kernel folder under your Serpent root. In my case the kernel path is
/mnt/serpent/usr/lib/kernel/com.serpentos.kvm.6.1.0-4 and the initrd is
/mnt/serpent/usr/lib/kernel/initrd-com.serpentos.kvm.6.1.0-4. Note that you will need to update these every time the kernel is updated (this is only a temporary measure until we have a bootloader). For kernel args put in
rootfstype=virtiofs root=root rw quiet loglevel=3
Click the Video option on the left. Change the model to "Virtio" and make sure "3D acceleration" is enabled.
Go to the Display option. Make sure the Type is
Spice server, Listen type is
None, and OpenGL is selected. In case you have multiple GPUs (i.e. integrated + discrete), make sure you select the one that is powering your display.
Under the NIC section make sure Device model is set to
virtio (it's normal for IP address to be "unknown" now, the VM isn't started).
Under Memory make sure that "Enable shared memory" is enabled (IMPORTANT, virtiofs won't work without this!!)
Now, let's setup the virtiofs mount. Click "Add Hardware", then select "Filesystem" from the available types. Make sure the Driver is
virtiofs, put in your serpent root path as "Source path", and put in
root for the "Target path" (this NEEDS to match the value you put in
root= in the kernel arguments). Click finish to go back to the previous screen.
You should now have everything configured. Select "Begin installation" and assuming everything is working correctly you should be greeted with a running VM window:
Note that you can delete and re-create the serpent root and do not need to delete and recreate the VM.