系统环境

██████████████████  ████████   littleblacklb@lb-desktop ██████████████████  ████████   ------------------------ ██████████████████  ████████   OS: Manjaro Linux x86_64 ██████████████████  ████████   Host: MS-7A40 2.0 ████████            ████████   Kernel: 6.1.69-1-MANJARO ████████  ████████  ████████   Uptime: 4 hours, 47 mins ████████  ████████  ████████   Packages: 1802 (pacman) ████████  ████████  ████████   Shell: zsh 5.9 ████████  ████████  ████████   Resolution: 1920x1080 ████████  ████████  ████████   DE: Plasma 5.27.10 ████████  ████████  ████████   WM: KWin ████████  ████████  ████████   Theme: [Plasma], Orchis-Grey-Dark [GTK2/3] ████████  ████████  ████████   Icons: Fluent-dark [Plasma], Fluent-dark [GTK2/3] ████████  ████████  ████████   Terminal: yakuake                                CPU: AMD Ryzen 7 3700X (16) @ 4.200GHz                                GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate                                Memory: 9370MiB / 15915MiB 

经过

按照LED 显卡直通做完所有工作后,win10直通虚拟机成功运行且安装上了驱动。
但是当虚拟机关机后,显卡似乎并没有归还,导致显示屏一直处于黑屏,但是ssh可以连接。

经过hooks日志查看发现,当钩子执行到

echo 1 > /etc/class/vtconsole/vtcon0/bindecho 1 > /etc/class/vtconsole/vtcon1/bind

时脚本会被kill.

解决

google后,在reddit帖子下找到解决办法:

adding video=efifb:off in the “” of GRUB_CMDLINE_LINUX_DEFAULT=”…..” worked perfectly for me.

  1. /etc/default/grub文件中的GRUB_CMDLINE_LINUX_DEFAULT键中添加video=efifb:off
  2. 输入sudo update-grubreboot即可

efifb是什么

https://www.reddit.com/r/VFIO/comments/ks7ve3/alternative_to_efifboff/

Let’s say you have multiple GPUs. When Linux boots, it will try to display the boot log on one of your monitors using one of your GPUs. To do this, it attaches a simple ‘efifb’ graphics driver to that GPU and uses it to display the boot log.

The problem comes when you wish to pass the GPU to a VM. Since the ‘efifb’ driver is attached to the GPU, qemu will not be able to reserve the GPU for the VM and your VM will not start.

简单来说efifb是一个EFI驱动用于显示开机日志以及tty,当关闭后无法显示开机日志以及tty终端。
这是这个办法的缺点,但是我目前还没有找到更佳办法。