question

EnricoDeRonzi-7605 avatar image
0 Votes"
EnricoDeRonzi-7605 asked tastewar-8257 answered

Hyper-V advanced session doesn't work

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-10-hyperv
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
1 Vote"
DSPatrick answered PetShwark-8505 published

Something here might help.
https://medium.com/@francescotonini/how-to-install-ubuntu-20-04-on-hyper-v-with-enhanced-session-b20a269a5fa7


--please don't forget to Accept as answer if the reply is helpful--




· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This worked perfectly for me, but editing the xrdp.ini file as described was crucial.

0 Votes 0 ·

This worked perfectly for me, but editing the xrdp.ini file as described was crucial.

0 Votes 0 ·
XiaoweiHe-MSFT avatar image
1 Vote"
XiaoweiHe-MSFT answered einaradolfsen commented

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


If the Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

searching in issues for linux-vm-tools repo at github I came over this issue:
Missing support for Ubuntu-20.04 #114 looks as there is some workarounds in this thread to make it work for 20.04


0 Votes 0 ·
Josep-3434 avatar image
0 Votes"
Josep-3434 answered

Forget about it.
There's no one simple way to do it. There are lots of settings to try and combinations increase exponentially.
And those who have succeeded doesn't come back here anymore.
Or you're gonna google-find the same useless "copy-paste" answers everywhere.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

James88S avatar image
0 Votes"
James88S answered James88S published

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!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

einaradolfsen avatar image
0 Votes"
einaradolfsen answered 68592707 commented

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?



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I got quick create to work for 20.04 TLS. Here are the key steps:

  1. Either use Quick create VM (lot easier but doesn't give you gen2) or install from ubuntu ISO and do XRDP setup

  2. Enable Secure Boot and select template "Microsoft UEFI Certificate Authority" template.. This is in VM Security tab.

  3. From Admin Powershell: Set-VM -vmname "<vmname>" -EnhancedSessionTransportType HvSo

0 Votes 0 ·
Ryan-7956 avatar image
2 Votes"
Ryan-7956 answered GianlucaR-1438 published

I was having the same problem, and it was driving me crazy. If I reset windows while leaving the VM instance running, I could access it via enhanced session. But once I ended that session, I could not access it again via enhanced without first restarting the PC.

I did fine one workaround that's been working for me that I thought I'd share: I found if I saved the machine and then started it back up, it would always allow for an enhanced session - and subsequent connections do too. No idea why, but I've been using it this way for several weeks now and it always works.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for sharing it! It solved me too!

0 Votes 0 ·
JamesWoods-0409 avatar image
0 Votes"
JamesWoods-0409 answered

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-7956 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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JNDAccts-0101 avatar image
0 Votes"
JNDAccts-0101 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tastewar-8257 avatar image
0 Votes"
tastewar-8257 answered

This is not an "Answer" per se, but just a response or comment. I don't know if that means it doesn't really belong here, but I didn't see another option for adding to the "discussion."
I have had it happen to me on numerous occasions that I lose my ability to use Enhanced Session, and inevitably always eventually find my way to this page. It happened to me twice in the past week, when nothing had changed on either the Linux or Windows side. First time (this week, that is...), I went through the entire setup on the Linux side again, to no avail. Turned out the key was running the:

Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket

command (as admin). The second time, it was recent enough that I remembered not to bother with the install on the Linux side (though not recent enough that I still had the browser tab open). And after it happened the 2nd time, I realized that one thing which tied the two events together was that both times, I came to my computer in the morning to find it unresponsive, and had to power it down, then back on.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.