Virsh network breaks when using gpu passthrough for a vm


I am dual booting with windows, I saw some other posts on here mention how windows related boot-options can mess stuff up. I have both secure boot and fast boot disabled.

I am trying to set up a virtual machine with GPU passthrough, and everytime I setup the GPU passthrough it causes the virsh default network, which is what I use to get internet in the vm, to no longer have internet access. This connection works perfectly using QXL/Display spice without passthrough, so I am assuming that something in my startup script is causing wifi to break. I've tried the same setup on both Manjaro and EndeavourOS, and it works perfectly fine on both of those. Below is my startup script for running the VM with gpu passthrough

set -x

source "/etc/libvirt/hooks/kvm.conf"

systemctl stop sddm-plymouth
systemctl stop sddm

echo 0 > /sys/class/vtconsole/vtcon0/bind

echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 10

modprobe -r nvidia_drm
modprobe -r nvidia_modeset
modprobe -r drm_kms_helper
modprobe -r nvidia
modprobe -r i2c_nvidia_gpu
modprobe -r drm
modprobe -r nvidia_uvm

virsh nodedev-detach $VIRSH_GPU_VIDEO
virsh nodedev-detach $VIRSH_GPU_AUDIO

modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1

I have tried disabling wifi powersave and mac address randomization in the garuda network manager, but that has not helped. My assumption is that there is some sort of power saving feature somewhere that disables wifi when sddm is stopped, however if this is the cause of the issue I have not been able to find how to disable it. So far I've got a hacky fix of just passing through my entire network device to the VM, however that leaves garuda with no internet. I would really like to be able to resolve this issue, and have internet on both the VM and host without needing to switch to a different distro.

System:    Kernel: 5.15.4-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=8354308e-d5e1-41b7-9f9b-bb5bc62114b7
rw [email protected] quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3 intel_iommu=on iommu=pt mitigations=off
Desktop: KDE Plasma 5.23.3 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:   Type: Desktop System: ASUS product: N/A v: N/A serial: <filter>
Mobo: ASUSTeK model: PRIME Z590-P v: Rev 1.xx serial: <filter> UEFI: American Megatrends
v: 1017 date: 07/12/2021
CPU:       Info: 8-Core model: Intel Core i7-10700K bits: 64 type: MT MCP arch: Comet Lake family: 6
model-id: A5 (165) stepping: 5 microcode: EC cache: L2: 16 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 121596
Speed: 5100 MHz min/max: 800/5100 MHz Core speeds (MHz): 1: 5100 2: 5130 3: 5100 4: 5116
5: 5105 6: 5100 7: 5100 8: 5094 9: 5098 10: 5100 11: 5087 12: 5100 13: 5096 14: 5102 15: 5109
16: 5099
Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass status: Vulnerable
Type: spectre_v1
status: Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
Type: spectre_v2 status: Vulnerable, IBPB: disabled, STIBP: disabled
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:  Device-1: NVIDIA GA102 [GeForce RTX 3080] driver: nvidia v: 495.44
alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:2206 class-ID: 0300
Display: x11 server: X.Org compositor: kwin_x11 driver: loaded: nvidia
unloaded: modesetting alternate: fbdev,nouveau,nv,vesa display-ID: :0 screens: 1
Screen-1: 0 s-res: 4480x1440 s-dpi: 108 s-size: 1054x342mm (41.5x13.5") s-diag: 1108mm (43.6")
Monitor-1: DP-0 res: 1920x1080 hz: 60 dpi: 90 size: 544x303mm (21.4x11.9") diag: 623mm (24.5")
Monitor-2: DP-2 res: 2560x1440 hz: 60 dpi: 109 size: 597x336mm (23.5x13.2") diag: 685mm (27")
OpenGL: renderer: NVIDIA GeForce RTX 3080/PCIe/SSE2 v: 4.6.0 NVIDIA 495.44 direct render: Yes
Audio:     Device-1: Intel vendor: ASUSTeK driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
chip-ID: 8086:f0c8 class-ID: 0403
Device-2: NVIDIA GA102 High Definition Audio driver: snd_hda_intel v: kernel bus-ID: 01:00.1
chip-ID: 10de:1aef class-ID: 0403
Device-3: SteelSeries ApS SteelSeries Arctis 7 type: USB
driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-11:10 chip-ID: 1038:12ad class-ID: 0300
Sound Server-1: ALSA v: k5.15.4-zen1-1-zen running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: no
Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:   Device-1: Intel Wireless 7265 driver: iwlwifi v: kernel bus-ID: 04:00.0 chip-ID: 8086:095a
class-ID: 0280
IF: wlp4s0 state: up mac: <filter>
Device-2: Realtek RTL8125 2.5GbE vendor: ASUSTeK driver: r8169 v: kernel port: 4000
bus-ID: 05:00.0 chip-ID: 10ec:8125 class-ID: 0200
IF: enp5s0 state: down mac: <filter>
IF-ID-1: virbr0 state: down mac: <filter>
Bluetooth: Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8 bus-ID: 1-2.2:4
chip-ID: 8087:0a2a class-ID: e001
Report: bt-adapter ID: hci0 rfk-id: 1 state: up address: N/A
Drives:    Local Storage: total: 2.74 TiB used: 23.4 GiB (0.8%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Kingston model: SNVS1000G size: 931.51 GiB
block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: EDFK7N02 temp: 37.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST2000DM008-2FR102 size: 1.82 TiB
block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 7200
serial: <filter> rev: 0001 scheme: GPT
ID-3: /dev/sdb maj-min: 8:16 type: USB vendor: Verbatim model: STORE N GO size: 7.26 GiB
block-size: physical: 512 B logical: 512 B type: N/A serial: <filter> rev: 5.00 scheme: MBR
SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
Partition: ID-1: / raw-size: 207 GiB size: 207 GiB (100.00%) used: 23.37 GiB (11.3%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%) used: 26.5 MiB (27.6%) fs: vfat
dev: /dev/nvme0n1p2 maj-min: 259:2
ID-3: /home raw-size: 207 GiB size: 207 GiB (100.00%) used: 23.37 GiB (11.3%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-4: /var/log raw-size: 207 GiB size: 207 GiB (100.00%) used: 23.37 GiB (11.3%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-5: /var/tmp raw-size: 207 GiB size: 207 GiB (100.00%) used: 23.37 GiB (11.3%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 31.17 GiB used: 0 KiB (0.0%) priority: 100 dev: /dev/zram0
Sensors:   System Temperatures: cpu: 27.8 C mobo: N/A gpu: nvidia temp: 52 C
Fan Speeds (RPM): N/A gpu: nvidia fan: 30%
Info:      Processes: 366 Uptime: 0m wakeups: 0 Memory: 31.17 GiB used: 2.84 GiB (9.1%) Init: systemd
v: 249 tool: systemctl Compilers: gcc: 11.1.0 Packages: pacman: 1205 lib: 290 Shell: fish
v: 3.3.1 default: Bash v: 5.1.8 running-in: konsole inxi: 3.3.08

If it works in EnOS then it will work in Garuda. What's different between the two setups?

1 Like