How to setup xRDP for Ubuntu 20.04 in Windows Hyper-V?

21,222

Solution 1

Apparently Microsoft haven't added support for 20.04 yet. There is a pull request on GitHub but it is yet to be merged. However, you can use it.

To set up xRDP for Ubuntu 20.04 LTS,

  1. Disable "Auto Login" if you enabled it.

  2. Open a terminal and issue the following commands.

    wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh
    sudo chmod +x install.sh
    sudo ./install.sh
    
  3. 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
    
  4. Start your virtual machine and connect. You will be greeted with a connection prompt windows that asks for a screen resolution--this will indicate that everything is installed correctly. vmconnect

  5. This will take you to a Xorg login. This indicates that you've successfully brokered a connection and that the xrdp service is running. Login to begin your session. xrdplogin

Solution 2

I would like to add an additional step to Sasuke Uchiha's great post:

After finishing step#2, the VM terminal will prompt you to reboot the VM which can be done by simply $reboot.

Doing so will put the VM in a "saved" state which will require you to turn it back on by pressing "start".

After the reboot, go back to your VM terminal and run the third command once again to finish the installation process OR THE REST OF THE STEPS WILL NOT WORK!!!

sudo ./install.sh

You will know that the installation has completed successfully when you see the following:

Install is complete. Reboot your machine to begin using XRDP.

Big props to Sasuke and Hinara for carrying Microsoft's lack of quick-PR-merge weight!

Share:
21,222
VidathD
Author by

VidathD

New to Ubuntu. Exploring...

Updated on September 18, 2022

Comments

  • VidathD
    VidathD over 1 year

    I want to know how to setup xRDP for Ubuntu 20.04 in Windows Hyper-V? Tutorials for Ubuntu 18.04 doesn't seem to work. I am using the ISO that I downloaded.

    These are the tutorials I used. They all basically say the same thing...

  • Jon Watte
    Jon Watte over 3 years
    This almost works for me. I can see a login session with my name. When I mouse over the HyperV window, the Windows cursor is hidden. However, the cursor on the linux desktop does not move, and I cannot make it take click events. When I keep moving the mouse, the Windows cursor shows up again outside the window. I'm presumably missing some mouse driver module, but which one? The status icons on the bottom say "keyboard captured" and "mouse not captured," and I can't change them. Ctrl-Alt-Rightarrow does nothing.
  • rize
    rize over 3 years
    I'm working with sensitive data and so do you know about the security of this setup i.e. could this expose my VM to public internet or even my organisation network through RDP? Or is it just my local computer ie. host OS win 10?
  • Stefan Golubović
    Stefan Golubović over 3 years
    I would also add that it doesn't work well with the image from Quick Create. At least, it didn't work for me, and I'm not the only one.
  • JimLohse
    JimLohse over 3 years
    I get to the final screenshot, login in and just get a black screen
  • VidathD
    VidathD over 3 years
    @JimLohse Do you have autologin enabled in Ubuntu during install
  • JimLohse
    JimLohse over 3 years
    Thanks, that was it. In LXQt had to edit the /etc/sddm.conf.d/autologin.conf file per askubuntu.com/a/1124789/471065 to turn off the auto-login
  • EM90
    EM90 about 3 years
    Can't understand why, but this procedure doesn't work in my case. I followed every single step, but without any success.
  • VidathD
    VidathD about 3 years
    @EM90 Can you give some details as to "doesn't work"?
  • EM90
    EM90 about 3 years
    Yeah: I simply get a black screen (after inputing the login credential in the screen above) for 1 second (at most!), then the connection drops.
  • EM90
    EM90 about 3 years
    For the time being, I decided to get back to good old Ubuntu 18.04, which works great for my current needs... Though, if you can give me more insight, I'd be very grateful!
  • andrew pate
    andrew pate almost 3 years
    I found I had hourly dropouts, doing the following seems to have cured it: hypervmanager->[yourvm]->hardware->network->hardware acceleration -> VMQ ... Set this to off . as mentioned here: dmunified.com/2016/05/16/…
  • Tim Wißmann
    Tim Wißmann almost 3 years
    For some reason, xRDP was not able to start it's service after a reboot in my case. It showed an error message, that the address is already in use (or something like that). What fixed the problem was changing the port line in /etc/xrdp/xrdp.ini from port=3389 to port=vsock://-1:3389 and setting use_vsock=false.
  • VidathD
    VidathD almost 3 years
    Upvoted. I think Microsoft archived their repo 🤷‍♂️.