Files
phyllomeos/ingredients/base-hypervisor.cfg
2025-07-13 20:53:21 +02:00

53 lines
3.5 KiB
INI

services --enabled="NetworkManager,systemd-resolved,libvirtd" # Without libvirtd here, it appears the service won't automatically start
%packages --exclude-weakdeps # Beginning of the packages section. Does not include weak dependencies.
qemu-kvm # QEMU metapackage for KVM support
libvirt # Library providing a simple virtualization API
libvirt-client # Client side utilities of the libvirt library
libvirt-client-qemu # Additional client side utilities for QEMU. Used to interact with some QEMU specific features of libvirt.
libvirt-daemon # Server side daemon and supporting files for libvirt library
libvirt-daemon-common # Miscellaneous files and utilities used by other libvirt daemons
libvirt-daemon-config-network # Default configuration files for the libvirtd daemon. Provides NAT based networking
libvirt-daemon-driver-interface # Interface driver plugin for the libvirtd daemon
libvirt-daemon-driver-network # The network driver plugin for the libvirtd daemon, providing an implementation of the virtual network APIs using the Linux bridge capabilities.
libvirt-daemon-driver-qemu # QEMU driver plugin for the libvirtd daemon
libvirt-daemon-kvm # Server side daemon & driver required to run KVM guests
libvirt-daemon-log # Server side daemon for managing logs
libvirt-daemon-qemu # Server side daemon and driver required to manage the virtualization capabilities of the QEMU TCG emulators
libvirt-nss # Libvirt plugin for Name Service Switch
libvirt-dbus # libvirt D-Bus API binding
libvirt-daemon-driver-ch # Cloud-Hypervisor driver plugin for libvirtd daemon
virt-install # Utilities for installing virtual machines
%end # End of the packages section
%post --nochroot --log=/mnt/sysimage/root/base-hypervisor.log # Beginning of %post section. Those commands are executed outside the chroot environment. Logging is enabled to help with post-installation troubleshooting
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd
echo "vfio" > /mnt/sysimage/etc/modules-load.d/vfio.conf
echo "vfio-pci" > /mnt/sysimage/etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /mnt/sysimage/etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf
mkdir /mnt/sysimage/var/lib/libvirt/isos # Create a directory to store iso images. SELinux is already taking this one into account.
# wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/isos/ # fetch netboot.xyz iso and store it to the newly created iso directory
# # virsh commands fail in a kickstart environment (chroot or not it seems). would need to fetch a script and execute post-launch with a delay, for example using a systemd unit
# virsh pool-define-as isos dir - - - - /mnt/sysimage/var/lib/libvirt/isos/ # Make libvirt aware of this new directory by creating a so-called 'pool'.
# virsh pool-build isos # Build the pool
# virsh pool-start isos # Start it
# virsh pool-autostart isos # Set-it to autostart
# fetch custom script and make it executable
# wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/virtualization-tweaks-root-needed.sh -P /mnt/sysimage/usr/local/bin/
# chmod +x /mnt/sysimage/usr/local/bin/virtualization-tweaks-root-needed.sh
# wget https://raw.githubusercontent.com/PhyllomeOS/xml-definition-for-domains/main/xml/system/linux.xml
# virsh define linux.xml
# wget https://raw.githubusercontent.com/PhyllomeOS/xml-definition-for-domains/main/xml/system/windows.xml
# virsh define windows.xml
%end # End of the %post section