0
votes

I want to run VMs that uses host's GPU. For that, I followed this docs to enable modules/grub configurations. Looks like I successfully configured, I can see dmesg | grep -i vfio. But when I run virt-install, it is hanging forever, parallely I can't run even virsh list --all. Every time I have to restart my laptop, in order to run any virsh/virt-install commands again.

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     

Below is the output when I do strace of process for above command

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

PS: My laptop is Predator Helios 300(UEFI-Secure Boot), GPU: Nvidia GeForce GTX1050Ti, Ubuntu Mate 18.04(Installed nvidia drivers), 8GB Ram,

1

1 Answers

0
votes

Ok, I see the problem, the GPU is already being used by host(my laptop) i.e it is busy. So, when I run virt-install command, it hangs forever which is no wonder.

In order to resolve the issue, switch your X11 to use CPU. I use Ubuntu Mate 18.06 which has handy tool to switch like in below screenshot

enter image description here

Ater that logout and login and check nvidia GPU is not being used by any process by running nvidia-smi; it should similar output like below.

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.

Now you should able to run virt-install like me.