12

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

VidathD
  • 2,594
  • 5
  • 18
  • 49
  • here is xrdp with sound - https://techbloggingfool.com/2020/12/26/deploy-a-linux-vm-on-hyper-v-with-sound-20-04-edition/ – ns15 Oct 15 '21 at 20:47

2 Answers2

16

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

VidathD
  • 2,594
  • 5
  • 18
  • 49
  • 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. – Jon Watte Oct 07 '20 at 21:47
  • 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? – rize Dec 18 '20 at 08:10
  • 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](https://github.com/microsoft/linux-vm-tools/pull/106#issuecomment-623732161). – Stefan Golubović Dec 21 '20 at 13:40
  • I get to the final screenshot, login in and just get a black screen – JimLohse Jan 09 '21 at 17:14
  • @JimLohse Do you have autologin enabled in Ubuntu during install – VidathD Jan 09 '21 at 23:18
  • Thanks, that was it. In LXQt had to edit the /etc/sddm.conf.d/autologin.conf file per https://askubuntu.com/a/1124789/471065 to turn off the auto-login – JimLohse Jan 11 '21 at 06:01
  • Can't understand why, but this procedure doesn't work in my case. I followed every single step, but without any success. – EM90 Apr 10 '21 at 11:21
  • @EM90 Can you give some details as to "doesn't work"? – VidathD Apr 21 '21 at 20:46
  • 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 Apr 22 '21 at 13:38
  • 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! – EM90 Apr 22 '21 at 13:40
  • 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: https://dmunified.com/2016/05/16/hyper-v-vms-losing-network-connectivity-beware-vmq/ – andrew pate Jun 13 '21 at 18:57
  • 1
    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`. – Tim Wißmann Jun 23 '21 at 14:38
1

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!