ublue-os / bazzite

Bazzite is a custom image built upon Fedora Atomic Desktops that brings the best of Linux gaming to all of your devices - including your favorite handheld.
https://bazzite.gg
Apache License 2.0
3.65k stars 216 forks source link

ujust setup-virtualization kvmfr: error: initramfs regeneration state is already enabled #1566

Open tastyhub opened 2 weeks ago

tastyhub commented 2 weeks ago

Describe the bug

$ ujust setup-virtualization kvmfr
This module along with Looking Glass is very experimental and not recommended for production use!
The ublue team packages the kvmfr module only because it has to be supplied with the system image while using an atomic desktop.
If you do plan to use Looking Glass, please follow the guide here on how to compile it for your system.
To use the kvmfr module after enabling it, just add and edit the xml for libvirt from the documentation in the first link.
Since we package the kvmfr module please open kvmfr related issues you have on Bazzite
in the Bazzite Discord or the Bazzite Github issue tracker.
~ @HikariKnight

Setting up kvmfr module so it loads next boot
[sudo] password for username: 
Adding udev rule for /dev/kvmfr0
Adding /dev/kvmfr0 to qemu cgroup_device_acl
Adding SELinux context record for /dev/kvmfr0
ValueError: File context for /dev/kvmfr0 already defined
Adding SELinux access rules for /dev/kvmfr0
This is the type enforcement we wrote for SELinux and you can find it in /home/myusername/.config/selinux_te/kvmfr.te
#======= start of kvmfr.te =======
module kvmfr 1.0;

require {
    type device_t;
    type svirt_t;
    class chr_file { open read write map };
}

#============= svirt_t ==============
allow svirt_t device_t:chr_file { open read write map };
#======== end of kvmfr.te ========
Loading kvmfr module so you do not have to reboot to use it the first time
chown: cannot access '/dev/kvmfr0': No such file or directory

Kvmfr0 static size is set to 128mb by default
this will work with up to 4K SDR resolutiion, as most dummy plugs go up to 4K
some games will try use the adapters max resolution on first boot and cause issues if the value is too low.
Most ghost display adapters max out at 4k, hence the default value of 128mb.

If you need to change it to a different value
you can do that in /etc/modprobe.d/kvmfr.conf
Please read official documentation for kvmfr for how to use it

Press OK to start the process of regenerating your initramfs, this will take a long time
and there is no good way to track progress for it, if anything is wrong it will error out.
NOTE: You can start using kvmfr right now without rebooting, but you will need to regenerate initramfs for it to auto load next boot.
error: initramfs regeneration state is already enabled
error: Recipe `setup-virtualization` failed with exit code 1

What did you expect to happen?

Some time to pass for initramfs to regenerate. Rebooting and running again gives same error.

Output of rpm-ostree status

$ rpm-ostree status
State: idle
Deployments:
● ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
                   Digest: sha256:711654a4cc074fd85e121475426b80d1345fc42f60f39123a304aeac17170ba7
                  Version: 40.20240826.0 (2024-08-27T06:55:22Z)
          LayeredPackages: dialog edk2-ovmf freerdp nmap-ncat qemu sunshine virt-manager
            LocalPackages: lact-libadwaita-0.5.5-0.x86_64 r2modman-3.1.49-1.x86_64
                Initramfs: regenerate

  ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
                   Digest: sha256:76bd0cd50c748d080d36ffba2f8223142e55611a98a610c3d5ee36e6e8ee411f
                  Version: 40.20240822.0 (2024-08-23T04:43:54Z)
          LayeredPackages: dialog edk2-ovmf freerdp nmap-ncat qemu sunshine virt-manager
            LocalPackages: lact-libadwaita-0.5.5-0.x86_64 r2modman-3.1.49-1.x86_64
                Initramfs: regenerate

Hardware

$ cat /sys/devices/virtual/dmi/id/product_name X570 Taichi Ryzen 5600X 32GB DDR4 RX 5700 XT Primary, GTX 1060 Passthrough

Extra information or context

No response

tastyhub commented 2 weeks ago

With no progress, I ran:

rpm-ostree initramfs --disable

Checking out tree fe65e34... done
Enabled rpm-md repositories: copr:copr.fedorainfracloud.org:matte-schwartz:sunshine copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager copr:copr.fedorainfracloud.org:rodoma92:rmlint copr:copr.fedorainfracloud.org:rok:cdemu fedora-cisco-openh264 updates fedora rpmfusion-free-updates-testing rpmfusion-free-updates rpmfusion-free updates-archive
Updating metadata for 'updates'... done
Updating metadata for 'updates-archive'... done
Importing rpm-md... done
rpm-md repo 'copr:copr.fedorainfracloud.org:matte-schwartz:sunshine' (cached); generated: 2024-08-12T09:06:28Z solvables: 2
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager' (cached); generated: 2024-04-20T12:39:00Z solvables: 12
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:rmlint' (cached); generated: 2024-05-10T10:16:28Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rok:cdemu' (cached); generated: 2024-07-09T09:13:21Z solvables: 23
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2024-03-12T11:45:42Z solvables: 3
rpm-md repo 'updates'; generated: 2024-08-28T02:31:18Z solvables: 25620
rpm-md repo 'fedora' (cached); generated: 2024-04-14T18:51:11Z solvables: 74881
rpm-md repo 'rpmfusion-free-updates-testing' (cached); generated: 2024-08-22T09:00:10Z solvables: 7
rpm-md repo 'rpmfusion-free-updates' (cached); generated: 2024-08-22T08:59:43Z solvables: 149
rpm-md repo 'rpmfusion-free' (cached); generated: 2024-04-20T12:11:51Z solvables: 422
rpm-md repo 'updates-archive'; generated: 2024-08-21T03:52:59Z solvables: 36142
Resolving dependencies... done
Will download: 1 package (11.1 kB)
Downloading from 'updates'... done
Importing packages... done
Checking out packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Writing OSTree commit... done
Staging deployment... done
Pruned images: 0 (layers: 19)
Freed: 891.9 MB (pkgcache branches: 0)
Initramfs regeneration is now: disabled
Initramfs will be reset to default on next reboot.

I then ran just setup-virtualization kvmfr

This module along with Looking Glass is very experimental and not recommended for production use!
The ublue team packages the kvmfr module only because it has to be supplied with the system image while using an atomic desktop.
If you do plan to use Looking Glass, please follow the guide here on how to compile it for your system.
To use the kvmfr module after enabling it, just add and edit the xml for libvirt from the documentation in the first link.
Since we package the kvmfr module please open kvmfr related issues you have on Bazzite
in the Bazzite Discord or the Bazzite Github issue tracker.
~ @HikariKnight

Setting up kvmfr module so it loads next boot
[sudo] password for myusername: 
Adding udev rule for /dev/kvmfr0
Adding /dev/kvmfr0 to qemu cgroup_device_acl
Adding SELinux context record for /dev/kvmfr0
ValueError: File context for /dev/kvmfr0 already defined
Adding SELinux access rules for /dev/kvmfr0
This is the type enforcement we wrote for SELinux and you can find it in /home/myusername/.config/selinux_te/kvmfr.te
#======= start of kvmfr.te =======
module kvmfr 1.0;

require {
    type device_t;
    type svirt_t;
    class chr_file { open read write map };
}

#============= svirt_t ==============
allow svirt_t device_t:chr_file { open read write map };
#======== end of kvmfr.te ========
Loading kvmfr module so you do not have to reboot to use it the first time
chown: cannot access '/dev/kvmfr0': No such file or directory

Kvmfr0 static size is set to 128mb by default
this will work with up to 4K SDR resolutiion, as most dummy plugs go up to 4K
some games will try use the adapters max resolution on first boot and cause issues if the value is too low.
Most ghost display adapters max out at 4k, hence the default value of 128mb.

If you need to change it to a different value
you can do that in /etc/modprobe.d/kvmfr.conf
Please read official documentation for kvmfr for how to use it

Press OK to start the process of regenerating your initramfs, this will take a long time
and there is no good way to track progress for it, if anything is wrong it will error out.
NOTE: You can start using kvmfr right now without rebooting, but you will need to regenerate initramfs for it to auto load next boot.
Checking out tree fe65e34... done
Enabled rpm-md repositories: copr:copr.fedorainfracloud.org:matte-schwartz:sunshine copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager copr:copr.fedorainfracloud.org:rodoma92:rmlint copr:copr.fedorainfracloud.org:rok:cdemu fedora-cisco-openh264 updates fedora rpmfusion-free-updates-testing rpmfusion-free-updates rpmfusion-free updates-archive
Importing rpm-md... done
rpm-md repo 'copr:copr.fedorainfracloud.org:matte-schwartz:sunshine' (cached); generated: 2024-08-12T09:06:28Z solvables: 2
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager' (cached); generated: 2024-04-20T12:39:00Z solvables: 12
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:rmlint' (cached); generated: 2024-05-10T10:16:28Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rok:cdemu' (cached); generated: 2024-07-09T09:13:21Z solvables: 23
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2024-03-12T11:45:42Z solvables: 3
rpm-md repo 'updates' (cached); generated: 2024-08-28T02:31:18Z solvables: 25620
rpm-md repo 'fedora' (cached); generated: 2024-04-14T18:51:11Z solvables: 74881
rpm-md repo 'rpmfusion-free-updates-testing' (cached); generated: 2024-08-22T09:00:10Z solvables: 7
rpm-md repo 'rpmfusion-free-updates' (cached); generated: 2024-08-22T08:59:43Z solvables: 149
rpm-md repo 'rpmfusion-free' (cached); generated: 2024-04-20T12:11:51Z solvables: 422
rpm-md repo 'updates-archive' (cached); generated: 2024-08-21T03:52:59Z solvables: 36142
Resolving dependencies... done
Checking out packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Generating initramfs... done
Writing OSTree commit... done
Staging deployment... done
Freed: 106.2 MB (pkgcache branches: 0)
Initramfs regeneration is now: enabled

The error: chown: cannot access '/dev/kvmfr0': No such file or directory However,

$ ls -l /dev/kvmfr0
crw-rw----. 1 myusername qemu 239, 0 Aug 28 16:17 /dev/kvmfr0
cat /etc/modules-load.d/kvmfr.conf
cat: /etc/modules-load.d/kvmfr.conf: No such file or directory
myusername@bazzite:~$ ls /etc/modules-load.d/kvmfr.conf
ls: cannot access '/etc/modules-load.d/kvmfr.conf': No such file or directory
myusername@bazzite:~$ ls /etc/modules-load.d
vhba.conf
$ sudo dmesg | grep kvmfr
[sudo] password for myusername: 
[    1.745354] kvmfr: creating 1 static devices
[    1.756684] kvmfr: kvmfr_module_init: module loaded
[    6.223921] audit: type=1400 audit(1724879873.807:4): avc:  denied  { associate } for  pid=1 comm="systemd" name="kvmfr0" dev="devtmpfs" ino=237 scontext=system_u:object_r:svirt_tmpfs_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=filesystem permissive=0
[    6.223925] systemd[1]: Unable to fix SELinux security context of /dev/kvmfr0: Permission denied
[    9.293972]  ip6_tables ip_tables kvmfr(OE) gcadapter_oc(OE) fuse i2c_dev dm_multipath

Manually created /etc/modules-load.d/kvmfr.conf and rebooted.

# KVMFR Looking Glass module
kvmfr

$ sudo dmesg | grep kvmfr

[sudo] password for myusername: 
[    1.810708] kvmfr: creating 1 static devices
[    1.822996] kvmfr: kvmfr_module_init: module loaded
[    6.289953] audit: type=1400 audit(1724880339.833:4): avc:  denied  { associate } for  pid=1 comm="systemd" name="kvmfr0" dev="devtmpfs" ino=237 scontext=system_u:object_r:svirt_tmpfs_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=filesystem permissive=0
[    6.289958] systemd[1]: Unable to fix SELinux security context of /dev/kvmfr0: Permission denied
[    9.447191] Modules linked in: wl(POE+) snd_hda_codec(+) btbcm snd_usbmidi_lib rapl mac80211(+) snd_ump btmtk wmi_bmof snd_hda_core sunrpc pcspkr libarc4 k10temp snd_rawmidi snd_hwdep snd_seq i2c_piix4 bluetooth snd_seq_device snd_pcm cdc_acm snd_timer iwlwifi igb dca snd soundcore ryzen_smu(OE) binfmt_misc vfat fat joydev brcmfmac brcmutil cfg80211 mmc_core rfkill tcp_bbr sch_fq vhba(OE) loop nfnetlink zstd zram amdgpu nouveau crct10dif_pclmul crc32_pclmul crc32c_intel polyval_clmulni polyval_generic mxm_wmi drm_gpuvm amdxcp drm_exec ghash_clmulni_intel gpu_sched drm_buddy video sha512_ssse3 i2c_algo_bit drm_suballoc_helper sha256_ssse3 drm_display_helper sha1_ssse3 cec ccp sp5100_tco drm_ttm_helper ttm nvme hid_playstation led_class_multicolor ff_memless nvme_core nvme_auth wmi vfio_pci vfio_pci_core vfio_iommu_type1 vfio iommufd v4l2loopback(OE) videodev mc uhid scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables kvmfr(OE) gcadapter_oc(OE) fuse i2c_dev dm_multipath