Hyper-V: Ubuntu 16.04 and remoteFX

25,326

Solution 1

  1. Open Terminal
  2. Type: sudo vi /etc/default/grub Find the line
  3. starting with GRUB_CMDLINE_LINUX_DEFAULT, and add video=hyperv_fb:[the resolution you want]. The resolution I want is 1280x720. So my line ends up looking like this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1280x720"
  4. Write the changes and quit vi.
  5. Run: sudo update-grub
  6. Reboot the virtual machine

I found this on msdn Blog, it worked for me.

Solution 2

I was looking for a way of changing resolution too, and I was editing /etc/default/grub, until I found Sneak Peek: Taking a Spin with Enhanced Linux VMs from Microsoft, which now links to Run Ubuntu virtual machines made even easier with Hyper-V Quick Create. I tried doing what they describe on Ubuntu 18.04, on two computers running Windows 10 Pro Version 1803 (OS Build 17134.112). I obtained the same result on both the computer, even if in both the computers the output of Get-Help Get-VM was the following one.

SYNTAX
    Get-VM [[-Name] <String[]>] [-CimSession <CimSession[]>] [-ComputerName <String[]>] [-Credential <PSCredential[]>]
    [<CommonParameters>]

    Get-VM [[-Id] <Guid>] [-CimSession <CimSession[]>] [-ComputerName <String[]>] [-Credential <PSCredential[]>]
    [<CommonParameters>]

    Get-VM [-ClusterObject] <PSObject> [<CommonParameters>]

As you can see, the Powershell command that should be used is not even reported, and running Update-Help before Get-Help Get-VM changed its output, but the procedure described in that article works the same.

The instructions they provide in the article are for Ubuntu 16.04, but the files they give are for Ubuntu 16.04 and Ubuntu 18.04. There is a slight difference between what it needs to be done for Ubuntu 16.04 and Ubuntu 18.04, and I will highlight that difference.

The crucial part of the procedure is a Powershell command. Since I didn't test the procedure on other Windows versions, I cannot assure it works on every Windows version, on even on every Windows 10 version.

On the guest OS side, you need to:

Keep in mind that install.sh needs to run twice; after that, you can run config-user.sh.
If you are instead doing it for Ubuntu 18.04, the directory is linux-vm-tools/ubuntu/18.04, and there is no config-user.sh file. (You need to execute just install.sh.)

If you just installed Ubuntu, or if you didn't update it in a long time, I would suggest to run sudo apt-get update && sudo apt-get ugrade before install.sh, and resolve any updating problems before running install.sh.

From the host OS side you need to:

  • Add RemoteFX 3D Video Adapter hardware to the virtual machine running Ubuntu

    screenshot

  • In Hyper-V settings, select the GPU to use, and enable it for RemoteFx

    screenshot

  • In Hyper-V settings, enable the enhanced session mode

    screenshot

  • From a Powershell window opened as admin, execute the following command

    Set-VM -VMName <ubuntu-vm-name>  -EnhancedSessionTransportType HvSocket
    

(Replace <ubuntu-vm-name> with the name of your virtual machine running Ubuntu.)

If all went fine, when you restart the Ubuntu virtual machine, you will see the following window.

screenshot

Clicking on Show Options will give you more share options, for example the one for sharing the clipboard (guest to host, and vice versa), or for sharing the printer.

screenshot

You will be also able to save the settings for future connections to the same virtual machine, but in that case you will not be able to see that window again. I clicked on Save my settings for future connections to this virtual machine by mistake, and I had to change name to the virtual machine, and execute Set-VM -VMName <ubuntu-vm-name> -EnhancedSessionTransportType HvSocket again, to see the settings window.

After you click on Connect, you will see the following window, to log in to Ubuntu.

screenshot

As for the guest OS instructions they give:

  • Instead of git clone https://github.com/Microsoft/linux-vm-tools.git ~/linux-vm-tools, you can execute cd && git clone https://github.com/Microsoft/linux-vm-tools.git

  • It's not required to add sudo in sudo chmod +x install.sh because the file is in your home directory and you are the owner of the file.

As final note, the Remote audio settings don't work with Ubuntu. They work only when the guest OS is Windows, as far as I understood.

Share:
25,326

Related videos on Youtube

nikferrari
Author by

nikferrari

Updated on September 18, 2022

Comments

  • nikferrari
    nikferrari over 1 year

    I have windows 10 pro, and an ubuntu 16.04 installation as guest in my Hyper-V. The video performance is pretty poor (an order of magnitude choppier compared to the VMWare Player). To avoid this, I am trying to enable hardware acceleration, however, I am facing some issues.

    I have added the remoteFX (which should pass through my GFX 970), but I cannot change the resolution of the ubuntu guest which only has 1 option (800x600)

    Any experience with this, or VMWare is the only viable option for fluid GUI linux guests?

    I found this: MicrosoftFeedback

    I will try and report back

    • E.F. Nijboer
      E.F. Nijboer almost 7 years
      Don't bother because there is no support from hyper-v. VirtualBox and VmWare do but hyper-v does not. Install a desktop manager that supports rdp (for example Mate with xrdp) or use VNC. Good luck!
  • Trinimon
    Trinimon over 6 years
    This works, but isn't as fast as vmWare and in particular not as fast as VirtualBox. May be worth to add that you can add almost any resolution.
  • Anton Belov
    Anton Belov almost 6 years
    Note to others: before going through the process, please check whether -EnhancedSessionTransportType is an option to Set-VM command on your machine (run Set-VM -help) -- this only works on MS "insider" builds at the moment.
  • apaderno
    apaderno almost 6 years
    I am not using an insider preview release, right now. I am using Windows 10 Pro Version 1803 (OS Build 17134.112).
  • apaderno
    apaderno almost 6 years
    I tried on a second computer running the same Windows version. The command was not listed by Get-Help Get-VM, but the procedure worked the same. I guess that the command is implemented, but not listed.
  • apaderno
    apaderno almost 6 years
    Actually, in both the computers, the command that should be used is not listed from Get-Help Get-VM.
  • Anton Belov
    Anton Belov almost 6 years
    Hmm, I am on Windows 10 Enterprise Version 1703 (build 15063.1155). The option is not listed and when I try to run the command it complains. Judging by the build number my machine is behind, will wait for next update. Thanks for the post !
  • user7860670
    user7860670 over 5 years
    On Windows 10 Pro 1809 HyperV reports that RemoteFX adapters are not supported anymore so none of this works.
  • Mygod
    Mygod almost 5 years
    @VTT This article should have the solution for that: techcommunity.microsoft.com/t5/Windows-Server-for-IT-Pro/… Basically, Get-VMRemoteFXPhysicalVideoAdapter | Enable-VMRemoteFXPhysicalVideoAdapter, Add-VMRemoteFx3dVideoAdapter -VMName <vmname>, finally, "Open VM Settings dialogbox, you can configure RemoteFX vGPU".
  • akrv7591
    akrv7591 over 4 years
    Thank you, it works well for Ubuntu 19.0.4 in Hyper-V on Windows 10.