翼度科技»论坛 云主机 LINUX 查看内容

[已解决] KVM 显卡直通 (GPU-passthrough) 直通虚拟机关机后 显示屏黑屏

6

主题

6

帖子

18

积分

新手上路

Rank: 1

积分
18
系统环境
  1. ██████████████████  ████████   littleblacklb@lb-desktop
  2. ██████████████████  ████████   ------------------------
  3. ██████████████████  ████████   OS: Manjaro Linux x86_64
  4. ██████████████████  ████████   Host: MS-7A40 2.0
  5. ████████            ████████   Kernel: 6.1.69-1-MANJARO
  6. ████████  ████████  ████████   Uptime: 4 hours, 47 mins
  7. ████████  ████████  ████████   Packages: 1802 (pacman)
  8. ████████  ████████  ████████   Shell: zsh 5.9
  9. ████████  ████████  ████████   Resolution: 1920x1080
  10. ████████  ████████  ████████   DE: Plasma 5.27.10
  11. ████████  ████████  ████████   WM: KWin
  12. ████████  ████████  ████████   Theme: [Plasma], Orchis-Grey-Dark [GTK2/3]
  13. ████████  ████████  ████████   Icons: Fluent-dark [Plasma], Fluent-dark [GTK2/3]
  14. ████████  ████████  ████████   Terminal: yakuake
  15.                                CPU: AMD Ryzen 7 3700X (16) @ 4.200GHz
  16.                                GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate
  17.                                Memory: 9370MiB / 15915MiB
复制代码
经过

按照LED 显卡直通做完所有工作后,win10直通虚拟机成功运行且安装上了驱动。
但是当虚拟机关机后,显卡似乎并没有归还,导致显示屏一直处于黑屏,但是ssh可以连接。
经过hooks日志查看发现,当钩子执行到
  1. echo 1 > /etc/class/vtconsole/vtcon0/bind
  2. echo 1 > /etc/class/vtconsole/vtcon1/bind
复制代码
时脚本会被kill.
解决

google后,在reddit帖子下找到解决办法:
adding video=efifb:off in the "" of GRUB_CMDLINE_LINUX_DEFAULT="....." worked perfectly for me.

  • 在/etc/default/grub文件中的GRUB_CMDLINE_LINUX_DEFAULT键中添加video=efifb:off
  • 输入sudo update-grub后reboot即可
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终端。
这是这个办法的缺点,但是我目前还没有找到更佳办法。

来源:https://www.cnblogs.com/littleblacklb/p/17924416.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具