INGREDIENTS
- Windows 10 October 2018 Update (1809)
- Ubuntu 19.04 installed via 'Hyper-V Quick Create'
- socat
Starting from version 2.6.0, X410 can be used with Hyper-V Linux virtual machines for opening their GUI desktop via VSOCK (virtual socket).
By using VSOCK, you don't need to worry about configuring firewall or IP address. As X410 seamlessly supports Windowed Apps mode and shared clipboard, you can also use Linux GUI apps side by side with Windows apps instead of confining them to a Hyper-V console. Moreover, your virtual machines will be using less system resources since you don't need to run XRDP or other GUI desktop separately for each Linux virtual machine.
PREPARATION:Hyper-V Linux Virtual Machine
PREPARATION:Windows 10
TEST DRIVING:Ubuntu Virtual Machine
TIDYING-UP:Directly Booting Ubuntu Desktop onto X410
You can automatically open Ubuntu desktop on X410 when you simply start your Ubuntu virtual machine. You can do this by creating startup services as described below.
TIDYING-UP:Launching X410 and Ubuntu VM from a Batch File
TIPS AND TRICKS
Running X410 in Windowed Apps mode
Instead of running a full Ubuntu desktop, you can run Linux GUI apps individually and use them side by side with Windows apps. You can accomplish this by first starting X410 in 'Windowed Apps' mode:
start x410.exe /wm /listen hyperv
You also need to change the script created in Step 3.2; you should add a command for starting a GUI terminal. Any Linux GUI app that is executed from this terminal will be opened as a separate floating window that can be placed among Windows apps.
start-ubuntu-desktop.sh#!/bin/bash export XDG_SESSION_TYPE=x11 export XDG_CURRENT_DESKTOP="ubuntu:GNOME" export GNOME_SHELL_SESSION_MODE=ubuntu gnome-session --session=ubuntu & gnome-terminal & /usr/lib/gnome-terminal/gnome-terminal-server
When adding a terminal or any GUI app, make sure the main script keeps running while your added programs are active. The service unit created in Step 4.2 gets automatically restarted when its target (i.e., a virtual terminal acquired via /sbin/agetty) is terminated. So, for the above script, we added a workaround for preventing its immediate exit; 'gnome-terminal' returns even when it's still active, but 'gnome-terminal-server' remains running if there is any instance of 'gnome-terminal'.
If you don't want to use a workaround, you can use a straightforward GUI terminal such as Xterm. You can also try adapting the Xfce launcher method as shown in 'Get your sidekick for easily managing and launching Linux GUI apps (WSL)'.
Xfce
Running Ubuntu desktop in X410 via VSOCK should give you better rendering performance than the default Hyper-V console. However, if you want faster and snappier user experience, try using Xfce desktop.
Running Ubuntu desktop in WSL1
The script created in Step 3.2 (/usr/bin/start-ubuntu-desktop.sh) can also be used for Ubuntu/WSL1 and start the same Ubuntu desktop on X410 without any change after installing 'ubuntu-desktop' package;
sudo apt install ubuntu-desktop
. Before executing the script, you just need to make sure dbus service is running;sudo service dbus restart
, and the DISPLAY environment variable is pointing to '127.0.0.1:0.0' instead of ':0.0';export DISPLAY=127.0.0.1:0.0
.However, it seems Ubuntu desktop uses various services and components that are not fully compatible with WSL1. Hence, unfortunately, Ubuntu desktop in WSL1 is not as stable as in Hyper-V.
X410 with WSL2
WSL2 is based on virtualization technology similar to Hyper-V. So it should provide much better performance and stability for Linux GUI apps including Ubuntu desktop. However, currently available versions (Windows 10 build 18917 and others) don't seem to support VSOCK or shared loopback network that can be utilized to internally and efficiently communicate with X410 (Using X410 with WSL2).
We should wait a bit longer for it to mature and properly support the same handy features that are already available in WSL1. Moreover, we hope the interop features for Unix domain sockets are improved soon and allow Windows apps such as X410 to communicate directly with Linux apps just by creating a symbolic link in WSL to a Unix domain socket created in Windows. It's already partially supported but it cannot be used with X-Window apps as they call 'setsockopt' function to adjust the size of their buffers before making connections; such behavior breaks the interop requirements. However, this usage pattern is common (i.e., create a socket » adjust its buffer size with setsockopt » connect/bind) for many Linux apps and if it's supported, servers running in Windows should be able to directly service the apps running in WSL without making any modification to those apps.