Help with OVMF, Void Linux

So heres hoping I have everything right this time.

I’m following this guide: https://forum.nixhaven.com/index.php?threads/vfio-guide-of-2020-intel-nvidia-with-all-major-distro-support.1/

I’m up to OVMF actually. I don’t know how to install it on void linux? Theres no src package… and nothing in repo?

Thx for any info?

Also random second question. If I were to get something like a single slot 9800GT and put it in my 3rd X16 slot, using it for display, could I use both my GTX970 and RX480 in VM’s? Or could I use the 9800 as a display card and accelerate with another card?

thx

What’s the issue? Is that the problem where you can’t boot a Void Linux VM in UEFI mode?

As for the PCI-E Passthrough, it depends on your motherboard’s IOMMU groups (ie PCI-E group splitting).

Edit: Talk about projection, I was thinking of my own issues (I’m tired, mkay?). So you want to make a VM under Void and passthrough some GPUs. You should only need to

sudo xbps-install -S libvirt qemu virt-manager virt-manager-tools
It seems other people encountered some issue regarding OVMF here. I will try to see if I can help tomorow. Unfortunately I haven’t used libvirt on Void, when I switched over, I split my host (ex-Manjaro user) and VM (W10) into 2 PCs, because of lack of resources (I got 2 low-power consumption PCs, not 1 big, fat, multicore PC).

Heres my specs: https://pcpartpicker.com/list/NDJ8Xb

I specifically got the Ultra Gaming because I knew it was reported to have some of the best IOMMU groupings. I looked up to see if it could do a 3900X, could without turbo, and I decided I was good with that till the 600 or 700 series chipsets were out and I’d do an upgrade around then when IOMMU was like rock solid. Right now I’m doing fine without turbo and the thing runs great, and I have proper IOMMU groups for everything. Each GPU has a separate group.

idk I just know I need help

Sorry for the late reply, didn’t feel like doing anything the previous days. I just finished testing / working around / making libvirt able to detect OVMF/UEFI. Took me around 2 hours or so (researching, testing and documenting it altogether, I should probably do a Wiki post/entry on L1 Forum, but fugg me, I’m too lazy). Here we go:

So, first things first:
sudo xbps-install -S libvirt qemu virt-manager virt-manager-tools

If you have libvirtd and virtlogd running, kill them:
sudo sv d libvirtd
sudo sv d virtlogd

(inserting random emoji to make this wall-of-text more readable)

:face_with_raised_eyebrow:

According to those steps here: https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF , we should download 3 1 rpm packages from under jenkins/edk2 and decrompress them it:

(apparently, you only need the edk2.git-ovmf package - MAKE SURE YOU DOWNLOAD IT FOR YOUR ARCHITECTURE, though since you are running a 3900X, I doubt you are running anything except Void x86_64-gcc/musl)

Fortunately, there is a script in the Void repo which helps us do just that:

sudo xbps-install -S rpmextract
rpmextract edk2.git-ovmf-x64-0-20201222.1538.g014b9850f2.noarch.rpm

Make sure it extracted correctly (note: you should still be in your home or Downloads folder, wherever you got the rpm)
ls -alh usr/share/edk2.git/ovmf-x64/

Verify this image can be used:
qemu-system-x86_64 -bios usr/share/edk2.git/ovmf-x64/OVMF-pure-efi.fd

You should be seeing a Tianocore boot screen and maybe it trying a PXE boot. Exit this screen and rename the folders:

mv usr/share/edk2.git/ usr/share/ovmf
mv usr/share/ovmf/ovmf-x64 usr/share/ovmf/x64

Copy some files around

cp usr/share/ovmf/x64/OVMF_CODE-pure-efi.fd usr/share/ovmf/x64/OVMF_CODE.fd
cp usr/share/ovmf/x64/OVMF_VARS-pure-efi.fd usr/share/ovmf/x64/OVMF_VARS.fd
cp usr/share/ovmf/x64/OVMF-pure-efi.fd usr/share/ovmf/x64/OVMF.fd

:thinking:

Copy the folder in /usr/share
sudo cp -r usr/share/ovmf /usr/share/

Create /etc/qemu/firmware
sudo mkdir -p /etc/qemu/firmware

Add this config in /etc/qemu/firmware/60-ovmf-x86_64.json:

60-ovmf-x86_64.json
{
    "description": "UEFI OVMF firmware for x86_64",
    "interface-types": [
        "uefi"
    ],
    "mapping": {
        "device": "flash",
        "executable": {
            "filename": "/usr/share/ovmf/x64/OVMF_CODE.fd",
            "format": "raw"
        },
        "nvram-template": {
            "filename": "/usr/share/ovmf/x64/OVMF_VARS.fd",
            "format": "raw"
        }
    },
    "targets": [
        {
            "architecture": "x86_64",
            "machines": [
                "pc-i440fx-*",
                "pc-q35-*"
            ]
        }
    ],
    "features": [
        "acpi-s3",
        "amd-sev",
        "verbose-dynamic"
    ],
    "tags": [

    ]
}

Enable libvirtd and virtlogd:

sudo ln -s /etc/sv/libvirtd /etc/runit/runsvdir/default/
sudo ln -s /etc/sv/virtlogd /etc/runit/runsvdir/default/

If you had those already, start them daemons you killed at the begining:
sudo sv u libvirtd
sudo sv u virtlogd

Make sure they are up:
sudo sv status libvirtd
sudo sv status virtlogd

Add your user to libvirt group:

sudo usermod -a -G libvirt {ur username} bro ehm… sibling*

Virt-Manager should now detect UEFI/OVMF now when creating a new VM with custom config, or when editing existing VM config. This has been tested on an ASRock J3455M running a void-x86_64-musl build. I created a generic OS VM (custom settings) with q35 and UEFI, added a virtual CD-ROM and booted into an alpine-linux iso. Worked fine for the 20 seconds I tested it. Hope I have not missed any steps.

If I made grammar errors, well, I’m too lazy to look through this tutorial again. In any case, I hope this works, I like helping the few Void users on this forum however I can (I am a noob myself, but I am proud of my web searching skills).

1 Like

Sources:

https://github.com/tianocore/edk2/tree/master
https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF
https://fabianlee.org/2018/09/12/kvm-building-the-latest-ovmf-firmware-for-virtual-machines/
https://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html
https://bbs.archlinux.org/viewtopic.php?id=162768
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Setting_up_an_OVMF-based_guest_VM
https://www.reddit.com/r/VFIO/comments/djp7ko/ovmf_image_not_detected_in_libvirt_virtmanager/f48bysi/
https://bugs.archlinux.org/task/64175

And then I can easily pass a card?

I think I screwed up the /usr/share stuff. I’ll have to fiddle more with it tomorrow.

For passing the card, you need to fiddle with modprobe
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Binding_vfio-pci_via_device_ID

Remember to first fiddle with IOMMU groups and note all the devices from your IOMMU group you want to pass (e.g. a GPU also has an audio device with it, like in group 13 in this arch wiki):
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Setting_up_IOMMU
Also, you may want to pass a USB port and use a hub to plug a keyboard, mouse and maybe a controller if you are into that.

Since we don’t have Arch, neither mkinitcpio, we can use Wendell’s Fedora guide to mess just with the grub and dracut part:

After all that is done, In the VM configuration you don’t have to mess with the cores you give it, but you can for some extra tuning.

Since you also have an nVidia card that you probably want to passthrough, you should also check this topic:

1 Like

@Jari has this issue been solved? Did you have the time and energy to test it? If so, we can mark it as solved. :man_shrugging: Otherwise, we could look further.

Actually I temporarily abandoned void because I ended up booking the system on accident. I’m currently on pop testing things when I have the time.

I’ve ended up with a 9800gt single slot card for my display. I think it’ll work, it’s just gnome hates it. I plan to use i3 with the final system the so it should be fine as long as gtk applications don’t get too crazy.

Rn tho I’m trying to test hardware to just make sure my plan will actually work. I can actually see what I was doing wrong before, and now I’m ready to get it working in pop. But I’ve recently picked up 3 jobs to pay car repairs, bills, and to move asap, so this might be on hold for a while. I’m more enamoured with my new phone.

Granted the oneplus n10 is pretty cool for 300 bucks. Gunna go write a short review rq.

1 Like

Sorry to necromance this thread, but sometime, with Void, it is needed.

Thank You Biky, I could not find this info anywhere else…
I am changing up the program refractasnapshot to make live a ISO of a running Void system. This I got working and got said ISO to boot in virt-manager.
I wanted the EFI boot so I can bare metal boot a vm with Ventoy and/or Vdiskchain and rEFInd.
Thank You, again

1 Like