T-vK / MobilePassThrough

Make GPU passthrough on notebooks easy and accessible!
170 stars 19 forks source link

Support for Fedora 30 #4

Closed tristan-k closed 5 years ago

tristan-k commented 5 years ago

Can you please add support for Fedora 30. I created a symbolic link with $ ln -s MobilePassThrough/utils/Fedora/29 MobilePassThrough/utils/Fedora/30 to get the script working but it fails at the nvidia driver installation.

$ ./setup.sh 
Updating software...
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:19 am Di 04 Jun 2019 23:39:44 CEST.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Installing some useful tools...
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:24 am Di 04 Jun 2019 23:39:44 CEST.
Das Paket wget-1.20.3-1.fc30.x86_64 ist bereits installiert.
Das Paket curl-7.64.0-7.fc30.x86_64 ist bereits installiert.
Das Paket vim-enhanced-2:8.1.1413-1.fc30.x86_64 ist bereits installiert.
Das Paket screen-4.6.2-8.fc30.x86_64 ist bereits installiert.
Das Paket git-2.21.0-1.fc30.x86_64 ist bereits installiert.
Das Paket crudini-0.9-3.fc28.noarch ist bereits installiert.
Das Paket lshw-B.02.18-19.fc30.x86_64 ist bereits installiert.
Das Paket msr-tools-1.3-11.fc30.x86_64 ist bereits installiert.
Das Paket sysfsutils-2.1.0-26.fc30.x86_64 ist bereits installiert.
Das Paket tunctl-1.5-20.fc30.x86_64 ist bereits installiert.
Das Paket remmina-1.3.4-1.fc30.x86_64 ist bereits installiert.
Das Paket samba-2:4.10.4-1.fc30.x86_64 ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Installing virtualization software...
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:27 am Di 04 Jun 2019 23:39:44 CEST.
Das Paket qemu-2:3.1.0-8.fc30.x86_64 ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Installing the Windows VirtIO Repository...
--2019-06-04 23:59:13--  https://fedorapeople.org/groups/virt/virtio-win/virtio-win.repo
Auflösen des Hostnamens fedorapeople.org (fedorapeople.org)… 2610:28:3090:3001:5054:ff:fea7:9474, 152.19.134.199
Verbindungsaufbau zu fedorapeople.org (fedorapeople.org)|2610:28:3090:3001:5054:ff:fea7:9474|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 609
Wird in »/etc/yum.repos.d/virtio-win.repo« gespeichert.

/etc/yum.repos.d/virtio-win.repo                            100%[=========================================================================================================================================>]     609  --.-KB/s    in 0s      

2019-06-04 23:59:13 (42,8 MB/s) - »/etc/yum.repos.d/virtio-win.repo« gespeichert [609/609]

Installing virtio-win...
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:31 am Di 04 Jun 2019 23:39:44 CEST.
Das Paket virtio-win-0.1.171-1.noarch ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Upgrading to latest virtio-win...
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:34 am Di 04 Jun 2019 23:39:44 CEST.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Installing virt-viewer so you can connect to the VM for the windows installation
Letzte Prüfung auf abgelaufene Metadaten: vor 0:19:37 am Di 04 Jun 2019 23:39:44 CEST.
Das Paket virt-viewer-8.0-1.fc30.x86_64 ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Adding kernel parameters...
Adding kernel parameters to enable IOMMU on Intel/AMD CPUs...
addKernelParam: No action required. "iommu=1" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
addKernelParam: No action required. "amd_iommu=on" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
addKernelParam: No action required. "intel_iommu=on" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
Adding a kernel parameter to prevent bluescreens when a VM does MSR reads / writes directly...
addKernelParam: No action required. "kvm.ignore_msrs=1" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
Adding a kernel parameter to tell dracut to load vfio-pci first...
addKernelParam: No action required. "rd.driver.pre=vfio-pci" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
TODO: check if /etc/dracut.conf.d/vfio.conf is necessary / make sure it onyl happens once
(Re)building initramfs for the current kernel...
Applying the kernel parameter changes...
Generating grub configuration file ...
device-mapper: reload ioctl on osprober-linux-nvme1n1p3  failed: Device or resource busy
Command failed.
device-mapper: reload ioctl on osprober-linux-sda3  failed: Device or resource busy
Command failed.
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Disable Nouveau drivers
addKernelParam: No action required. "nouveau.modeset=0" already exists in GRUB_CMDLINE_LINUX of /etc/default/grub
Kein Treffer für Argument: xorg-x11-drv-nouveau
Keine Pakete zum Entfernen markiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Install third party repositories
Letzte Prüfung auf abgelaufene Metadaten: vor 0:20:00 am Di 04 Jun 2019 23:39:44 CEST.
Das Paket fedora-workstation-repositories-29-2.fc30.noarch ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Install third party repositories
Enable the NVIDIA driver repository
Copr repo for bumblebee owned by chenxiaolong                                                                                                                                                                 5.0 kB/s | 3.5 kB     00:00    
Fedora Modular 30 - x86_64                                                                                                                                                                                     35 kB/s |  25 kB     00:00    
Fedora Modular 30 - x86_64 - Updates                                                                                                                                                                          116 kB/s |  23 kB     00:00    
Fedora 30 - x86_64 - Updates                                                                                                                                                                                   38 kB/s |  24 kB     00:00    
Fedora 30 - x86_64                                                                                                                                                                                             42 kB/s |  25 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - NVIDIA Driver                                                                                                                                                             56 kB/s | 9.9 kB     00:00    
virtio-win builds roughly matching what was shipped in latest RHEL                                                                                                                                            3.0 kB/s | 3.0 kB     00:00    
Fehler: 
 Problem: package akmod-nvidia-3:418.74-1.fc30.x86_64 requires xorg-x11-drv-nvidia-kmodsrc >= 3:418.74-1, but none of the providers can be installed
  - conflicting requests
  - package xorg-x11-drv-nvidia-kmodsrc-3:418.74-1.fc30.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages)
Enable the Bumblebee repository
Die Paketquelle wurde erfolgreich aktiviert.
Install Bumblebee
Copr repo for bumblebee owned by chenxiaolong                                                                                                                                                                 5.0 kB/s | 3.5 kB     00:00    
Fedora Modular 30 - x86_64                                                                                                                                                                                    147 kB/s |  25 kB     00:00    
Fedora Modular 30 - x86_64 - Updates                                                                                                                                                                           33 kB/s |  23 kB     00:00    
Fedora 30 - x86_64 - Updates                                                                                                                                                                                   39 kB/s |  24 kB     00:00    
Fedora 30 - x86_64                                                                                                                                                                                            139 kB/s |  25 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - NVIDIA Driver                                                                                                                                                             71 kB/s | 9.9 kB     00:00    
virtio-win builds roughly matching what was shipped in latest RHEL                                                                                                                                            3.0 kB/s | 3.0 kB     00:01    
Das Paket akmod-bbswitch-0.8-2.fc30.x86_64 ist bereits installiert.
Das Paket bumblebee-3.2.1-2.fc29.x86_64 ist bereits installiert.
Das Paket primus-0.2-1.gitd1afbf6.fc29.noarch ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Make Bumblebee avialable to the current user
gpasswd: Benutzer »bumblebee« ist nicht vorhanden.
Enable Bumblebee
Block nvidia-fallback service
Allow using external monitor for notebooks that have the port wired to the dGPU directly
Letzte Prüfung auf abgelaufene Metadaten: vor 0:00:03 am Di 04 Jun 2019 23:59:59 CEST.
Das Paket intel-gpu-tools-2.99.917-41.20180618.fc30.x86_64 ist bereits installiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
No protocol specified
Unable to connect to ":0".
Attempting to extract the VBIOS ROM of the Nvidia GPU
This will probably fail. If you know how to fix it please open an issue and tell me.
[  177.317986] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NOUVEAU(0): [drm] failed to set drm interface version.

[  177.318023] [ERROR]Aborting because fallback start is disabled.
You should probably reboot now!
But first make sure you didn't get any errors above.
After the reboot you might want to run the compatibility-check script.
 ./compatibility-check.sh 
[sudo] Passwort für tom: 
[   54.076703] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NOUVEAU(0): [drm] failed to set drm interface version.

[   54.076740] [ERROR]Aborting because fallback start is disabled.
[OK] VT-X / AMD-V virtualization is enabled in the UEFI.
[OK] VT-D / IOMMU is enabled in the UEFI.
[OK] The IOMMU kernel parameters are set.
[Warning] GPU with ID '01:00.0' could be passed through to a virtual machine, but only together with the following devices: 
IOMMU Group 1 02:00.0 3D controller [0302]: NVIDIA Corporation GM204M [GeForce GTX 980M] [10de:13d7] (rev a1)
[Warning] GPU with ID '02:00.0' could be passed through to a virtual machine, but only together with the following devices: 
IOMMU Group 1 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204M [GeForce GTX 980M] [10de:13d7] (rev a1)
[Success] There are 2 GPU(s) in this system that could be passed through to a VM!

Is Compatible?  Name                       IOMMU_GROUP  PCI Address
Yes             GM204M [GeForce GTX 980M]  1            pci@0000:01:00.0
Yes             GM204M [GeForce GTX 980M]  1            pci@0000:02:00.0

[Warning] All GPUs in this system are in the same IOMMU group. This would make GPU pass-through difficult (not impossible) because your host machine would be left without a GPU!
[Info] Device name: GT80S 6QE
[Info] BIOS version: E1814IMS.113
[OK] This system is probably MUXed. (The connection between the GPU(s) and the [internal display]/[display outputs] is multiplexed.)
[OK] Logs have been created in /home/tom/Downloads/MobilePassThrough/logs/GT80S 6QE/E1814IMS.113
If you found a notebook that appears to be GPU pass-through compatible, please open an issue on Github and let me know.
T-vK commented 5 years ago

Sounds like this line is at fault: sudo grep -qxsF 'exclude=xorg-x11*' "/etc/dnf/dnf.conf" || echo "exclude=xorg-x11*" | sudo tee -a "/etc/dnf/dnf.conf" > /dev/null

It's in the nvidia-setup script.

I'm not sure if this line was necessary on Fedora 29, but it might work without it. To undo what the line has done, you can just remove the exclude=xorg-x11* from your dnf.conf.

I'm definitely interested in getting this to work on Fedora 30 and future versions of Fedora, but I currently have no drive or USB stick left to install another Fedora on.

T-vK commented 5 years ago

I got everything to work on Fedora 30.

This is the nvidia-setup script that I used:

#!/usr/bin/env bash

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
PROJECT_DIR="${SCRIPT_DIR}/../../.."
UTILS_DIR="${PROJECT_DIR}/utils"
DISTRO=$("${UTILS_DIR}/distro-info")
DISTRO_UTILS_DIR="${UTILS_DIR}/${DISTRO}"
VM_FILES_DIR="${PROJECT_DIR}/vm-files"

source "$DISTRO_UTILS_DIR/kernel-param-utils"

echo "Disable Nouveau drivers"
addKernelParam "nouveau.modeset=0"
#sudo grep -qxsF 'blacklist nouveau' "/etc/modprobe.d/blacklist.conf" || echo "blacklist nouveau" | sudo tee -a "/etc/modprobe.d/blacklist.conf" > /dev/null
#sudo grep -qxsF 'exclude=xorg-x11*' "/etc/dnf/dnf.conf" || echo "exclude=xorg-x11*" | sudo tee -a "/etc/dnf/dnf.conf" > /dev/null
#sudo dnf remove xorg-x11-drv-nouveau -y

echo "Install third party repositories"
sudo dnf install fedora-workstation-repositories -y

echo "Install third party repositories"
sudo dnf config-manager rpmfusion-nonfree-nvidia-driver --set-enabled -y

echo "Enable the NVIDIA driver repository"
sudo dnf install akmod-nvidia acpi -y

echo "Enable the Bumblebee repository"
sudo dnf copr enable chenxiaolong/bumblebee -y

echo "Install Bumblebee"
sudo dnf install akmod-bbswitch bumblebee primus -y

echo "Make Bumblebee avialable to the current user"
sudo gpasswd -a $(who -m | awk '{print $1;}') bumblebee

echo "Enable Bumblebee autostart"
sudo systemctl enable bumblebeed

echo "Block nvidia-fallback service"
sudo systemctl mask nvidia-fallback

echo "Start Bumblebee"
sudo systemctl start bumblebeed

#TODO: verify if that actually works:
echo "Allow using external monitor for notebooks that have the port wired to the dGPU directly"
sudo dnf install -y intel-gpu-tools
sudo intel-virtual-output
#example usage: xrandr –output eDP1 –mode 1920×1080 –output HDMI1 –mode 1920×1080 –right-of eDP1

sudo ${UTILS_DIR}/extract-vbios

I also had to install ivshmem-tools.

... Hopefully I'll find some time in the near future to finish all the improvements and new features I've been working on and push an update.

T-vK commented 5 years ago

Fedora 30 is now officially supported.