Black screen on Ubuntu 20.04 VM with GPU passthrough


Recommended Posts

Im having an issue getting a Ubuntu 20.04 VM working with GPU pass-through.  Im on Unraid 6.7.2 and setup the VM using the Ubuntu template.  It works fine with VNC but I cant get it working with GPU pass through.  I have a Ubuntu 18.04 VM that works fine using the same GPU and settings.  I stopped my Ubuntu 18.04 VM, made sure the template for Ubuntu 20.04 VM is setup with exactly the same 8 CPU cores, 16GB of RAM, same GPU set for video and audio card.  The machine is set to Q35-3.1 and the Bios is OVMF.  I also edited the xml file to add the GPU rom file and match the bus and add the multifunction tag.  Everything is setup exactly the same for both VMs but only the Ubuntu 20.04 VM has no pic, I just get a black screen.

If anyone can offer any suggestions to get this working I would appreciate it.

Thanks in advance!

Link to comment
  • 2 weeks later...

So over this past week I tried to setup multiple other Linux VM's.  I have now tried multiple distro's based on Debian, Arch, and Redhat.  I also tried creating another Ubuntu 18.04 VM but I have the same issue on all of them...VNC works fine, but when I pass through a GPU I get a black screen.  So I created a Windows 10 VM using the same GPU and passthrough works fine.  It also still works fine on my old Ubuntu 18.04 VM with the same GPU.  I just cant get it working for any new Linux VM I create.  I also updated Unraid to 6.8.3 and again created multiple Linux VM's but I still have the same issue. 

Does anyone know if something changed about how to pass through a GPU to Linux VM's?

genisys-diagnostics-20200513-1629.zip

Edited by Tonitram
added diagnostics
Link to comment

Managed to install Ubuntu 20.04 by choosing safe graphics mode on first install (with GPU already passed through). It has now rebooted into normal mode and is running at 4k 60 without an issue at the moment.

 

Edit:- And it's gone again after a reboot, it must be related to the graphics mode. Maybe need to edit grub before rebooting again.

 

Edit 2:- Now I can't boot my Windows 10 VM without rebooting my server. Maybe this is related to using a Navi based GPU although I'm running the modded kernel to help with the reset issue. What GPU are you using?

Edited by cobhc
Link to comment

Im just using a cheap Nvidia GT710.  I dont need great graphics for my purposes. 

  I made some progress...Last night I was finally able to get a picture with GPU passthrough on Ubuntu 20.04.  I had to create the VM right from the start with the GPU already set in the template.  In the past I always started the install using VNC, then changed the template to use a GPU after the install was completed, but every time I try it this way I only get a black screen.  Unfortunately because of the way I have my setup, starting with VNC would still be much easier. 

  I now have another issue though.  When I do the install this new way starting with the GPU setup first, I can get a pic and do the install but after the install is complete I cant update the VM.  Every time I try, my mouse and keyboard lock up and I have to force stop the VM.  Then I have to change the VM to VNC to update the VM, and then change back to GPU passthrough after that.  I also have no mouse or keyboard control at the UEFI shell prompt when I first try to setup any Arch based distro.  So I cant install anything Arch based anymore. 

 

  I dont know when the issue started because I only noticed the issue since Unraid 6.7.  I haven't made any hardware changes on my system.  The only thing that has changed is the version of Unraid that I'm using, so Im not sure if passthrough is supposed to be done differently now or if its something else. I'm hoping someone from Unraid, or any experienced user, will eventually see this post and be able to help me because I have no idea what I am doing wrong.

Link to comment
  • 1 month later...

Bumping this as I'm still having the same issue, no Linux distro seems to reliably work with GPU passthrough without rebooting the server in between shutting down the VM. Whereas any Windows VM works fine.

 

@Tonitram Are you still having the issue as well?

Link to comment
  • 2 months later...
On 5/16/2020 at 6:02 PM, Tonitram said:

Im just using a cheap Nvidia GT710.  I dont need great graphics for my purposes. 

  I made some progress...Last night I was finally able to get a picture with GPU passthrough on Ubuntu 20.04.  I had to create the VM right from the start with the GPU already set in the template.  In the past I always started the install using VNC, then changed the template to use a GPU after the install was completed, but every time I try it this way I only get a black screen.  Unfortunately because of the way I have my setup, starting with VNC would still be much easier. 

  I now have another issue though.  When I do the install this new way starting with the GPU setup first, I can get a pic and do the install but after the install is complete I cant update the VM.  Every time I try, my mouse and keyboard lock up and I have to force stop the VM.  Then I have to change the VM to VNC to update the VM, and then change back to GPU passthrough after that.  I also have no mouse or keyboard control at the UEFI shell prompt when I first try to setup any Arch based distro.  So I cant install anything Arch based anymore. 

 

  I dont know when the issue started because I only noticed the issue since Unraid 6.7.  I haven't made any hardware changes on my system.  The only thing that has changed is the version of Unraid that I'm using, so Im not sure if passthrough is supposed to be done differently now or if its something else. I'm hoping someone from Unraid, or any experienced user, will eventually see this post and be able to help me because I have no idea what I am doing wrong.

Just bumped into this.

It has been a while since i played around with this, but the problem of your keyboard and mouse seemed something i had encountered before on a project i was working on.

Don't know if this is still the case for ubuntu 20.04, but in Ubuntu 16.04 i had the same issue of the keyboard and mouse not working when working with Nvidia grid licenses.

Was able to solve this by :

- Updating the VM , but NOT restarting it yet.

- Before restart run: apt-get install xserver-xorg-input-all

- Reboot

After doing this i was still able to use keyboard and mouse in the ubuntu vm.

But still , seeing as this was on 16.04 , not sure if this is still applicable. 

Link to comment
  • 3 weeks later...
  • 1 month later...
  • 2 weeks later...

ok, I got it working. Took weeks of effort... and has been a rough journey.

 

If it helps someone else... here is what seemed to work for me....

  • My environment
    • Swapped over the unraid 6.9 rc2. Seems quite stable now. Nice handling of vfio.
    • onboard video (intel) used for unraid (set as primary in bios)
    • MSI GTX 1050 ti oc - Nice card but very finicky.
    • Tried Manjaro KDE/Gnome Win10, PopOs, Ubuntu Gnome - either got black screen or LLVMpipe for video.
    • Tried a bunch of vbios available from techpowerup.
    • Tried dumping my own bios from unraid as per spaceinvader
  • Solution
    • I downloaded HirenBootCD, took out the unraid usb key and started the server with Hiren. It come up in Windows PE
    • tweak your bios and ensure gtx 1050 is set as primary. Attach monitor too...
    • run GPU-Z (included in Hiren), and dump the vbios.
    • Strip out the header of the vbios using a python program or hex editor as per spaceinvader
    • Attach physical monitor to the gtx hdmi, and fire up your vm from another machine (desktop)
    • I use nomachine as remoting software. so remote to the vm and worked great on ALL of the above VM's
      • todo: Substitute an HDMI dummy plug instead of physical monitor.

 

 

  • Confused 1
Link to comment
  • 1 month later...

good luck with it..

Bear in mind, I got very uneven results, until such time I put an HDMI dongle on the graphics card hdmi port. After that its been smooth sailing.

Also does not hurt to dump the bios to ensure the card is working with original bios. I could never get a consistant result trying to use one of the techz bios downloads.

 

Good luck with it.

/ben

 

Link to comment
  • 2 weeks later...

Same issue with me. UnRaid 6.9.0 stable, GPU is GT 710, Linuxmint VM, installed using vnc. After installation and reboot, it turns black nodisplay. 

 

I have another LinuxmintVM booting from a physical disk - display fine.

 

Im working on a workaround and will post update here when successful

 

 

Link to comment

I'm having similar issues with Windows 10 and GPU Passthrough w. Unraid 6.9

- VFIO bind RTX2080 via System Devices + reboot

- Start Windows results in black screen

- (Zorin also results in a black screen)

 

/var/log

Mar 4 14:07:17 ThreadRipper kernel: vfio-pci 0000:42:00.0: BAR 1: can't reserve [mem 0x80000000-0x8fffffff 64bit pref]

 

VM Log

2021-03-04T22:07:12.979196Z qemu-system-x86_64: vfio_region_write(0000:42:00.0:region1+0x101260, 0x0,8) failed: Device or resource busy

 

Any help is much appreciated! 

---------

-added: Unraid version

Edited by Rens
Link to comment
9 hours ago, garydapogi said:

Same issue with me. UnRaid 6.9.0 stable, GPU is GT 710, Linuxmint VM, installed using vnc. After installation and reboot, it turns black nodisplay. 

 

I have another LinuxmintVM booting from a physical disk - display fine.

 

Im working on a workaround and will post update here when successful

 

 

 

I got it working!

 

I've cloned the physical disk to an image using the guide from the wiki - Physical to VM conversion.

It is a Linuxmint 20.1 and it worked using the vdisk image. 

 

The gpu btw which is a NVIDIA GT710 is using an edited dumped bios as per SpaceInvaderOne guide.

 

The physical disk has nvidia drivers in it and has the latest updates, along with Linuxmint updates

 

Edited by garydapogi
additional note
Link to comment

In my case (AMD GPU) it must have been a byproduct of the Navi reset bug, as using gnif's vendor reset patch I can now boot any VM with GPU passthrough without issue.

 

I'm confused as to why those of you with Nvidia GPU's are still experiencing issues.

Link to comment
  • 8 months later...
Quote

The physical disk has nvidia drivers in it and has the latest updates, along with Linuxmint updates

Well this put me on the right track. I have a Unraid server with a single GPU a MSI Geforce GT 710.

I was having trouble with a simular issue aswell. I tried to install a Ubuntu VM. The installation would go through, but after the installation it simply looked like it didn't work anymore. Black screen all the way. I tried every suggestion I could find.

Turns out... the installation was simply installing the wrong nvidia drivers...

Setting up the VM with my GPU passed through worked, after the install black screen. I changed my Graphics card in the VM to VNC. Logged in and installed the correct drivers using the following commands:
  sudo apt-get purge nvidia*
  sudo add-apt-repository ppa:graphics-drivers
  sudo apt-get update
  sudo apt-get install nvidia-470

Afterwards I shutdown the VM, changed the graphics card setting back to my GT 710 and voila everything works as a charm again.
This took me way to long to figure out...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.