Ubuntu 20.04 Linux on Surface Pro 4 – Working Pretty Well

Learn how to install and run Ubuntu 20.04 Linux on Surface Pro 4 and find out what works and what doesn’t.

ubuntu 2004 on surface pro 4

UPDATE: 22 April 2020

OK, so in the article I stated that I used the stock kernel and the touchscreen doesn’t work at all. I’ve since installed the linux-surface/linux-surface kernel and in fact the touchscreen works fantastically well. It indeed, works better for me on Linux than it did on Windows. On Windows I suffered ghost touchscreen inputs, which don’t appear on Linux. Which is weird because I thought it was a hardware problem. Perhaps it’s not. Nevertheless, touch screen DOES work nicely using the Linux-Surface-LTS kernel. I also had to adjust a WiFi setting as it stopped working after a while which wasn’t happening when I wrote this. I’ll put the updates down below though as well.

Is The Surface Pro 4 Good For Linux?

The short answer is that Linux on Surface Pro 4 is OK – depending on what you want to do with your device. I’ve set it up on my Surface Pro 4, using Ubuntu 20.04 – and previously had Linux Mint 19.3 running nicely. I prefer Mint. But there’s one aspect that I needed that I couldn’t figure out on Mint and had to switch back to Ubuntu (specifically 20.04 – since 18.04 is what Mint is based on). That was, I have an external monitor as well, and the different DPI on the internal versus external wasn’t supported on Mint, or 18.04

So, What Doesn’t Work On 20.04?

TouchScreen doesn’t work at all. It’s possible with the some messing around that it might if you install the JakeDay kernel or the linux-surface/linux-surface kernel. I did do this when I was playing with Mint and it worked. My touchscreen is suffering with ghost touches now though, so I think the N-Trig module is playing up. Since I don’t have Flickergate problems I’m not prepared to bust the screen to get it off and fixed! EDIT: See note above. Touchscreen works really well with the linux-surface/linux-surface LTS kernel and Wayland. Note that the Jakeday kernel is no longer maintained.

If you want to install the Linux-Surface kernel and firmware, I strongly recommend following their guide at https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup

Cameras. Neither camera works on Linux. I don’t care since I rarely used them under Windows. I found logging in with my face was really hit and miss and I preferred the PIN system anyway. Though of course that doesn’t exist on Linux at all πŸ™‚

Sound annoyingly resets itself to the Surface Dock hardware if you have your Surface in a Dock, as I do. It’s irritating and I’ve yet to find a solution. I suspect it works just fine when you’re not docked though.

Update: This article at https://rastating.github.io/setting-default-audio-device-in-ubuntu-18-04/ shows a quick and dirty way to fix this. I’ve not tried undocking and redocking, though I suspect that wouldn’t work well. But for my normal everyday usage, this script fixes the problem. Annoyingly, neither LMDE or Fedora have this issue, so it’s an Ubuntu weirdism.

What Does Work?

Everything else. Basically πŸ™‚

Including dual monitor with different DPI scaling for each. Sort of. It’s a bit of a fudge to get working properly. I’ll go into the details of that further down, since you may be here specifically for that reason. Edit: Wayland fixes this.

Why Would I Want Linux On Surface Pro 4?

There’s probably various different reasons why you might want Linux on your Surface Pro 4 – or any other machine to be fair. I have 2 primary reasons;

  • Privacy. Linux sends NO DATA to anyone about how I am using my computer. I don’t have anything to hide, but I still don’t particularly want Google or Microsoft knowing what I do with my computer when I use it.
  • Speed for development. I do a fair bit of development work on my Surface Pro 4 – websites mostly but also some Progressive Web App development.

    All my projects are now running on Docker containers and are deployed to Linux servers running Docker.

    I’ve played with Docker Desktop for Windows and found, at least on the SP4 that it’s horrendously slow. Even on my machine which is an 8Gigabyte Core i5 model. Granted it’s old these days, but under Linux Docker flies along with no lag. And no massive startup overhead either.

    Also, Docker Desktop on Windows has some SERIOUS shortcomings when it comes to filesystems that are exposed to the host – generally revolving around awkward permissions setups that don’t translate well into Linux Docker setups.

    Since Microsoft Visual Studio Code exists on Linux and for my use case, Linux is considerably quicker I’ve decided to make the switch.

Why Wouldn’t You Want Linux On Surface Pro 4

Well, aside from hardware issues that I mentioned initially there is one fairly sizeable reason you might not want to use Linux on your Surface Pro 4.

Software support.

I use Affinity Designer and Affinity Photo for doing some graphics work now and then. I’m not very good at it and it’s not primary focus. Coupled with the fact that my SP4 isn’t working properly with the ghosting touch screen, I decided I could live without Affinity for now. I’ll probably sort out another SP4 to solely run Windows for graphics work. Once this stupid Covid-19 pandemic passes and I can order ‘non-essential’ items again!

Also, Minecraft Bedrock Edition. It’s very annoying that there’s a Bedrock Edition Server package available to run on Linux but no Minecraft Bedrock Edition client available! But I digress. I’ll live. I might actually get some work done instead πŸ™‚

UPDATE: You’re wrong Steven… There is in fact a port of Minecraft Bedrock Edition for Linux available on Lutris. I had trouble with the Lutris version though, so I ended up installing the AppImage version from https://github.com/ChristopherHX/linux-packaging-scripts/releases – it works great. Too great. I spent all day Monday playing it with my kids and achieved precisely nothing else.

How To Setup Linux On Surface Pro 4

Setting up Linux Mint or Ubuntu 20.04 was straight forward and just worked. I tried installing Ubuntu 18.04 server on an SP4 a while ago and it simply failed. That could have been a hardware issue though. I might revisit it as an experiment and see if 20.04 installs flawlessly on that one as it did my main machine.

I’m writing this article using Firefox running on Ubuntu 20.04 Beta.

To install it, you’ll need to visit http://releases.ubuntu.com/20.04/ to download the ISO image. I’ll assume you’re still using Windows to do this. Save the file to your Downloads directory. It might take some time – it’s about 2 Gigabytes.

While it’s downloading, grab a copy of Rufus from https://rufus.ie/ and save that to your Downloads directory too.

You’ll need an 8G USB Flash drive. A USB3 drive is recommended as it’ll be a LOT quicker to install and you can use that as a Live Demo drive quite nicely too. The USB3 drives are pretty quick.

Once it’s downloaded, plug in your flash drive, reformat it if necessary, and fire up Rufus. Point Rufus to your USB flash drive and press the Select button to choose your freshly downloaded ISO. It’ll take about 3 or so minutes to copy the files across to the USB drive.

Once that’s done, you may need to enable Booting from USB in the Surface Pro 4’s EFI screens. To get there you need to shutdown Windows. Once Windows is shut down, press the Volume-UP hardware button on the top of your Surface Pro 4. Then press the power button. When the SP4 starts up, release both buttons. You should then be in the EFI settings screen.

Choose Boot Options and make sure USB boot is enabled and shows up ABOVE Windows Boot Manager. If you want to be certain you’ll get your USB booting you can click Windows Boot Manager to disable it.

Then reboot again. If everything went well you’ll be booting Linux on your Surface Pro 4 from the USB key.

Multiple Monitors With Different DPI / HiDPI on Linux Ubuntu 20.04

As I mentioned above, one of my use cases (which Windows just deals with I might add) is that I have a second screen I want to use. It’s a 1080p screen – so it’s nowhere near as HiRes as the Surface Pro 4 screen.

The Surface Pro 4 screen is considered HiDPI ( also known to Mac fans as Retina ). Which means it’s nice and crisp and clear. It also means that in standard usage everything on it looks absolutely tiny on Linux.

Fortunately you can set the display scaling to 200% and things will look normal. Except they’ll look massive on the second screen, because the second screen isn’t HiDPI and as such it’s overscaled.

Searching around the internet shows that Linux is not geared up to support this well at all. Indeed, until recently it didn’t appear possible at all. Many pages I found talked about using Wayland instead of X11. I have no idea what that all meant and didn’t care – I just want something that works! Update: With more research I have found out more about Wayland. It’s included with 20.04 but the default server is X.org. To switch to WayLand just log out of your current session. On the login screen, select your username but don’t enter your password yet. Look for the little gear icon in the bottom right. Click it, choose Wayland Session. Enter your password. You’re now logged in with a Wayland session instead. See below for more on Wayland and why it’s the way forward – at least if you need HiDPI.

Fortunately Ubuntu 20.04 does work. But there’s a catch.

Setup HiDPI on one screen, with normal DPI on second monitor

Ubuntu 20.04 Linux on Surface Pro 4 - Working Pretty Well 1

To do this under Ubuntu 20.04 you’ll need to open the Settings App. You can do that by clicking on the little downward facing arrow in the top right hand corner of your screen and choosing Settings from the drop down menu. The choose Screen Display from the window that pops up.

The quirk / catch that I’ve been mentioning a LOT is that you MUST switch on Fractional Scaling. I found that if I didn’t have Fractional Scaling switched on then whatever one screen was set to was also what the other screen was set to.

Very annoying.

The warning that Fractional Scaling will reduce performance, increase power consumption etc is semi-reasonable. From what I can tell it does make things like Firefox demand a bit more processing power. But meh – it works.

Once fractional scaling is switched on you can set the scaling on your external monitor to 100% and your Surface Pro 4 to 175%

Can I Set Fractional Scaling to 200%?

You can – and you’d probably end up with a slightly more comfortable sizing, particularly if you’re getting on in years like I am and can’t see small fonts so well. However, at 200% for some reason, the mouse cursor flickers wildly whenever any updates happen to the screen.

I found LOTS of people complaining about this online on various forums. One suggestion was to reboot into Recovery Mode and choose Root Shell and create an xorg.conf file in /etc/X11. I tried this fix (and a bunch of others). Unfortunately, when I created an xorg.conf file the screen is corrupt. I’m not sure if that’s my hardware at fault – but it works properly without that file created so I suspect not.

So, I decided to work with 175% scaling because then the cursor is not flickering. It works – but is a little small for my eyes.

UPDATE: Use Wayland!

So, I finally got around to switching my desktop to use Wayland instead of XOrg, All the annoying problems from above are gone. And the system load has dropped dramatically meaning the Surface Pro 4 feels considerably more snappy than it did before too.

Despite what I had heard somewhere, Firefox works perfectly under Wayland on Ubuntu 20.04. Web windows scroll nicely with no tearing. There’s no flickering mouse pointer and I have 200% scaling on the Surface Pro screen and 100% scaling on the other monitor. Do be aware though that a lot of programs don’t support HiDPI well. Firefox is in fact one of these. It looks absolutely fine on the Surface Screen, but on the normal resolution monitor it’s huge. I actually don’t mind that because if I want something to look massive so I can read it easier I can drop it on that screen instead πŸ™‚ EDIT: I’ve found a solution for this too – since it worked on Fedora which uses Wayland I figured it ought to work on Ubuntu. And with the fix, it works fabulously, proper scaled on both screens πŸ™‚

To get Firefox to scale properly on a non HiDPI monitor, open up a terminal. Type sudo edit /etc/environment and add the following line, close and save the file and reboot.


Add that line to /etc/environment, reboot and you’ll get proper scaling in Firefox

I’ve installed Minecraft Bedrock Edition using ChristopherHXs Launcher. It works extremely well and is very very fluid. I’d go as far as to say it’s easily just as good as the Windows 10 version on the Surface Pro. My life is now officially complete!

To switch to using Wayland, just log out of your current session (save any work first of course!) and then look for the little gear icon in the bottom right hand side of the login screen. Switch to using Wayland on Ubuntu, then login as normal. Next time you login it should remember that you want Wayland.

Are There Any Other Problems With Multi-Monitor Linux On Surface Pro 4?

Annoyingly yes, but this one is very very easy to get around.

When you reboot, or log out and log back in again, if you’ve moved your monitors around then Ubuntu won’t remember where you set them. For example, the default setting on Ubuntu is for the secondary screen to be positioned to the right of the primary screen.

On my desk I have the secondary screen to the left of my Surface Pro 4. Every time I rebooted, Ubuntu insisted on re-arranging everything incorrectly.

But, thanks to Ed Eustace and his little script and instructions at https://gist.github.com/edeustace/25dff3c3aab8d5d468b7ef0983443a31 there’s a suitable workaround. I’m not sure why this isn’t part of Ubuntu already, especially as the problem has been worked around since 2014 at least. But nevertheless it is.

UPDATE: This too is fixed when using Wayland. The script is no longer needed.

WiFi Dropping Out On Surface Pro 4 Running Ubuntu 20.04

This problem didn’t happen when I first wrote this article. I’m not at all sure why it suddenly started to manifest itself after about a week of using it. Nevertheless, I found that at random times the internet would disappear. Initially I thought it was my router. But on checking the phone I saw that in fact the WiFi router was still alive and well. The Surface Pro had disconnected from it though.

On one occasion Ubuntu told me that there was no WiFi hardware at all. This is a problem.

There were a few times when the WiFi disappeared and a restart fixed it briefly. But generally it only lasted a few minutes after a warm reset like that. It had to be switched off and restarted and then it would last longer.

However, there appears to be a fix;

Edit /etc/NeworkManager/conf.d/default-wifi-powersave-on.conf

In that file you will see a line that looks like this;

wifi.powersave = 3

Change the 3 to a 2 (which means disabled) and reboot. The problem should be resolved.

Enjoy Linux On Surface Pro 4

That’s it. That’s all I did to get it working pretty smoothly. It works for my use case considerably quicker than Windows. The annoyances are worked around and since I don’t care for the cameras anyway I’m not missing anything πŸ™‚

Once Linux Mint is updated to use Ubuntu 20.04 as its base system I might switch back to Mint. I just liked the extra little flair and ‘pizazz’ that Mint has compared to Ubuntu. But that’s just me πŸ™‚

If you have any questions or comments please do feel free to leave a comment below. Thanks for reading and good luck with your own Linux installation on your own Surface Pro 4!