DEV Community

Cover image for Windows 10 on Arm with WSL 2
Jason Andrews for AWS Community Builders

Posted on

Windows 10 on Arm with WSL 2

Windows 10 on Arm is emerging as a key platform for cloud native software developers. Developers building containerized applications for IoT and AWS Graviton processors can benefit from having a laptop with the same Arm architecture on their desk. Using the same architecture for all phases of development provides interoperability, consistency, and saves time.

Historically, the Arm architecture has been strong in mobile and embedded. Recently, AWS introduced impressive price performance with AWS EC2 instances powered by Graviton processors. Low power and a diverse silicon ecosystem paved the way in IoT, and AWS Graviton processors delivered impressive performance gains in the cloud. The transition to Arm on your desk with the right mix of battery life and performance is underway now. Let’s see how Windows 10 on Arm has become an interesting option for software developers.

Windows 10 on Arm introduction

New Windows 10 laptops with Arm processors have been introduced with common characteristics:

  • Always connected, 4G LTE and 5G connectivity
  • Always on, advertised as “all-day” battery life
  • Thin, light, and fanless

These machines are developed in partnership with Qualcomm and have 64-bit, octa-core configurations of the Armv8-A (AArch64) architecture.

Current examples include:

The performance of these laptops is very good, but most reviews highlight “software incompatibility” due to the Arm architecture. Currently, Windows 10 on Arm runs 32-bit x86 applications, but Microsoft has recently announced 64-bit x86 (x64) support. This should start to appear before the end of 2020.

There are multiple browsers available including Microsoft Edge, Firefox, and Chromium which are compiled for Arm. Some 32-bit x86 applications, including Microsoft Office, run well and users may not know they are 32-bit x86 applications.

Software developers use office applications, but they are going to be more interested in the benefits of having an Arm laptop for software development when the cloud and IoT systems they target are based on the Arm architecture. Let’s get started with Windows 10 on Arm.

Installing WSL 2

Many software developers work on Linux creating applications and containers. Windows 10 on Arm includes the Windows Subsystem for Linux 2 (WSL 2). WSL 2 replaces the system call translation layer provided in WSL 1 with the latest virtualization technology to run a complete Linux kernel. With WSL 2 running on a Windows on Arm laptop users get a complete Linux kernel that supports any Arm Linux distribution. WSL 2 can also run containers for application development. WSL 2 provides much faster file I/O compared to WSL 1 and is a great place to start for software developers.

Installing WSL 2 requires a recent Windows 10 version, but the laptops listed above all support WSL 2.

I have provided the short version of how to enable WSL 2 here. Microsoft documentation provides a Quickstart with full details on how to install WSL 2. There are also numerous tutorials available.

The three steps to get WSL 2 are listed here.

First, open “Turn Windows features on or off” in the Windows control panel and make sure “Virtual Machine Platform” and “Windows Subsystem for Linux” are checked.

Turn Windows features on or off

Next, download and install the Linux kernel update package. There is a special version for Arm systems so make sure to get the Arm version. Install the msi file just like any other Windows application.

The last step is to set the default version to WSL 2 using the following command at a PowerShell or Command Prompt.



> wsl --set-default-version 2


Enter fullscreen mode Exit fullscreen mode

Once WSL 2 is installed, the Microsoft store is the easiest place to start. Installing Ubuntu 20.04 is quick and easy from the store. Ubuntu can be upgraded to the newest version, 20.10, using the command line. Do a quick search for the exact instructions.

Now let’s look at some common development tools.

VS Code on ARM64

Visual Studio Code is popular for software development. VS Code is supported as a native ARM64 application. The Remote WSL extension makes Linux appear seamlessly from VS Code running on Windows. It provides all of the office productivity of Windows while developing with Linux-based tools, including a Linux terminal.

I use the VS Code insiders version.

If you are starting VS Code from WSL 2 make sure to type code-insiders instead of just code if you installed the insiders version.

To start in a Linux directory use:



$ code-insiders . 


Enter fullscreen mode Exit fullscreen mode

It’s also possible to start from Windows and create a new WSL target and directly open a folder on Linux.

The Help -> About shows the version and arm64 as the platform.

VS Code About

Windows Terminal

The new Windows Terminal is a great companion to WSL 2 and is available in the Microsoft Store. Each tab in the terminal can be Command Prompt, PowerShell, or any Linux distribution installed in WSL 2.

Windows Terminal

For more details about the development check out the GitHub project.

Arm Linux Desktop using XRDP

WSL 2 doesn’t have any integration with a Linux desktop or graphical applications. Think of WSL 2 as a remote computer. I experimented with various ways to run graphical applications. I found XRDP works best for me. There are many other possibilities such as VNC or a Windows X server.

To run an Arm Linux desktop on WSL 2 install Xfce desktop, find the IP address of WSL 2, and connect using any RDP client from Windows.



$ sudo apt install -y xubuntu-desktop xrdp net-tools
$ echo xfce4-session >~/.xsession
$ sudo service xrdp restart


Enter fullscreen mode Exit fullscreen mode

Find the IP address:



$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.28.101.34  netmask 255.255.240.0  broadcast 172.28.111.255
        inet6 fe80::215:5dff:fe42:3ab4  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:42:3a:b4  txqueuelen 1000  (Ethernet)
        RX packets 271939  bytes 409065977 (409.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 55378  bytes 6239422 (6.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Enter fullscreen mode Exit fullscreen mode

Install Microsoft Remote Desktop from the Store or run any other RDP client and connect to the IP address of WSL 2. I found Microsoft Terminal Services Client (mstsc) has the best performance.

Arm Linux desktop

Remember, the IP addresses changes for WSL 2 when it is restarted.

Using ssh server

Another common developer task is to ssh to WSL 2. This can be done from Windows or any other machine. There are numerous ssh clients, pick one you like.

To install the ssh server in Ubuntu use:



$ sudo apt install openssh-server
$ sudo /etc/init.d/ssh start


Enter fullscreen mode Exit fullscreen mode

Some distributions might to need enable ssh access using passwords. Edit the file /etc/ssh/sshd_config and set PasswordAuthentication yes

Use ifconfig to get the IP address and then run ssh with the displayed IP address.

Summary

This has been a quick intro for Windows 10 on Arm with WSL 2. Software developers building Linux applications and containers may find it valuable to have the same architecture on their desk, in the cloud, and for IoT devices.

If you are targeting AWS EC2 instances with Graviton processors or Arm powered IoT devices a Windows 10 on Arm laptop may be worth a try.

Top comments (1)

Collapse
 
sparkleholic profile image
Junil Kim

Thank you!
This is a very useful post for me. :)