Skip to content

Commit 79146b8

Browse files
authored
fix: Correctly apply vfio after initramfs changes (#987)
* fix: replace enable/disable action with virt-on/off also fixed the heredoc for looking-glass shm * chore: update initramfs command when enabling vfio
1 parent deed0b4 commit 79146b8

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

system_files/desktop/shared/usr/share/ublue-os/just/84-bazzite-virt.just

+10-11
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ setup-virtualization ACTION="":
2020
if [ "$OPTION" == "help" ]; then
2121
echo "Usage: ujust configure-grub <option>"
2222
echo " <option>: Specify the quick option to skip the prompt"
23-
echo " Use 'enable' to select Enable Virtualization"
24-
echo " Use 'disable' to select Disable Virtualization"
23+
echo " Use 'virt-on' to select Enable Virtualization"
24+
echo " Use 'virt-off' to select Disable Virtualization"
2525
echo " Use 'group' to select Add $USER to libvirt group"
2626
echo " Use 'vfio-on' to select Enable VFIO drivers"
2727
echo " Use 'vfio-off' to select Disable VFIO drivers"
@@ -40,7 +40,7 @@ setup-virtualization ACTION="":
4040
"Autocreate Looking-Glass shm" \
4141
)
4242
fi
43-
if [[ "${OPTION,,}" =~ ^enable(|[[:space:]]virtualization) ]]; then
43+
if [[ "${OPTION,,}" =~ (^enable[[:space:]]virtualization|virt-on) ]]; then
4444
virt_test=$(rpm-ostree status | grep -A 4 "●" | grep "virt-manager")
4545
if [[ -z ${virt_test} ]]; then
4646
echo "Installing QEMU and virt-manager..."
@@ -50,7 +50,7 @@ setup-virtualization ACTION="":
5050
--append-if-missing="kvm.report_ignored_msrs=0"
5151
echo 'Please re-run "ujust setup-virtualization" after the reboot to enable libvirtd service'
5252
fi
53-
elif [[ "${OPTION,,}" =~ ^disable(|[[:space:]]virtualization) ]]; then
53+
elif [[ "${OPTION,,}" =~ (^disable[[:space:]]virtualization|virt-off) ]]; then
5454
virt_test=$(rpm-ostree status | grep -A 4 "●" | grep "virt-manager")
5555
if [[ ${virt_test} ]]; then
5656
if [ "$(systemctl is-enabled libvirtd.service)" == "enabled" ]; then
@@ -76,7 +76,7 @@ setup-virtualization ACTION="":
7676
VENDOR_KARG="unset"
7777
if [[ ${VIRT_TEST} == *kvm.report_ignored_msrs* ]]; then
7878
echo 'add_drivers+=" vfio vfio_iommu_type1 vfio-pci "' | sudo tee /etc/dracut.conf.d/vfio.conf
79-
sudo touch /etc/bazzite/initramfs/rebuild
79+
rpm-ostree initramfs --enable
8080
if [[ ${CPU_VENDOR} == "AuthenticAMD" ]]; then
8181
VENDOR_KARG="amd_iommu=on"
8282
elif [[ ${CPU_VENDOR} == "GenuineIntel" ]]; then
@@ -118,8 +118,7 @@ setup-virtualization ACTION="":
118118
fi
119119
echo "Removing dracut modules"
120120
sudo rm /etc/dracut.conf.d/vfio.conf
121-
echo "Issuing initramfs rebuild for next boot"
122-
sudo touch /etc/bazzite/initramfs/rebuild
121+
rpm-ostree initramfs --enable
123122
rpm-ostree kargs \
124123
--delete-if-present="iommu=pt" \
125124
--delete-if-present="iommu=on" \
@@ -147,10 +146,10 @@ setup-virtualization ACTION="":
147146
exit 0
148147
fi
149148
echo "Creating tmpfile definition for shm file in /etc/tmpfiles.d/"
150-
sudo bash -c "tee << LOOKING_GLASS_TMP > /etc/tmpfiles.d/10-looking-glass.conf
151-
# Type Path Mode UID GID Age Argument
152-
f /dev/shm/looking-glass 0660 1000 qemu -
153-
LOOKING_GLASS_TMP"
149+
sudo bash -c "cat << LOOKING_GLASS_TMP > /etc/tmpfiles.d/10-looking-glass.conf
150+
# Type Path Mode UID GID Age Argument
151+
f /dev/shm/looking-glass 0660 1000 qemu -
152+
LOOKING_GLASS_TMP"
154153
echo "Adding SELinux context record for /dev/shm/looking-glass"
155154
sudo semanage fcontext -a -t svirt_tmpfs_t /dev/shm/looking-glass
156155
elif [[ "${OPTION,,}" =~ group ]]; then

0 commit comments

Comments
 (0)