latest changes

logs path set to /opt; fix script path; fix amd_iommut=pt; fix USB 3.0
This commit is contained in:
lukas 2022-01-11 15:15:45 +01:00
parent 7f3c5d9f30
commit b28694caa0
4 changed files with 94 additions and 208 deletions

View File

@ -37,7 +37,7 @@ part /boot/efi --fstype="efi" --size=128 --fsoptions="umask=0077,shortname=winnt
part /boot --fstype="ext4" --size=384 --label=boot part /boot --fstype="ext4" --size=384 --label=boot
part / --fstype="ext4" --grow --label=root part / --fstype="ext4" --grow --label=root
%post --logfile=/root/b.log %post --logfile=/opt/base.log
localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked. localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked.
dnf update -y # Update the system dnf update -y # Update the system
@ -177,8 +177,7 @@ glib-compile-schemas /mnt/sysimage/usr/share/glib-2.0/schemas/
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bh.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor.log
# %post --log=/root/bh.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 # 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" > /mnt/sysimage/etc/modules-load.d/vfio.conf
@ -188,57 +187,27 @@ echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf
mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso and store it to the newly created iso directory
# fetch custom script and make it executable # fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/create-user-vms.sh -P /mnt/sysimage/usr/sbin/ wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-user-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh
# fetch custom script and make it executable # fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/virtualization-tweaks-root-needed.sh -P /mnt/sysimage/usr/sbin/ wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-system-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-system-vms.sh
# 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/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
# # Create new file /etc/systemd/system/postinstall.service using cat:
# cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF
# [Unit]
# Description=Post-installation configuration for Phyllome OS
# After=gdm.service
# Requires=gdm.service
#
# [Service]
# Type=oneshot
# ExecStart=/bin/bash /usr/sbin/post-install.sh
# RemainAfterExit=yes
#
# [Install]
# WantedBy=multi-user.target
# EOF
#
# systemctl enable /mnt/sysimage/etc/systemd/system/post-install.service # Enable systemd unit
# Add a network bridge. Still need to declare it to libvirt/virt-manager
# nmcli con add ifname br0 type bridge con-name br0
# nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device
# nmcli con up br0
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bha.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-amdcpu.log
sed -i 's/\(quiet\)/\1 amd_iommu=on amd_iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB. sed -i 's/\(quiet\)/\1 amd_iommu=on iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB.
echo "options kvm_amd nested=1" >> /etc/modprobe.d/kvm.conf # Add support for nested-virtualization echo "options kvm_amd nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization
# The following part seems useless
# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd " --force # Instruct dracut to load the vfio drivers
# dracut --force # Regenerate initramfs
# Doesn't seem to work
# dracut: Cannot find /usr/lib/dracut/dracut-init.sh.
# dracut: Are you running from a git checkout?
# dracut: Try passing -l as an argument to /mnt/sysimage/usr/bin/dracut
# The following part seems useless too. No need to regenerate grub
# grub2-mkconfig -o /mnt/sysimage/boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'.
%end %end
@ -271,6 +240,7 @@ gnome-shell
gnome-terminal gnome-terminal
guestfs-tools guestfs-tools
libguestfs-tools libguestfs-tools
libusb
libvirt libvirt
libvirt-daemon-config-network libvirt-daemon-config-network
libvirt-daemon-kvm libvirt-daemon-kvm
@ -280,6 +250,7 @@ neofetch
pciutils pciutils
python3-libguestfs python3-libguestfs
qemu-kvm qemu-kvm
usbutils
virt-install virt-install
virt-manager virt-manager
virt-top virt-top

View File

@ -37,7 +37,7 @@ part /boot/efi --fstype="efi" --size=128 --fsoptions="umask=0077,shortname=winnt
part /boot --fstype="ext4" --size=384 --label=boot part /boot --fstype="ext4" --size=384 --label=boot
part / --fstype="ext4" --grow --label=root part / --fstype="ext4" --grow --label=root
%post --logfile=/root/b.log %post --logfile=/opt/base.log
localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked. localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked.
dnf update -y # Update the system dnf update -y # Update the system
@ -177,8 +177,7 @@ glib-compile-schemas /mnt/sysimage/usr/share/glib-2.0/schemas/
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bh.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor.log
# %post --log=/root/bh.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 # 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" > /mnt/sysimage/etc/modules-load.d/vfio.conf
@ -188,65 +187,37 @@ echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf
mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso and store it to the newly created iso directory
# fetch custom script and make it executable # fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/create-user-vms.sh -P /mnt/sysimage/usr/sbin/ wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-user-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh
# fetch custom script and make it executable # fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/virtualization-tweaks-root-needed.sh -P /mnt/sysimage/usr/sbin/ wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-system-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-system-vms.sh
# 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/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
# # Create new file /etc/systemd/system/postinstall.service using cat:
# cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF
# [Unit]
# Description=Post-installation configuration for Phyllome OS
# After=gdm.service
# Requires=gdm.service
#
# [Service]
# Type=oneshot
# ExecStart=/bin/bash /usr/sbin/post-install.sh
# RemainAfterExit=yes
#
# [Install]
# WantedBy=multi-user.target
# EOF
#
# systemctl enable /mnt/sysimage/etc/systemd/system/post-install.service # Enable systemd unit
# Add a network bridge. Still need to declare it to libvirt/virt-manager
# nmcli con add ifname br0 type bridge con-name br0
# nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device
# nmcli con up br0
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bhi.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-intelcpu.log
sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /mnt/sysimage/etc/default/grub # Load kernel modules in grub. sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB.
# 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
echo "kvmgt" > /mnt/sysimage/etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /mnt/sysimage/etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "options kvm_intel nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization echo "options kvm_intel nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization
# The following part seems useless %end
# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers
# dracut --force # Regenerate initramfs
# Doesn't seem to work
# dracut: Cannot find /usr/lib/dracut/dracut-init.sh.
# dracut: Are you running from a git checkout?
# dracut: Try passing -l as an argument to /mnt/sysimage/usr/bin/dracut
# The following part seems useless too. No need to regenerate grub %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-intelgpu.log
# grub2-mkconfig -o /mnt/sysimage/boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'.
sed -i 's/\(vfio-pci\)/\1 i915.enable_gvt=1/i' /mnt/sysimage/etc/default/grub # Load kernel modules in grub.
# Load extra kernel modules to enable vfio-mdev on selected hardware
echo "kvmgt" > /mnt/sysimage/etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /mnt/sysimage/etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
%end %end
@ -279,6 +250,7 @@ gnome-shell
gnome-terminal gnome-terminal
guestfs-tools guestfs-tools
libguestfs-tools libguestfs-tools
libusb
libvirt libvirt
libvirt-daemon-config-network libvirt-daemon-config-network
libvirt-daemon-kvm libvirt-daemon-kvm
@ -288,6 +260,7 @@ neofetch
pciutils pciutils
python3-libguestfs python3-libguestfs
qemu-kvm qemu-kvm
usbutils
virt-install virt-install
virt-manager virt-manager
virt-top virt-top

View File

@ -37,7 +37,7 @@ part /boot/efi --fstype="efi" --size=128 --fsoptions="umask=0077,shortname=winnt
part /boot --fstype="ext4" --size=384 --label=boot part /boot --fstype="ext4" --size=384 --label=boot
part / --fstype="ext4" --grow --label=root part / --fstype="ext4" --grow --label=root
%post --logfile=/root/b.log %post --logfile=/opt/base.log
localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked. localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked.
dnf update -y # Update the system dnf update -y # Update the system
@ -45,53 +45,7 @@ grub2-mkconfig -o /boot/grub2/grub.cfg # Unsure it is actually useful
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bh.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor.log
# %post --log=/root/bh.log # Beginning of %post section. Those commands are executed outside the chroot environment. Logging is enabled to help with post-installation troubleshooting
mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/configure-vmm-and-desktop.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/configure-vmm-and-desktop.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/create-live-vm.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-live-vm.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/virtualization-tweaks-root-needed.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
# # Create new file /etc/systemd/system/postinstall.service using cat:
# cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF
# [Unit]
# Description=Post-installation configuration for Phyllome OS
# After=gdm.service
# Requires=gdm.service
#
# [Service]
# Type=oneshot
# ExecStart=/bin/bash /usr/sbin/post-install.sh
# RemainAfterExit=yes
#
# [Install]
# WantedBy=multi-user.target
# EOF
#
# systemctl enable /mnt/sysimage/etc/systemd/system/post-install.service # Enable systemd unit
# Add a network bridge. Still need to declare it to libvirt/virt-manager
# nmcli con add ifname br0 type bridge con-name br0
# nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device
# nmcli con up br0
%end
%post --nochroot --logfile=/mnt/sysimage/root/bha.log
sed -i 's/\(quiet\)/\1 amd_iommu=on amd_iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd # 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" > /mnt/sysimage/etc/modules-load.d/vfio.conf
@ -99,18 +53,29 @@ 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_iommu_type1" > /mnt/sysimage/etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf
echo "options kvm_amd nested=1" >> /etc/modprobe.d/kvm.conf # Add support for nested-virtualization mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
# The following part seems useless wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso and store it to the newly created iso directory
# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd " --force # Instruct dracut to load the vfio drivers
# dracut --force # Regenerate initramfs
# Doesn't seem to work
# dracut: Cannot find /usr/lib/dracut/dracut-init.sh.
# dracut: Are you running from a git checkout?
# dracut: Try passing -l as an argument to /mnt/sysimage/usr/bin/dracut
# The following part seems useless too. No need to regenerate grub # fetch custom script and make it executable
# grub2-mkconfig -o /mnt/sysimage/boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'. wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-user-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-system-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-system-vms.sh
# 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/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
%end
%post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-amdcpu.log
sed -i 's/\(quiet\)/\1 amd_iommu=on iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB.
echo "options kvm_amd nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization
%end %end
@ -125,6 +90,7 @@ generic-release-notes
guestfs-tools guestfs-tools
initial-setup initial-setup
libguestfs-tools libguestfs-tools
libusb
libvirt libvirt
libvirt-daemon-config-network libvirt-daemon-config-network
libvirt-daemon-kvm libvirt-daemon-kvm
@ -133,6 +99,7 @@ neofetch
pciutils pciutils
python3-libguestfs python3-libguestfs
qemu-kvm qemu-kvm
usbutils
virt-install virt-install
virt-top virt-top
wget wget

View File

@ -37,7 +37,7 @@ part /boot/efi --fstype="efi" --size=128 --fsoptions="umask=0077,shortname=winnt
part /boot --fstype="ext4" --size=384 --label=boot part /boot --fstype="ext4" --size=384 --label=boot
part / --fstype="ext4" --grow --label=root part / --fstype="ext4" --grow --label=root
%post --logfile=/root/b.log %post --logfile=/opt/base.log
localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked. localectl set-keymap ch-fr # Set keymap to `ch-fr`. Alternatively, `us` can be picked.
dnf update -y # Update the system dnf update -y # Update the system
@ -45,74 +45,47 @@ grub2-mkconfig -o /boot/grub2/grub.cfg # Unsure it is actually useful
%end %end
%post --nochroot --logfile=/mnt/sysimage/root/bh.log %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor.log
# %post --log=/root/bh.log # Beginning of %post section. Those commands are executed outside the chroot environment. Logging is enabled to help with post-installation troubleshooting
mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/configure-vmm-and-desktop.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/configure-vmm-and-desktop.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/create-live-vm.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-live-vm.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post/virtualization-tweaks-root-needed.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
# # Create new file /etc/systemd/system/postinstall.service using cat:
# cat > /mnt/sysimage/etc/systemd/system/post-install.service<< EOF
# [Unit]
# Description=Post-installation configuration for Phyllome OS
# After=gdm.service
# Requires=gdm.service
#
# [Service]
# Type=oneshot
# ExecStart=/bin/bash /usr/sbin/post-install.sh
# RemainAfterExit=yes
#
# [Install]
# WantedBy=multi-user.target
# EOF
#
# systemctl enable /mnt/sysimage/etc/systemd/system/post-install.service # Enable systemd unit
# Add a network bridge. Still need to declare it to libvirt/virt-manager
# nmcli con add ifname br0 type bridge con-name br0
# nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device
# nmcli con up br0
%end
%post --nochroot --logfile=/mnt/sysimage/root/bhi.log
sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /mnt/sysimage/etc/default/grub # Load kernel modules in grub.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd # 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" > /mnt/sysimage/etc/modules-load.d/vfio.conf
echo "vfio-pci" > /mnt/sysimage/etc/modules-load.d/vfio-pci.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_iommu_type1" > /mnt/sysimage/etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf echo "vfio_virqfd" > /mnt/sysimage/etc/modules-load.d/vfio_virqfd.conf
echo "kvmgt" > /mnt/sysimage/etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /mnt/sysimage/etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm) mkdir /mnt/sysimage/var/lib/libvirt/iso # Create a directory to store iso images
wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /mnt/sysimage/var/lib/libvirt/iso/ # fetch netboot.xyz iso and store it to the newly created iso directory
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-user-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-user-vms.sh
# fetch custom script and make it executable
wget https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/post-first-startup-scripts/create-system-vms.sh -P /mnt/sysimage/usr/sbin/
chmod +x /mnt/sysimage/usr/sbin/create-system-vms.sh
# 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/sbin/
chmod +x /mnt/sysimage/usr/sbin/virtualization-tweaks-root-needed.sh
%end
%post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-intelcpu.log
sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci/i' /mnt/sysimage/etc/default/grub # Load kernel modules in GRUB.
echo "options kvm_intel nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization echo "options kvm_intel nested=1" >> /mnt/sysimage/etc/modprobe.d/kvm.conf # Add support for nested-virtualization
# The following part seems useless %end
# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers
# dracut --force # Regenerate initramfs
# Doesn't seem to work
# dracut: Cannot find /usr/lib/dracut/dracut-init.sh.
# dracut: Are you running from a git checkout?
# dracut: Try passing -l as an argument to /mnt/sysimage/usr/bin/dracut
# The following part seems useless too. No need to regenerate grub %post --nochroot --logfile=/mnt/sysimage/opt/base-hypervisor-intelgpu.log
# grub2-mkconfig -o /mnt/sysimage/boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'.
sed -i 's/\(vfio-pci\)/\1 i915.enable_gvt=1/i' /mnt/sysimage/etc/default/grub # Load kernel modules in grub.
# Load extra kernel modules to enable vfio-mdev on selected hardware
echo "kvmgt" > /mnt/sysimage/etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /mnt/sysimage/etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
%end %end
@ -127,6 +100,7 @@ generic-release-notes
guestfs-tools guestfs-tools
initial-setup initial-setup
libguestfs-tools libguestfs-tools
libusb
libvirt libvirt
libvirt-daemon-config-network libvirt-daemon-config-network
libvirt-daemon-kvm libvirt-daemon-kvm
@ -135,6 +109,7 @@ neofetch
pciutils pciutils
python3-libguestfs python3-libguestfs
qemu-kvm qemu-kvm
usbutils
virt-install virt-install
virt-top virt-top
wget wget