Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zakimaksyutov opened this issue Nov 29, 2018 · 34 comments

Comments

@zakimaksyutov
Copy link

zakimaksyutov commented Nov 29, 2018

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
Copy link

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

@zakimaksyutov
Copy link
Author

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
Copy link

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

1 similar comment
@njonesnMSFT
Copy link

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

@jwgmeligmeyling
Copy link

jwgmeligmeyling commented Feb 5, 2019

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
Copy link

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
Copy link

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

@cwilhit
Copy link

cwilhit commented Feb 19, 2019

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
Copy link

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

@jlenos
Copy link

Thanks @burdiuz ! Your solution worked for me.

@jwgmeligmeyling
Copy link

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
Copy link

jlenos commented Sep 5, 2019

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

@leonmeijer
Copy link

leonmeijer commented Sep 5, 2019

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@d-murashkin
Copy link

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
Copy link

@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
Copy link

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.

@grott0
Copy link

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
Copy link

therealdandecker commented Dec 23, 2020

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
Copy link

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
Copy link

therealdandecker commented Jan 4, 2021 via email

@bkgoodman
Copy link

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
Copy link

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
Copy link

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
Copy link

robsarno commented Sep 24, 2021

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
Copy link

it-pappa commented Nov 16, 2021

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
Copy link

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
Copy link

kundeng commented Mar 7, 2024

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests