Hyper-V advanced session doesn't work

Enrico De Ronzi 1 Reputation point
2020-10-25T15:37:37.02+00:00

Hi to all,
I have Windows 10 Pro, Remot Desktop enabled, hyper-v enabled with advanced session enabled in both the setings points:
Under Server, select Enhanced session mode policy DONE
Under User, select Enhanced session mode. DONE

I use as virtual system Ubuntu 20.04

When I run the VM, in "show" I see in gray color the "advanced session" menu voice.

So, I can't use it.
Can you help me, please?

Enrico

Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
{count} votes

9 answers

Sort by: Most helpful
  1. James88S 1 Reputation point
    2020-11-24T04:17:48.803+00:00

    I believe anonymous user-3434 is largely correct in that I found all relevant answers direct to:

    • a prior version or a pull request version of linux tools install.sh script that ensures xrdp is installed and running, and/or
    • making changes to /etc/default/grub that are no longer relevant to ubuntu releases, and/or
    • running various powershell scripts (set-vm or set-vmvideo or VMConnect), and/or
    • toggling Hyper-V Settings for Allow Enhanced Sessions,

    none of which appear to reliably work or create repeatable outcome such that Hyper-V connects to ubuntu 20 and shows the xrdp login page.

    Two times I managed to get it automagically to connect and show the xrdp login screen, on successive days after many repeated attempts of the proffered solutions.

    However, both times a shutdown of the laptop PC stopped it all working on start-up, even if a VM checkpoint was carried out.

    As such, I do not believe it is related to an ubuntu 20 issue, but rather Hyper-V not correctly invoking VMConnect for the Ubuntu 20 VM such that:

    a) the edit session settings dialog is shown, or
    b) a previously created vmconnect.rdp.<VMId> file located in C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Hyper-V\Client\1.0

    Note that "/edit" option fails to force VMConnect to launch the edit session settings dialog, regardless of whether $ set-vm -VMName <name> -EnhancedSessionTransportType HvSocket has been called or not (although I believe this must be run at least once to achieve a random launch of VMConnect that DOES show the session settings dialog or use an existing file).

    Also note, I can get my Ubuntu 18.04 VM to exhibit the same behaviour i.e. bypass xrdp logon by launching Edit Session Settings and then cancelling (clicking top-right X button) the VMConnect edit session settings dialog window.

    Hopefully this additional detail may help others to diagnose a reliable work-around for this bug until Microsoft fix it.

    Note: Running Windows 10 Pro v1909 OS build 18363.1198 and Hyper-V Quick Create VM Ubuntu 20.04 .1 LTS

    * UPDATE *

    Okay, minutes after I completed this post Windows Update installed a cumulative patch and following the Windows OS restart the Edit Session Settings now shows as an option against my running Ubuntu 20 VM for the first time!! And connecting (either via Connect... or via Edit Session Settings...) lands on xrdp, adhering to any setting changes. And the windows VM application window menu option "View->Enhanced Session" is checked.

    So ... fixed??? Let's see whether this persists. ;-)

    * UPDATE 2 *

    Further pieces of this weird puzzle....

    1. (Repeatable) If Windows 10 OS is * RESTARTED * while the VM is running then when Hyper-V is opened again the Edit Session Settings... option will appear,
    2. (Repeatable) If Windows 10 OS is * SHUTDOWN AND STARTED * while the VM is running then when Hyper-V is opened again the Edit Session Settings... option will not appear,
    3. (Mostly Repeatable) If Ubuntu 20 VM is "Turn(ed) off"/"Shutdown" and then "Start"(ed) via Hyper-V Manager (or via PowerShell) then the Edit Session Settings... option disappears from the right-click menu * and remains missing * through various VM restarts and/or Hyper-V Manager exit and opens and/or Windows User logout/logins and/or Hyper-V Virtual Machine Management service restarts etc.
    4. (1 in 10-20 iterations) If the VM restart is "not observed" at (i.e. close Hyper-V Manager immediately after a start request or don't have the VM selected during start process) then Edit Session Settings... options * MAY * appear in the right-click menu when the VM is selected when running idle at the Gnome logon screen (as viewed in the VM Summary tab),

    So, the first piece of sentient code I stumble across happens to be a shy menu option that only appears as an encore! :-D

    However, option 1 is now available to me as a work-around. Following any restart of my Ubuntu 20 VM then I need have it running and restart the laptop to enable an Enhanced Session connection via xrdp, either via Hyper-V Manager or VMConnect.

    I hope you can repeat these steps to have a working xrdp session too!

    0 comments No comments

  2. ranie 1 Reputation point
    2020-12-31T11:27:14.713+00:00

    I followed Scott Hasselman's blog post using-enhanced-mode-ubuntu-1804-for-hyperv-on-windows-10, which uses Hyper-V Quick Create to create ubuntu 18 virtual machine with enanched mode enabled out of the box. The critical point here is: to make sure to select Require my password to log in since automatic login does won't work, according to Scott. This installation is quick and easy and works out fine for ubuntu 18.

    Following the same approach using Ubuntu 20.04.01 LTS image in Hyper-V Quick Create>Select an operating system pane, does not work.

    So what has changed?


  3. James Woods 6 Reputation points
    2021-09-22T05:31:34.803+00:00

    I'm having the same problem as everybody else with Ubuntu 20.04. I'm also seeing the behaviour that if I restart if I restart my PC while the VM is running and then connect to it after the PC then the enhanced session will be activated. And as @Ryan noted, saving the session and restarting it works, effectively retaining the one session forever.

    After the initial PC restart I get a black screen after logging in, which indicates my previous login is still active. Other people have noted this and simply stated that you need to log the other session off but didn't state how to do this. The trick is as follows:

    1. Click on the 'Enhanced Session' button to toggle back to 'Basic Session'.
    2. Login with your credentials to resume the previous basic session.
    3. Logout of that basic session.
    4. Click on the 'Enhanced Session' button to toggle back to 'Enhanced Session'.
    5. Login with your credentials to start your enhanced session.

    Regarding some of the previous comments saying this is a fault in Hyper-V, what I can add is that Ubuntu 18.04.03 LTS works just fine out of the box, enhanced session mode always works.

    0 comments No comments

  4. JND Accts 1 Reputation point
    2022-04-18T00:07:51.533+00:00

    Just wanted to let everyone know that "XiaoweiHe-MSFT" solution worked for me. I performed a clean install of the preconfigured Ubuntu 18.04.3 LTS image via Hyper-V "Create Quick..." menu. After following the instructions below, I was able to login to the VM via Enhanced session using the Xorg option from the dropdown list (I used the same credentials I provided during the installation process). Hope this helps anyone struggling with this because it was a major PITA.

    Best,
    Andrew

    XiaoweiHe-MSFT answered • Oct 26 2020 at 1:02 AM | einaradolfsen commented • Dec 31 2020 at 7:02 AM

    Hi,

    Please make sure you have an Ubuntu Desktop image. These steps will not work for Server-based images. From a clean install of an Ubuntu 18.04 image, issue the following commands in a terminal:

    wget https://raw.githubusercontent.com/Microsoft/linux-vm-tools/master/ubuntu/18.04/install.sh
    sudo chmod +x install.sh
    sudo ./install.sh

    After you’ve run your scripts, shut down your VM. On your host machine in an Administrator powershell prompt, execute this command:

    Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket

    Thanks for your time!
    Best Regards,
    Anne


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.