xrdp icon indicating copy to clipboard operation
xrdp copied to clipboard

Cannot establish RDP connection to Ubuntu VM made with Hyper-V Quick Create

Open zakimaksyutov opened this issue 5 years ago • 34 comments

I created Ubuntu VM on Windows by following Hyper-V Quick Create (https://blogs.windows.com/buildingapps/2018/09/17/run-ubuntu-virtual-machines-made-even-easier-with-hyper-v-quick-create/).

Connection from Hyper-V terminal works great (including enhanced session). But I cannot establish RDP connection to this VM from neither another box nor from host.

Both desktops can ping Ubuntu VM.

I wonder whether xrdp gets special configuration to work with Hyper-V out of the box. And as a result it doesn't accept standard RDP connections.

Message box:


[Window Title] Remote Desktop Connection

[Content] Remote Desktop can’t connect to the remote computer for one of these reasons:

  1. Remote access to the server is not enabled
  2. The remote computer is turned off
  3. The remote computer is not available on the network

Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.

[OK] [Help]


zakimaksyutov avatar Nov 29 '18 07:11 zakimaksyutov

Did you set a password in the install step for the user account?

nelsonjchen avatar Nov 29 '18 18:11 nelsonjchen

Yes, my Ubuntu VM has a user account with a password (I think I was asked at some point during Hyper-V Quick Create flow).

zakimaksyutov avatar Nov 29 '18 18:11 zakimaksyutov

Hi. Did you solve this as we are experiencing exactly the same issue. Thanks.

njonesn avatar Jan 22 '19 11:01 njonesn

Hi. Did you solve this as we are experiencing exactly the same issue. Thanks.

njonesn avatar Jan 22 '19 11:01 njonesn

I don't think this is an issue with xrdp, but instead how xrdp is configured within the Ubuntu image from Hyper-V. I encounter the same issue: after enabling RemoteFX for the VM, even connecting through the Hyper-V Managers goes through xrdp (as made obvious by the login screen), but I just can't connect using an RDP client, not from the host but also not from any other computer in my network. From netstat -l It seems xrdp isn't listening on the 3389 socket. I think this may be because the Ubuntu installed with Hyper-V sets use_vsock=true and security_layer=rdp. Changing these properties however does not fix the problem with regard to connecting other RDP clients and only seems to break the Hyper-V connectivity... Probably one step closer, but it seems something else has to be done too.

jwgmeligmeyling avatar Feb 05 '19 14:02 jwgmeligmeyling

FYI this post here: https://c-nergy.be/blog/?p=12429 seems to indicate that it's possible to enable network access while losing enhanced mode. Frankly I don't see the use of enhanced mode if I have to RDP into the server hosting the ubuntu VM and then remote into that again... I thought the whole idea of this setup was to allow us to remote into Ubuntu w/o going though VNC or some other slow protocol.

Anyway, haven't tested that "fix" yet.

jackmcdowell avatar Feb 13 '19 20:02 jackmcdowell

Hmm, so that blogpost has the same observation as I had. Now Im wondering: does xrdp even support RemoteFX without going through vsocks?

jwgmeligmeyling avatar Feb 13 '19 21:02 jwgmeligmeyling

See #1124, microsoft/linux-vm-tools#31. Reconfiguring xrdp and restarting the service should allow you to have a tcp connection or vsock connection, but not both.

That issue contains a hyperlink to a a prototype branch that include support for both, though.

cwilhit avatar Feb 19 '19 18:02 cwilhit

I was able to connect once I stopped selecting option to automatically sign in. On both 18 and 19 versions of Ubuntu.

burdiuz avatar Aug 14 '19 13:08 burdiuz

Thanks @burdiuz ! Your solution worked for me.

jlenos avatar Sep 05 '19 14:09 jlenos

I was able to connect once I stopped selecting option to automatically sign in

Where is this option? In Hyper-V or the xrdp config file?

jwgmeligmeyling avatar Sep 05 '19 14:09 jwgmeligmeyling

This option was presented on the initial setup of Ubuntu when defining the machine and user/password in the Ubuntu setup GUI

jlenos avatar Sep 05 '19 14:09 jlenos

I was able to connect once I stopped selecting option to automatically sign in

Where is this option? In Hyper-V or the xrdp config file?

This option was presented on the initial setup of Ubuntu when defining the machine and user/password in the GUI

If you click on the Power button top-right, expand your user name, go to Account Settings, you will see the Automatic Login checkbox.

leonmeijer avatar Sep 05 '19 14:09 leonmeijer

I was able to connect once I stopped selecting option to automatically sign in. On both 18 and 19 versions of Ubuntu.

I also needed to restart after changing the setting.

FERViborg avatar Nov 30 '19 22:11 FERViborg

I installed Ubuntu 19.04 with Hyper-V quick create.

Using Windows 10 1909.

I can not get this to work out of the box. I set a password during installation and made sure that auto login was disabled.

I can not connect via RDP or Enchanced Session, just the standard Hyper-V console

oskaremil avatar Dec 11 '19 07:12 oskaremil

To be able to connect via windows's Remote Desctop Connection modify the xrdp configuration file (/etc/xrdp/xrdp.ini): use_vsock=true replace with use_vsock=false

and restart xrdp sudo systemctl restart xrdp In this way xrdp will expect a connection via tcp, so you can connect to the virtual machine from windows.

d-murashkin avatar Dec 19 '19 09:12 d-murashkin

To be able to connect via windows's Remote Desctop Connection modify the xrdp configuration file (/etc/xrdp/xrdp.ini): use_vsock=true replace with use_vsock=false

and restart xrdp sudo systemctl restart xrdp In this way xrdp will expect a connection via tcp, so you can connect to the virtual machine from windows.

Just tried this, now I can't get in via Hyper-V Console or regular RDP.

RDP will load the xrdp teal login screen, but after login it remains blank.

Any ideas?

Tillman32 avatar Dec 27 '19 06:12 Tillman32

I had the same problem (blank screen upon login). The fix was to exit completely out of the Hyper-V Virtual Machine Connection window and reboot the VM. Seems you can't have two sessions open at once (there is no indication in the logs except that the session exited). BTW, after setting use_vsock=false, I could see xrdp listening on the TCP port, using netstat. After getting out of Virtual Machine Connection, then using normal RDP, the login session worked from the "teal" screen. Still have not resolved the "Enhanced session" use_vsock=true issue, but TCP RDP works when vsock is disabled.

razrjk avatar Jan 21 '20 21:01 razrjk

i have this same issue like razrjk if I change use_vsock on true.

ravczyPL avatar Feb 25 '20 20:02 ravczyPL

I also had this at first, after rebooting it's gone.

If you see the login screen, the connection is fine, blank screen is another problem, I've seen some solutions for that over internet (can't find it now), but for me it was gone after reboot.

d-murashkin avatar Feb 28 '20 14:02 d-murashkin

@burdiuz 's solution worked for me, set a password, don't auto-login, and everything worked. My machine is Win 10 Pro, 64GB RAM, Intel i7-8700K. The VM is Ubuntu 18.04, all default settings.

maludwig avatar May 25 '20 21:05 maludwig

I am currently running Ubuntu 20.04 server on VMware Esxi 7 on Fling and it's working nicely. I get to the login screen fine via xrdp in the xorg session and the connection attempt is made as you would expect it in a Windows rdp session over a slower connection. I get a black desktop with a mouse cursor for a couple of seconds after logging in - then the Oh no! Something has gone wrong. I have reduced the color options to 15 bit with 1024x768 resolution - unchecked printers and clipboard under local resources for the Windows rdp client options. I believe this might be a timeout issue - I just dont know where (whether I can) adjust the settings on the ubuntu server side.

skarai avatar Nov 03 '20 16:11 skarai

This issue is super annoying. The login after creating an Ubuntu 18.04 machine using Quick Create is still broken. Is anyone working on this?

grott0 avatar Nov 18 '20 09:11 grott0

Two issues here- you cannot to my knowledge configure an enhanced session and retain RDP to connect to a Linux VM.

The Vsock issue was addressed above but on top of that an enhanced session uses port=vsock://-1:3389. To connect over RDP you need to change that to 3389 in /etc/XRDP/XRDP.ini. To use an enhanced session it needs to be set to the vsock port. This is because it’s using RDP in local host basically which is why you get such good performance. You also need to use power shell to configure the VM for enhanced if you do this manually (no quick create.)

Just look at the install.sh script Microsoft put out for enhanced sessions. You can also adapt this to do enhanced sessions on Ubuntu/Debian variants. I got an enhanced session working on Mint for instance.

therealdandecker avatar Dec 23 '20 22:12 therealdandecker

Hi @therealdandecker, I have managed to get a Hyper-V enhanced mode vsock connection and an RDP connection working together with a Fedora33 VM, but I believe it should work with any distro. The secret is in this PR #1366 which allows the single port parameter in /etc/xrdp/xrdp.ini to have multiple values. I changed my port setting to be port=vsock://-1:3389 tcp://:3389 (with a space between the two options) and it now listens on both transports and I can connect to both simultaneously! I tested this using the Hyper-V Manager Connect and the Windows 10 built in RDP app and it works a treat, allowing each connection to have their own display settings etc with cut-n-paste working in both. FYI, I left the use_vsock setting at the default of false as this seems like a deprecated flag now and is not needed. I hope this helps you or someone else following...

m-g-k avatar Jan 04 '21 13:01 m-g-k

This is dynamite looking forward to testing out.


From: m-g-k [email protected] Sent: Monday, January 4, 2021 8:20 AM To: neutrinolabs/xrdp Cc: Dan Decker; Mention Subject: Re: [neutrinolabs/xrdp] Cannot establish RDP connection to Ubuntu VM made with Hyper-V Quick Create (#1260)

Hi @therealdandeckerhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftherealdandecker&data=04%7C01%7C%7Cf9b035ebb0064f19787b08d8b0b3733e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637453632067281898%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=EAtduW8SZy1JT3ELChHBcy%2FgzS5IVnKlH%2Fx89nCAjnQ%3D&reserved=0, I have managed to get a Hyper-V enhanced mode vsock connection and an RDP connection working together with a Fedora33 VM, but I believe it should work with any distro. The secret is in this PR #1366https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fneutrinolabs%2Fxrdp%2Fpull%2F1366&data=04%7C01%7C%7Cf9b035ebb0064f19787b08d8b0b3733e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637453632067291891%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1k1Q59GQr7x28LjlKMV51T675FVG%2FR8x4cETDd8BmwU%3D&reserved=0 which allows the single port parameter in /etc/xrdp/xrdp.ini to have multiple values. I changed my port setting to be port=vsock://-1:3389 tcp://:3389 (with a space between the two options) and it now listens on both transports and I can connect to both simultaneously! I tested this using the Hyper-V Manager Connect and the Windows 10 built in RDP app and it works a treat, allowing each connection to have their own display settings etc with cut-n-paste working in both. FYI, I left the use_vsock setting at the default of false as this seems like a deprecated flag now and is not needed. I hope this helps you or someone else following...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fneutrinolabs%2Fxrdp%2Fissues%2F1260%23issuecomment-753970464&data=04%7C01%7C%7Cf9b035ebb0064f19787b08d8b0b3733e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637453632067301887%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SrWlMQnzaQN6Y8jotFPoqer3P5fAV5qfocvqRnKzu%2FU%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACSWFW3NRIVFN7CKIZ546NLSYG6AFANCNFSM4GHEMFFA&data=04%7C01%7C%7Cf9b035ebb0064f19787b08d8b0b3733e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637453632067301887%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BYwECtgVRKZMtPFiwtajG2MtV2CacL6EPMCOiwCFh6I%3D&reserved=0.

therealdandecker avatar Jan 04 '21 13:01 therealdandecker

Losing my freaking mind over this. But I discovered there is simply a "Basic session" button in the Hyper-V console window, and when I clicked this - it started working. (I don't know what this does - i.e. if it just skips using RDM and uses an old-school video console, but my problem with getting a blank blue screen after Xorg RDM login magically fixed itself).

bkgoodman avatar Jan 28 '21 17:01 bkgoodman

Losing my freaking mind over this. But I discovered there is simply a "Basic session" button in the Hyper-V console window, and when I clicked this - it started working. (I don't know what this does - i.e. if it just skips using RDM and uses an old-school video console, but my problem with getting a blank blue screen after Xorg RDM login magically fixed itself).

If you're using "Basic session" there is no copy-paste and other useful functionalities.

FERViborg avatar Jan 30 '21 12:01 FERViborg

Hi @therealdandecker, I have managed to get a Hyper-V enhanced mode vsock connection and an RDP connection working together with a Fedora33 VM, but I believe it should work with any distro. The secret is in this PR #1366 which allows the single port parameter in /etc/xrdp/xrdp.ini to have multiple values. I changed my port setting to be port=vsock://-1:3389 tcp://:3389 (with a space between the two options) and it now listens on both transports and I can connect to both simultaneously! I tested this using the Hyper-V Manager Connect and the Windows 10 built in RDP app and it works a treat, allowing each connection to have their own display settings etc with cut-n-paste working in both. FYI, I left the use_vsock setting at the default of false as this seems like a deprecated flag now and is not needed. I hope this helps you or someone else following...

This amazing tip work like a charm, thank you; just one small comment........you must choose between one RDP session at a time (both at same time just not work in Window10) ......Windows Server I understand yes it is posible !! all is about the CAL (licences) but I find how to do it in Windows 10 ( I haven't even tried yet..hope to do it soon)...... https://www.youtube.com/watch?v=rswqf7GQTF0

See you.

JulioAviles avatar Feb 28 '21 22:02 JulioAviles

Hi @therealdandecker, I have managed to get a Hyper-V enhanced mode vsock connection and an RDP connection working together with a Fedora33 VM, but I believe it should work with any distro. The secret is in this PR #1366 which allows the single port parameter in /etc/xrdp/xrdp.ini to have multiple values. I changed my port setting to be port=vsock://-1:3389 tcp://:3389 (with a space between the two options) and it now listens on both transports and I can connect to both simultaneously! I tested this using the Hyper-V Manager Connect and the Windows 10 built in RDP app and it works a treat, allowing each connection to have their own display settings etc with cut-n-paste working in both. FYI, I left the use_vsock setting at the default of false as this seems like a deprecated flag now and is not needed. I hope this helps you or someone else following...

This works!!

robsarno avatar Sep 24 '21 08:09 robsarno