代码之家  ›  专栏  ›  技术社区  ›  Veerendra K

virt安装挂起-虚拟机的GPU传递

  •  0
  • Veerendra K  · 技术社区  · 7 年前

    我想运行使用主机的GPU的虚拟机。为此,我跟着 this docs 启用模块/GRUB配置。看起来我配置成功了,我可以看到 dmesg | grep -i vfio . 但当我奔跑 virt-install 它永远挂着,平行的,我连跑都跑不动 virsh list --all . 每次我必须重新启动我的笔记本电脑,以便运行任何 virsh/virt-install 再次命令。

    veeru@ghost:~$ sudo su
    [sudo] password for veeru: 
    root@ghost:/home/veeru# virt-install \
    > --name vm0 \
    > --ram 12028 \
    > --disk path=/home/veeru/ubuntu14-HD.img,size=30 \
    > --vcpus 2 \
    > --os-type linux \
    > --os-variant ubuntu16.04 \
    > --network bridge=bridge:br0 \
    > --graphics none \
    > --console pty,target_type=serial \
    > --location /home/veeru/Downloads/ubuntu-16.04.5.iso --force \
    > --extra-args 'console=ttyS0,115200n8 serial' \
    > --host-device 01:00.0 \
    > --features kvm_hidden=on \
    > --machine q35 
    
    Starting install...
    Retrieving file .treeinfo...                                                                    |    0 B  00:00:00     
    Retrieving file content...                                                                      |    0 B  00:00:00     
    Retrieving file info...                                                                         |   67 B  00:00:00     
    Retrieving file vmlinuz...                                                                      | 6.8 MB  00:00:00     
    Retrieving file initrd.gz...                                                                    |  14 MB  00:00:00     
    

    下面是我做的输出 strace 以上命令的处理

    veeru@ghost:~$ sudo strace -p 9747
    strace: Process 9747 attached
    restart_syscall(<... resuming interrupted poll ...>
    

    PS:我的笔记本电脑是 Predator Helios 300 (UEFI安全引导),GPU:Nvidia Geforce GTx1050ti,Ubuntu Mate 18.04(已安装Nvidia驱动程序),8GB RAM,

    1 回复  |  直到 7 年前
        1
  •  0
  •   Veerendra K    7 年前

    好的,我看到问题了,主机(我的笔记本电脑)已经在使用GPU了,也就是说它很忙。所以,当我跑步的时候 virt-install 命令,它永远挂着,这也不足为奇。

    要解决此问题,请将x11切换为使用CPU。我使用Ubuntu Mate 18.06,它有一个方便的工具,可以像下面的屏幕截图一样切换。

    enter image description here

    注销、登录和检查Nvidia GPU后,任何进程都不会通过运行 nvidia-smi 它应该类似下面的输出。

    veeru@ghost:~$ nvidia-smi 
    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
    

    现在你应该能跑了 VILT安装 像我一样。