Surface Pro 7 as portable Linux Dev Machine
For quite some time I’m looking for a small-footprint laptop for traveling that supports my Linux-based workflow. So naturally, I decided to use a Windows machine with no first-class Linux support: The Surface Pro 7.
Table of Contents
Finding the best hardware
The hardware we use daily should be the best we can justify affording and is adequate for our professional use. A craftsperson wouldn’t buy a cheap hammer or electric tool at “Home Depot”, they would buy professional-grade gear, and so should we.
But that’s easier said than done…
Everyone has different priorities when it comes to hardware. The raw power isn’t necessarily the most important part anymore, IMHO the last generations of Intel CPUs didn’t improve performance in a significant way for my personal workload.
Reliability and usability are more important to me. That’s why I hate my Touchbar MacBook Pro so much.
MacBook Pro
For years the only acceptable laptop for me was a MacBook Pro.
Best build quality thanks to metal-chassis, great battery life, enough power, and mostly compatible with my Linux-based workflow thanks to the underlying BSD.
But then Apple decided to make it even thinner and get rid of some of its best features:
- No more MagSafe.
- No more Escape and Function keys, but here’s a crappy touchbar you will trigger by accident all the time.
- No more usable keyboard, and be prepared to visit an “Apple Service Partner” to get it fixed, at least temporarily.
- No more interchangeable parts, pay upfront or be out of luck.
- And no more ports diversity, USB-C is enough for everyone. EVERYONE.
- macOS is now also a mess, with non-working features and lots of great new bugs with every release.
And without having an Apple Store near me (next one is ~100km away) I have to take the machine to an authorized service provider, which has to order the replacement-part while keeping the device. Thanks to all the failing MacBook Pro laptops it might even take a few weeks. Like the time the keyboard failed me. Or the time the display started to get yellow tinting all over it.
The only reason I put up with all that is the need to be able to build iOS apps. Vendor lock-in at its best.
Besides that, it just sits on my table, not even powered on.
I know Apple released the 16-inch MacBook Pro recently to try to fix some of its many problems, and but I’m not willing to shell out another 3k+€, especially with the degrading software quality of macOs if I won’t use a machine as my daily driver.
Dell
For my real work (a.k.a. non-iOS) I use a Dell XPS 15 9560 with a FullHD display from 2017 running with Ubuntu 18.04 LTS. It’s heavier, uglier, lower build-quality, smaller trackpad, and low-res screen compared to the MacBook Pro. But it’s reliable, indestructible, lots of ports, and you can get affordable on-site support.
Wanting a smaller laptop I thought about replacing it with a 13-inch XPS. Although it seems Dell isn’t able or doesn’t care to fix the coil-whine problems with the XPS 13 for quite some years, and that is not acceptable. The 15-inch can also have coil-whine issues, but it seems to be more infrequent compared to the 13-inch.
Almost every small laptop/ultrabook form-factor has some coil-whine issues, but you have to press your ear on the keyboard to hear it. With a Dell, it’s Russian roulette how loud it might be, from “none at all” to “audible in a normal office environment”.
Lenovo
IMHO the only other business-grade laptop manufacturer is IBM, ehm, I mean Lenovo with their Thinkpad product line. They might have an arguably dated design, but they are neutral-looking, are highly customizable, the non-ultrabooks are serviceable, and they are mostly Linux-compatible.
My biggest problem with Lenovo is the keyboard: Even though it’s great for typing, they’ve misplaced the fn key. From time to time I use a Lenovo Thinkpad USB keyboard and besides being great I have real problems using shortcuts thanks to the fn/ctrl change.
A smaller point against Lenovo is also the pricing. It’s higher compared to other options like Dell, but in the end, I wouldn’t care if it hits all the other requirements. You shouldn’t cheap out on the tools you need the most in your daily work.
Surface Pro 7
I owned a Surface Pro before, Model 3, and I actually liked it, but I don’t like Windows for my work setup. But this (hopefully) has changed with the introduction of the Window Subsystem For Linux Version 2.
A portable and powerful device that can be used as a tablet with an almost real Linux running on it, with Docker support, and even X11 apps running in Windows?
Sound too good to be true, so let’s check it out!
Setting up the Surface Pro 7
Update to Windows 10 Pro (or Enterprise)
First things first, you want to have at least Windows 10 Pro, or even better, Enterprise. You can run WSL2 on Windows 10 Home, but I’m unsure about Docker.
Become an Insider
Right now WSL2 is only available in the Windows Insider builds. It seems to be released on the slow ring, at the time I started it was only available in the fast ring. So there might be some general issues, but it’s a prerequisite.
The Surface isn’t my main machine, so I’m ok with the risk, YMMV.
- Register your Microsoft account for the Insider program at https://insider.windows.com/.
- Open Windows Insider settings (on your Windows 10 PC go to Start > Settings > Update & Security.
- Click Get Started and link your account.
- Select Slow Ring.
- Go to Settings > Update & Security and click Check for updates to download the latest build.
Windows Features
Run this in a PowerShell with admin privileges and reboot afterward to install the required features:
Install Ubuntu 18.04
Activate WSL2 and download the latest Ubuntu 18.04 app image from the App Store, all with the PowerShell:
Of course, you can use another distro if you like, it’s just that all my other Linux machines are running Ubuntu 18.04.
Docker Desktop Edge
The Docker Desktop Edge is supporting WSL2:
- Download and install https://download.docker.com/win/edge/40807/Docker%20Desktop%20Installer.exe.
- Start Docker from the start menu.
- Under Settings > General enable the experimental WSL2 engine.
- Click Apply & Restart.
Linux setup
Install your Linux as you would on any other machine.
For setting up our Linux dev machines (ZSH, extra tools, etc.) we’ve created a set of scripts to automate the process.
X11 vs. native
X11
One of the advantages of my dev setup is using X11 apps in Docker containers so the setup won’t differ regardless of the machine or Linux distribution used. I wanted to do the same with WSL2.
There are multiple X11 servers available for Windows (X410, VcXsrv, and more) and you can use them with WSL2.
I’ve decided to use X410, you can it directly from the Windows Store. To actually use X11 and WSL2 you have to activate Allow Public Access via the taskbar item.
And you have to export the correct IP address to the DISPLAY
environment variable in WSL2, e.g. in your .bashrc
are some was similar:
Now you can use X11-enabled Docker containers like before.
So I ran my Eclipse container, and it sucked… The UI drawing was horrendous, HiDPI-scaling was unusable/unconfigurable. More proof of concept than daily driver.
Native
Due to the bad results with X11 I’ve decided to check out a mix of WSL2 and native Windows apps.
The servers I need (Mysql, MongoDB, RabbitMQ, Nginx) were dockerized, but Eclipse will be a natively installed Windows app.
My workspace needs to reside in the WSL2 to utilize all the Linux greatness.
Access will happen through the 9P filesystem, which can be accessed by the UNC path \\WSL$\<your distro>
.
So I mapped the UNC path to a drive for easy access… and Eclipse failed to use it. After some research, it appears Eclipse doesn’t like having a workspace on a network drive due to locking mechanisms involved on Eclipse’s side. But you can deactivate this, it finally worked.
Until I imported my projects… and waited… and waited… and waited. After a few hours, I gave up due to the astonishing bad performance, which made it unusable.
A solution might have been to put all my files into Windows, but then I just would have used WSL2 for some docker containers, everything else would have lived in Windows, and that’s not what I wanted.
The WSL2-Linux-setup I’ve dreamed of might not be (yet) the solution I hoped for.
Conclusion
The Surface Pro 7 is a great machine, being able to use Linux in an almost native way is incredible, but it didn’t work out (for me).
I knew beforehand IO performance isn’t on par or near-native, but this was totally underwhelming, even though I suspect Eclipse being the main culprit.
Many people build WSL2-Linux setups and it worked great for them, but with my toolchain/dev-setup, I would need to build a Windows with just a little sprinkle of Linux-setup. I want to replace my other laptop with an almost as good option, not a sub-par dev-experience one.