Skip to content

Instantly share code, notes, and snippets.

@bitroniq
Last active February 18, 2021 19:32
Show Gist options
  • Save bitroniq/f620163e9aa70626c07714b957e15d6f to your computer and use it in GitHub Desktop.
Save bitroniq/f620163e9aa70626c07714b957e15d6f to your computer and use it in GitHub Desktop.

Running Enchanced session with XRDP on MS Hyper-V running UBuntu 20.04

Get the scripts from GitHub

sudo apt-get update
sudo apt install git
git clone https://github.com/Microsoft/linux-vm-tools.git ~/linux-vm-tools
cd ~/linux-vm-tools/ubuntu/18.04/

Make the scripts executable and run them...

sudo chmod +x install.sh
sudo ./install.sh
sudo reboot
cd ~/linux-vm-tools/ubuntu/18.04/
sudo ./install.sh
sudo systemctl enable xrdp.service
sudo gedit /etc/xrdp/xrdp.ini   
# change these two lines: port=vsock://-1:3389 and use_vsock=false
sudo systemctl start xrdp.service
sudo shutdown -h 0

Update VM

On Windows Powershell with Admin Privilegies:

Set-VM -VMName <your_vm_name>  -EnhancedSessionTransportType HvSocket

Fix Black Ubuntu Screen

The solution is quite simple. Head over to the remote system and edit the /etc/xrdp/startwm.sh script.

$ sudo vim /etc/xrdp/startwm.sh

Add these lines just before the lines that test & execute Xsession as shown in the screenshot below.

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment