Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Add ubuntu 20.04 (Work for 18.04 too) #106

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Hinara
Copy link

@Hinara Hinara commented Mar 26, 2020

Ubuntu 20.04 will be release soon,
xrdp had some update making that you SHOULD NOT use use_vsock=true anymore
See neutrinolabs/xrdp#1403

@msftclas
Copy link

msftclas commented Mar 26, 2020

CLA assistant check
All CLA requirements met.

@sn0wf4ke
Copy link

Thanks. It is working fine. Used it here for my vagrant box. https://app.vagrantup.com/sn0wf4k3/boxes/ubuntu-focal-desktop

@Hinara
Copy link
Author

Hinara commented Apr 14, 2020

This PR is also able to fix new version of the xrdp server that has been released recently on 18.04

@mariuszkochanowski
Copy link

mariuszkochanowski commented Apr 26, 2020

I used optimized ubuntu 20.04 vhd image from
https://github.com/CanonicalLtd/ubuntu-desktop-hyper-v/tree/master/HyperVGallery

and enhanced session didn't work.

I uninstalled xorgxrdp, xrdp and removed configuration, then used your script
and it didn't work either.

I made sure that configuration is correct. Xrdp verssion installed was 0.9.12.
Of course i enabled enhanced session on hyperv.
Older scripts worked for me with ubuntu 18.04 and 19.10 optimized images.
Maybe problem is in optimized image...

@maxplatonov
Copy link

Works fine after upgrading an existing 18.04 VM to a 20.04.
After running the install.sh I had to run this in Powershell:

Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket

👍

@Hinara
Copy link
Author

Hinara commented Apr 26, 2020

@mariuszkochanowski Check that xrdp is running correctly systemctl status xrdp and that you correctly set that your vm support Enhanced Session with the command just above

@mariuszkochanowski
Copy link

It works only with ubuntu installed from iso. It doesn't work on ubuntu optimized image - it has some issues.

@Hinara
Copy link
Author

Hinara commented Apr 28, 2020

Xrdp seems to be configured correctly, and manage to launch without crashing (systemctl status xrdp report that the process is running)
I think there is something wrong with the optimized image and microsoft modules as even shared-drives is not created in the home folder. So as long as this is not fixed, I can't really do anything, sorry

@hiyangw
Copy link

hiyangw commented Apr 29, 2020

It's working for me if create a ubuntu 20.04 VM manually. Thanks

@wittelw
Copy link

wittelw commented May 4, 2020

Like others above, confirmed it does NOT work with the April 23, 2020 Quick Create Hyper-V image. Installed manually and running the following (from above and other sources).

Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket

@Hinara, thanks for this, a much needed PR. Perhaps @cwilhit can comment on status.

Note: I believe the wiki at https://github.com/Microsoft/linux-vm-tools/wiki/Onboarding:-Ubuntu should be updated at the same time as well as changing the version info comment on line 4 of install.sh.

ubuntu/20.04/install.sh Outdated Show resolved Hide resolved
Hinara added 2 commits May 5, 2020 01:38
Linux-cloud-tools packages are now available for 20.04
@Hinara Hinara changed the title Add ubuntu 20.04 Add ubuntu 20.04 (Work for 18.04 too) May 4, 2020
@elvries
Copy link

elvries commented May 5, 2020

I needed the updates in http://c-nergy.be/blog/?p=14888 (xrdp-installer-1.2.sh) to solve the rights issues which popup after startup. This was a clean install from the Ubuntu 20.04 iso, so I would say everybody should have these issues. In that case I guess the relevant parts of that script could be copied to this script.

@Metalscreame
Copy link

Hi all
@elvries you mean Can't open PID file /run/xrdp/xrdp.pid (yet?) error?
Im getting it after script installation of xrdp. in the systemctl status xrdp.service
And enhanced mode is not being enabled. Im not sure if this is the

I also tried the one you mentioned - but still had the some error

@elvries
Copy link

elvries commented May 8, 2020

@Metalscreame, no, I did not have that issue.

@Hinara
Copy link
Author

Hinara commented May 11, 2020

If anyone would like to try again with a quick create version ?
Could not reproduce this issue by myself anymore, maybe a package update fix that

@srcnet2
Copy link

srcnet2 commented May 12, 2020

It does not work still

@Hinara
Copy link
Author

Hinara commented May 12, 2020

Try to shutdown VM and them restart it ?
Maybe windows version ? 1909 OS build: 18363.815
With quick create, it works after executing my script :/

@srcnet2
Copy link

srcnet2 commented May 12, 2020

It is working now, but I don't know how or what I did to fix it. I rebooted the host, the guest. I ended up saving the guest at one point because I was going to delete it.

Then it started working

@mykter
Copy link

mykter commented May 13, 2020

Didn't work for me with a quick-create image from today, on build 17763. Script runs fine, set the VM session transport type, but it still gets the normal unenhanced session. There were no obvious xrdp errors in the logs, but I'm not sure what else I should be looking for.

@grobius
Copy link

grobius commented May 13, 2020

I only get is to work when first starting it up and then choose save state as described by srcnet2

@God-damnit-all
Copy link

The Save method worked for me as well.

@mykter
Copy link

mykter commented May 14, 2020

Saving and then resuming at the logon prompt did it, thanks!

@VidathD
Copy link

VidathD commented Jun 19, 2020

Why isn't this merged yet?

@cprivitere
Copy link

For those who go through all of this stuff (you set the vsock settings, disabled auto login, and rebooted everything) and still don't get the enhanced session, something I found is that you need to tell hyper-v to try to start the Enhanced Session AFTER xrdp is started up. Two ways to do this:

  1. As mentioned earlier in the thread, save the VM state while at the login prompt and then resume it. That'll get it to try enhanced mode.
  2. There is a button in the Virtual Machine window that toggles between enhanced and basic sessions. You can just click that to switch to an enhanced session.

@relief-melone
Copy link

Why is this still not merged!! Microsoft could you please wake up! Works like a charm

@smailc
Copy link

smailc commented Sep 22, 2020

Is this going to be merged?

@dcui
Copy link

dcui commented Sep 29, 2020

FYI:
I followed
https://askubuntu.com/questions/1246362/how-to-setup-xrdp-for-ubuntu-20-04-in-windows-hyper-v
https://medium.com/@francescotonini/how-to-install-ubuntu-20-04-on-hyper-v-with-enhanced-session-b20a269a5fa7
and I was able to enable xrdp in my Ubuntu 20.04 VM. Basically I did "wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh;
sudo chmod +x install.sh;
sudo ./install.sh", and
"Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket" (this runs on the host).

However, after I logged in via xrdp I only got an empty screen... "ps aux |grep -i xorg" showed that 2 Xorg servers were running, so I disabled the "traditional" Xorg server via "systemctl set-default multi-user.target; reboot", and now I'm able to see the normal desktop after I login via xrdp. :-)

@gmnowels
Copy link

FYI:
I followed
https://askubuntu.com/questions/1246362/how-to-setup-xrdp-for-ubuntu-20-04-in-windows-hyper-v
https://medium.com/@francescotonini/how-to-install-ubuntu-20-04-on-hyper-v-with-enhanced-session-b20a269a5fa7
and I was able to enable xrdp in my Ubuntu 20.04 VM. Basically I did "wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh;
sudo chmod +x install.sh;
sudo ./install.sh", and
"Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket" (this runs on the host).
However, after I logged in via xrdp I only got an empty screen... "ps aux |grep -i xorg" showed that 2 Xorg servers were running, so I disabled the "traditional" Xorg server via "systemctl set-default multi-user.target; reboot", and now I'm able to see the normal desktop after I login via xrdp. :-)

I'm running Ubuntu gnome desktop. Got empty screen initially as well. Simply rebooted.

@Hinara
Copy link
Author

Hinara commented Sep 30, 2020

The actual configuration script does not touch Xorg at a single point so if it doesn't work I suggest you to check first if there might be an issue with Xorg & systemd or Xorg & xrdp that makes two servers run at the same time.
This script does just install the virtualized kernel variation that have some kernel module by default inside
Check if there is no update to other packages.
Install xrdp and configure it
Configure over utilities to work with remote connection.
Ask you to reboot.

@TTimo
Copy link

TTimo commented Oct 1, 2020

This isn't working for me ..

The install.sh script executes without error, I shutdown the VM, issue the Set-VM command to set HvSocket, reboot ..

The VM comes back online, it's waiting at the gdm greeter for my user password, there is no prompt for resolution when I connect, no xrdp login screen.

systemctl status xrdp systemctl status xrdp-sesman report good state, Xorg is running ..

@TTimo
Copy link

TTimo commented Oct 1, 2020

Nevermind! It took a reboot of the Windows host, which I hadn't considered .. those things happen pretty often.

@okand
Copy link

okand commented Oct 7, 2020

This is probably unsupported so never mind me but I still want to write it down here.

I tried this using pop_os 20.04 and after rebooting the windows host and running Set-VM -VMName pop_os -EnhancedSessionTransportType HvSocket I got hyper-v to connect with an enhanced session and it showed me the xrdp login screen. After logging in I just get a fullscreen error message that's as vague as Microsofts bsods these days and just says "something" went wrong and that I need to log out and try again/something else though.

@Hinara
Copy link
Author

Hinara commented Oct 8, 2020

Blame microsoft drivers for that not something I can do something for :/ as it's a bug on windows side not on VM side

@okand
Copy link

okand commented Oct 8, 2020

It's inside the VM the error appears though. Looks like this: https://okand.website/ohno.png

@Hinara
Copy link
Author

Hinara commented Oct 8, 2020

Ohh sry was thinking windows did that not the VM.
Is it only your session our the whole VM ?
If it's the VM not sure what exactly can cause that Linux Kernel doing something definitively wrong crashing like that but seems strange that Hyper-V stop that as you can't even get crash informations.
Hyper-V state get corrupted and Hyper-V shutdown everything to prevent further damages ?
If it's the RDP session might need to make a ticket to xrdp project as it might be some invalid data.

@okand
Copy link

okand commented Oct 8, 2020

I just did an install with regular ubuntu 20.04 instead and that works fine. It's something specific to pop_os then, more things different with it than just being ubuntu but without canonical I suppose.

It's just my session that breaks, the vm is still on and I can reconnect and have it crash after logging in again.

@platima
Copy link

platima commented Oct 20, 2020

Oh this has had me so stumped.
Windows 10 build 1909; quick create, run script, reboot, run script, shutdown, set EnhancedSessionTransportType HvSocket, boot, no bueno. Tried with and without vsock, confirmed xrdp running fine, confirmed only 1 xorg running, confirmed kernel modules correct, confirmed that the 'Enhanced Session' option was definitely not available, tried with and without both Secure Boot and Guest Integration Services.
Tried again with ubuntu-20.04.1-desktop-amd64.iso installer, minimal, same process; still no luck. Then also tried systemctl set-default multi-user.target as a moonshot but that didn't help.
I haven't tried rebooting the host yet, as I have a pile of work open right now, but I really cannot think how that would help as this worked with the 18.04 install.

@AntonOfTheWoods
Copy link

Actually the machine I had installed these on broke somehow (the two NICs I'd added got broke, I tried to boot to recovery but the console wouldn't launch, meaning no way of recovering anything short of mounting and doing a chroot).

So what is the point of these tools again?

At least for Ubuntu, it is completely obvious why MS is totally MIA on this - WSL2. Sure, they haven't done desktop apps yet but they probably want to focus on doing that rather than wasting time here. In addition, you still don't get sound with these and copy paste works fine with a normal xrdp install and mstsc. The auto-mounting of local drives is more trouble than it's worth - I regularly had it not mount them so if you have anything that points to them and auto-creates directories you get stuff inside the VM rather than on the host.

My advice? Forget about these "tools" and:

  • install xrdp
  • share any directories you want on the host and mount them like normal samba drive using cifs-utils (same problems with mounting can occur but not more so)
  • install the azure kernels from the normal repo

Hyper-V is definitely NOT a robust desktop virtualisation solution, it is a (pretty good) server virtualisation solution that probably also works well for virtualisation of Windows desktops in enterprise environments. For the rest it is significantly inferior to the competition, including free variants like VirtualBox. The only reason not to disable it on Win10 is because that means you have to completely disable WSL2. Having it activated breaks all other good desktop virtualisation software, so for the moment looks like we are stuck with it. When WSL2 does GUI apps, it will be (almost) totally obsolete for virtualising Linux on Win10 (but will still be required...).

@bonzani
Copy link

bonzani commented Oct 22, 2020

works well +1

@koder101
Copy link

koder101 commented Dec 25, 2020

I could confirm that this PR-106 works with Ubuntu-20.10 as well.
I used these two to make it work -
Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket
and

sudo apt install git
git clone https://github.com/microsoft/linux-vm-tools.git
cd linux-vm-tools
git fetch --all
git pull origin pull/106/head:pull_106
git checkout pull_106
cd ubuntu/20.04/
sudo bash ./install.sh

@jeremyn
Copy link

jeremyn commented Dec 28, 2020

@koder101's summary comment at #106 (comment) worked for me with Ubuntu 20.04 if I installed using an ISO, not "quick create". I also think I needed to reboot the host. After it was all done the guest graphics were still noticeably laggier than a similar setup in VMware Workstation Pro 16.

I agree with @AntonOfTheWoods at #106 (comment): Hyper-V is not the best option for desktop virtualization, like if you want to run a full graphical Linux desktop side-by-side with Windows. By the way, with VMware Workstation Pro all I needed to do to get Hyper-V and VMware working side-by-side was enable the "Windows Hypervisor Platform" optional feature in Windows 10 Pro, which VMware prompts you to do during its install. It should be the same for VirtualBox but I haven't tried it and I'm seeing mixed reports so YMMV there.

@iancward
Copy link

I can confirm that this does not work with an Ubuntu 20.04 quickstart VM (not entirely sure why), but does with with a fresh Lubuntu (Ubuntu with LXDE) install from the mini.iso netinstall image. I had to fully stop the VM and restart it in order it to switch to "Enhanced Mode" but it works great now.

Thanks!

@DRCHRIS2
Copy link

Bump... works great with a vanilla 20.10 install from ISO. Clone the PR, install, reboot, re-run install per stdout, shutdown, adjust the VM config, restart VM and it's flawless. A little circuitous but still good. MS should really consider spending some time on these PRs.

@platima
Copy link

platima commented Jan 20, 2021

I found that nothing has to be done with quick start VMs now. Not sure if MS updated, but deploy 20 from quickstart, reboot, and it's enhanced.

@dboreham
Copy link

I found that nothing has to be done with quick start VMs now. Not sure if MS updated, but deploy 20 from quickstart, reboot, and it's enhanced.

Reboot the guest or the host? (not working for me fwiw)

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

Successfully merging this pull request may close these issues.