The trials and tribulations of xRDP, VSCode and Docker on an Azure Ubuntu VM

I have a presentation coming up in a couple of weeks where I will be introducing the wonders of .NET Core and Docker containers to an audience of academics. One of the most attractive elements of .NET Core is its cross platform support. To assure the audience that it is truly cross platform and not a simple Microsoft gimmick, I will be delivering my demonstrations on a Ubuntu machine. This morning I thought I'd setup the machine so that it is ready to rock and roll when I need to run my demonstrations.

First things first; I headed over to http://portal.azure.com and provisioned a clean Ubuntu 14.04 LTS virtual machine. I could have used an existing image with docker etc. installed but I wanted to make sure I got the latest versions. Usually when I demonstrate anything in Azure running on a Linux machine I just launch Putty, SSH into the box and do my entire demo on command line. This is okay but I feel I'm not really giving the audience the ability to experience the full richness of the technology. Therefore I decided to install an xRDP server on the machine to allow me to connect to if from an RDP client. Documentation on how to do this is available here.

Now I had the full xfce desktop available, I could, ironically, crack on running my .NET Core CLI demos in happiness.

Next I noticed that tab completion wasn't working in the terminal. I gritted my teeth and battled on for a couple of hours before it got too much. I searched around for a while for a resolution and found one buried in the Ubuntu fourms.

  • Edit this file: ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
  • Replace this line: <property name="&lt;Super&gt;Tab" type="string" value="switch_window_key"/>
  • With this line: <property name="&lt;Super&gt;Tab" type="empty"/>

After this change, I restarted the terminal and tab completion started to play ball... what a relief!

I then needed to install Docker. I followed the instructions over at docker to install the latest docker release on my box. This all worked seamlessly, until I wanted to run docker without sudo. Normally you'd simply create a new sudo group called docker and throw your user into it. However I was getting some bizarre output when trying to add my user to the docker group.

$ sudo usermod -aG docker $USER
$ sent invalidate(passwd) request, exiting
$ sent invalidate(group) request, exiting

Reading a few things online seemed to suggest it isn't actually an error per say but output from nscd. However, I still couldn't perform my docker operations without using sudo. I could see that my user was part of the group using groups $USER but the permissions didn't seem to work. Then the penny dropped. The old IT support helpline response was all that was needed here. A quick reboot to reset the user permissions and I was in business!

Finally, I thought, "we've invested a lot of effort in building some really great cross platform tooling, it would be a shame not to flaunt the awesome capabilities of Visual Studio Code." I headed over to the Visual Studio site to get the latest Linux tarball. Once downloaded, I extracted it to the local directory via:
tar xzvf code-stable-code_1.5.2-1473686317_amd64.tar.gz. I changed the extracted folder name to VSCode and moved it to my $Home directory.
Then I jumped into the VSCode directory and tried to run the code executable... nothing happened.
I tagged on --verbose logging to check the output, which was as follows;

Xlib: extension "XInputExtension" missing on display ":10.0".  
Xlib: extension "XInputExtension" missing on display ":10.0".  
libGL error: failed to load driver: swrast  
bash: cannot set terminal process group (-1): Inappropriate IOCtl for device  
...

I then headed back into the wild wild west of the web to try and dig to the bottom of this particular issue. Turns out it is quite common when running VSCode through VNC or RDP. Anyway I found a workaround posted on a GitHub issue.

cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 ~/path/to/store/backup # make a backup  
sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1  

After performing the above commands, I restarted the terminal and bingo - VSCode in all its glory sprung to life. Now I can finally get on with my actual demo code! I hope this helps anybody who runs into similar issues when working on a remote Ubuntu VM in Azure.