neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.76k stars 1.73k forks source link

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

Open zakimaksyutov opened 5 years ago

zakimaksyutov commented 5 years ago

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]


nelsonjchen commented 5 years ago

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

zakimaksyutov commented 5 years ago

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

njonesnMSFT commented 5 years ago

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

njonesnMSFT commented 5 years ago

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

jwgmeligmeyling commented 5 years ago

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.

jackmcdowell commented 5 years ago

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.

jwgmeligmeyling commented 5 years ago

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

cwilhit commented 5 years ago

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.

burdiuz commented 5 years ago

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

jlenos commented 5 years ago

Thanks @burdiuz ! Your solution worked for me.

jwgmeligmeyling commented 5 years ago

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?

jlenos commented 5 years ago

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

leonmeijer commented 5 years ago

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.

FERViborg commented 4 years ago

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.

oskaremil commented 4 years ago

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

d-murashkin commented 4 years ago

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.

Tillman32 commented 4 years ago

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?

razrjk commented 4 years ago

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.

ravczyPL commented 4 years ago

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

d-murashkin commented 4 years ago

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.

maludwig commented 4 years ago

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

skarai commented 4 years ago

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.

gsg33 commented 3 years ago

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?

therealdandecker commented 3 years ago

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.

m-g-k commented 3 years ago

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

therealdandecker commented 3 years ago

This is dynamite looking forward to testing out.


From: m-g-k notifications@github.com 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.

bkgoodman commented 3 years ago

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

FERViborg commented 3 years ago

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.

JulioAviles commented 3 years ago

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.

robsarno commented 3 years ago

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

it-pappa commented 2 years ago

I have myself installed Rocky Linux thru Hyper-V but i cant login. I used a vswitch (external) so it shares the network card and also tested with all the network settings. I can ping the machine so its weird.

varad11 commented 1 year ago

After trying all possible things the comments here actually helped. 1). Setting use_vsock=false 2). Restart xrdp services sudo systemctl restart xrdp 3). Complete shut down of my VM and then starting it again. 4). On the teal coloured login page logging with my username and password. But this time the black screen was gone. Thanks @d-murashkin @razrjk

Things that I tried that didn't actually work out: 1). Replacing network switch of my VM on Hyper-V from NAT to bridged. 2). Check/Uncheck enhanced session setting on Hyper-V.

kundeng commented 8 months ago

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.

In my canned ubuntu22.04 installation, use_vsock=false is already set. Still can't connect.
ss gives:

tcp   LISTEN   0      2                                       127.0.0.1:3389              0.0.0.0:*
v_str LISTEN   0      0                                               *:3389                    *:*

This is wrong though? It's still using v_sock instead of tcp for nonlocal connections. I can't get to it from the hyper-v host using its external (bridge) IP.

matt335672 commented 8 months ago

@kundeng - you're right in that you won't be able to connect to that from the bridge.

Check the setting of port= in xrdp.ini. The format of this parameter has changed from release-to-release, but I'd expect a simple port=3389 would suit your use-case.