4

My host system is Win 11 Pro with Hyper-V enabled, also using "Enhanced session mode".

I have a few Ubuntu versions installed manually (I downloaded the ISO and ran install), but they always have issues. So this time I used Quick Create and the latest long term support version of Ubuntu (22.04). I hoped it would work better because it was curated.

And it connects just fine when I launch it from Hyper-V Manager. It uses the XRDP protocol with an Xorg session. Wow!

Now, on all my manually installed Ubuntu VMs, I have never seen that XRDP screen when launching from Hyper-V Manager. I only see it when I try to connect from Remote Desktop. So I assumed this time it's working better than usual.

But when I try to connect from Remote Desktop, I get the error "Remote Desktop can't connect to the remote computer".

I have Googled my butt off, tried lots of seemingly pointless things, and proven those things were pointless. Nothing I've tried so far has made a difference.

For the "Computer" field of Remote Desktop, I tried using the actual computer name, the IPV4 address, and the IPV6 address. Nothing worked.

But... I can ping from host to guest, and from guest to host.

XRDP is obviously installed in the guest Ubuntu system.

I have no idea what's causing it to not connect.

3 Answers 3

1

I have one computer with VMware and the other with Hyper-V. The Hyper-V system has both Ubuntu and Kali Guests and I can connect to both of them from the first computer using RDP.

XRDP is obviously installed in the guest Ubuntu system.

(1) That is good (necessary).

Make sure now that XRDP is enabled. sudo systemctl enable xrdp

Then make sure XRDP has been started. sudo systemctl start xrdp

You may wish to check the XRDP status to ensure it is running.

(2) Good idea (best) to give the Ubuntu Guest in Hyper-V an External Switch (Bridged network in most VM apps). This is so RDP on the other computer can readily find the Ubuntu Guest.

Close down the Guest, make a New External Switch in Hyper-V. Go to the Guest settings in Hyper-V and select the External Switch.

Start the Guest and make sure the External Switch is working.

(3) Restart the Guest, start the XRDP service (needs to be restarted with every Linux restart.

Now log off Linux but leave it running.

Go to your other machine and RDP in. Should work. Steps above work flawlessly for me.

11
  • I checked first, and XRDP was both enabled and actively running. But I still ran your commands just in case. I was already using an external switch named after my sole NIC: a Killer E3200G 2.5 GB Ethernet Controller. I currently have 6 Ubuntu based VMs. To confirm how things work, I tried starting each one from Hyper-V Manager and from a Remote Desktop connection. The results were different than I expected. Commented Mar 12, 2023 at 1:22
  • 5 of them would only start via Hyper-V Manager (but using the XRDP login screen, meaning I am forced to log in before I get to see the Ubuntu screen). Only 1 of them would let me log in via the RDP screen (and for Hyper-V present the direct Ubuntu login screen). EVERY VM uses the external switch. I don't know what's wrong. Commented Mar 12, 2023 at 1:22
  • You need to start your Ubuntu machine, start XRDP, and then log off, but do not shut down. Now from your other or host machine, RDP should work . I have tested all that I wrote and have it working.
    – John
    Commented Mar 12, 2023 at 1:29
  • Also in testing here, one machine had to be restarted after I closed the active, working RDP Session. No big deal. Try: (1) On a guest make sure XRDP is all set up and working. Shut down the guest. Restart the host. Start up the Guest, start XRDP, log off, and try RDP from the Host. I am doing this - I know it works. Also make sure the Guest and Host are fully up to date.
    – John
    Commented Mar 12, 2023 at 1:42
  • When I start the Ubuntu VM via Hyper-V Manager, I'm obviously logged in. If I click log out, the XRDP connection terminates (it will not let me stay connected if I'm not logged in). If I then try to connect via Remote Desktop, it always says it cannot find the VM. No matter if I use computername, computername.local, or its IP address. Commented Mar 12, 2023 at 1:44
1

This is what seems to be working for me...

First, I had to disable "Allow enhanced session mode" in the Hyper-V settings. That may actually be the only thing required, but the next step is kinda neat, so...

I edited /etc/xrdp/xrdp.ini to have multiple values for PORT:
port=vsock://-1:3389 tcp://:3389

This lets me connect by RDP as well as Hyper-V Manager at the same time! I think you can log in to separate accounts, but trying to have two logins to the same account will fail.

Got that suggestion from https://github.com/neutrinolabs/xrdp/issues/1260.

I'm not really happy with this workaround, but maybe that's just pessimism. If anyone has a better working suggestion I'll be happy to credit them.

0

After (also) "... Googl[ing] my butt off..." and trying a ton of things, I found that Ubuntu 22.04 now has native support for Microsoft RDP.

All I had to do was go into the Ubuntu vm's Settings, and under Sharing turn on Remote Desktop and enable Remote Control. Ba da boom! It finally worked!

Pictures in this article: Ubuntu 22.04 Finally Supports Remote Desktop Control via MS RDP Protocol | UbuntuHandbook

[Now, I'm just not sure what I've broken by trying all those other things ;)]


Update: Not sure why the downvote; however... upon creating a new VM and following just these steps, this didn't work - so one of the many other things I tried might've solved it. I have some thoughts, so I'll update this answer once I've found the "key"... (or delete it if I don't find the key shortly)

1
  • 1
    This worked for me but you have to take care to not use your own password when logging in. There is a separate password for RDP that is shown in the dialogs in the linked article. Also make sure you are already logged in to the machine before connecting with RDP or it will not work. Commented Mar 10 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .