A
A
arbrspb2021-05-19 20:30:52
linux
arbrspb, 2021-05-19 20:30:52

How to forward a video card to a virtual machine?

There is a server with ubuntu linux installed on it. The essence of the task is to put a virtual machine on it in which it will be possible to forward a physical nvidia video card to use it in mining. It is planned to install wondows 10 on the virtual machine. Is it possible to implement this? The server has remote access via ssh

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis _______________, 2021-05-19
@LuchS-lynx

arbrspb ,

There is a server with ubuntu linux installed on it. The essence of the task is to install a virtual machine on it in which it will be possible to forward a physical nvidia video card to use it in mining. It is planned to install wondows 10 on the virtual machine. Is it possible to implement this?

1. About the main thing! For iron.
- The server must have physical access for initial setup. All these configurations, on-off and connection to the monitor in order to see firsthand.
- Hardware should support VT-d (now almost everyone has support for this technology) and VT-x. (For AMD AMD-Vi, IOMMU) Be sure to activate these technologies in the BIOS. If at this stage VT-x cannot be enabled, or it does not turn on together with VT-d, then we go to change the hardware, and change it until the option is activated and in any OS of the program the hardware analyzers show that the technology is enabled and working. You can use cheats, in the form of an analysis of someone else's experience, i.e. cosplay configs of those users on the network who boastfully claim to be even better, show that they succeeded.
- Iron. You edit Grub, activating it
for Intel processors
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
for AMD processors
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"
Next, after rebooting the host, open the console and execute as it is written in copy-paste from the corresponding Wiki section:
1) Run the "dmesg | grep ecap" command.
2) On the IOMMU lines, the hexadecimal value after "ecap" indicates whether interrupt remapping is supported. If the last character of this value is an 8, 9, a, b, c, d, e, or an f, interrupt remapping is supported. For example, "ecap 1000" indicates there is no interrupt remapping support. "ecap 10207f" indicates interrupt remapping support, as the last character is an "f".
Interrupt remapping will only be enabled if every IOMMU supports it.

If a bummer awaits you here, then again we change the mother until we pass the test.
2. About no less important. About software.
If everything worked out, then there are 2 ways, either KVM + QEMU, or Proxmox (an add-on for Debian Linux + KVM). Those. or KVM or KVM. Then you use guides, for example:
Ubuntu KVM + QEMU: ubuntovod.ru/instructions/probros-videokarty-v-kvm...
Proxmox: https://habr.com/en/post/437598/
About Nvidia and Error 43.
During the setup process, you can have a problem that is widely known in narrow circles as Error 43, this is the Nvidia video card driver that does not allow VK to run in the VM. It is treated by editing configs in order to hide from the driver that the equipment is forwarded to the VM.
in Proxmox it is treated by making additional. parameter to the VM configuration file:
args: -cpu 'host,+kvm_pv_unhalt,+kvm_pv_eoi,hv_vendor_id=willitwork,kvm=off'

It is also treated by prescribing such commands:
echo "softdep nouveau pre: vfio-pci" >> /etc/modprobe.d/nvidia.conf
echo "softdep nvidia pre: vfio-pci" >> /etc/modprobe.d/nvidia.conf
echo "softdep nvidia* pre : vfio-pci" >> /etc/modprobe.d/nvidia.conf

The same is done in Ubuntu KVM + QEMU, but hv_vendor_id=willitwork is registered in libvirt.xml
https://www.reddit.com/r/VFIO/comments/479xnx/gues...
After successful configuration, it looks like this:
https: //www.youtube.com/watch?v=wjlmWHJiEug
PS.
Here Nvidia claims that, allegedly, in the latest versions of the drivers, it will no longer spoil users with error 43, but this is not accurate.
https://habr.com/ru/news/t/550678/
In particularly stubborn cases, it may be necessary to replace the VK ROM through the hypervisor, or even flash the BIOS of the Video Card. But in recent years, these technologies are becoming a thing of the past.

K
ky0, 2021-05-19
@ky0

Some dubious idea - why do you need a layer in the form of virtualization? In my opinion, Linux is usually recommended as the OS for mining.

C
CityCat4, 2021-05-19
@CityCat4

nvidia - almost nothing. nvidia deliberately prevents Windows drivers from starting if it detects video card forwarding. Well, besides this, you need some good luck with iron and the ability to set it all up.
With AMD you can - I didn’t do it myself, but there is one success story

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question