Ubuntu 20.04 Linux on Surface Pro 4 – Working Pretty Well
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.
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
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.
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.
MOZ_ENABLE_WAYLAND=1Add 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;
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!
Please keep up the good effort on updating us (speaking for everyone who has a SP4, like me) with these kids of update.
I’ll be sure to come back here again and again and again.
Thanks for your kind words and glad it was useful for you!
All the best,
Excellent guide. Thank you!
I did install Ubuntu20 on my Surface Studio, on a “try before you buy” basis, i.e. running off the USB stick. I found that the camera just gives a very low contrast picture. I’ve tried the available adjustments, to no avail. So I’ve gone back to Windoze10. Would an update/upgrade have fixed it?
It is possible that a future update will fix that – but I’m not on the Surface-Linux team (and wouldn’t know where to begin!) so that might be a question for them 🙂
I’m going to try installing Ubuntu on my Surface Studio. Before I do, any advance with the camera? I use it for video Skype calls, and it works really well. Good picture and sound while sitting comfortably at my desk.
Steve, this was an incredibly helpful post thanks for putting it together! Did you happen to get multitouch & touchscreen scrolling working in Firefox? I have the LTS version installed and running great, but the touch only acts as click/drag/select.
Well, this is an incredibly great read!
Im also running Ubuntu 20.04 on my dell 7275 which is a microsoft surface like device.
You might want to look into touchpad gestures using libinput-gestures. They working
Hi Steve. Thanks for the great article. I’ve been contemplating switching my SP4 over to linux and you may have just convinced me to give it a try. One questions though… how’s the battery life? My SP4 (running Win10) suffers from battery drain while turned off. I can charge it to 100%, turn it off, and when I come back the next day it’ll be around 87%. Microsoft has done nothing to address this common issue. I’m hoping it’s a software problem which linux might fix.
Hi Ken. Have similar problems with battery drain on my SP4 with Win10. I’d be very intrested if you could give an update if you found that problem resisting after Linux installed?? If it’s gone under Linux it would be a very strong motivation for me to go for Linux too.
I’d have to pass that one over to someone else to answer – I didn’t notice to be fair but I generally run my Surface Pros on a Docking station for convenience. My SP4 running Ubuntu is also running my home security cameras now so I can’t unplug it overnight to see what it does I’m afraid. Someone else may know though – or perhaps have a look at the SurfaceLinux project on Github as they may have addressed it.
Thanks for the great post as it led me to get the surface-linux installed and getting the touchscreen to work!
Glad to have helped! Enjoy Linux on your Surface – it’s pretty good!
Hi Steve, thanks for the article it was very helpful. I have a question on the link you sent about installing the touchscreen features. One of the last steps says to “ Update your bootloader to point to the new kernel”. I’m still pretty new to all this, do you have any advice or links to videos that would help us know how to do the stuff?
I have a surface pro four with a windows 10/ Ubuntu dual installation.
How did you install linux-surface kernel? They don’t have prebuilt packages for Ubuntu, so did you compile from source?
Hi JAFAF, you need the Debian instructions.
Is there a way to get the touchscreen working once you have 20.04 already installed? I have a SP5 but the instructions seem to be for a fresh install.
I am dual booting with W10, too. I still need it sometimes…
Great write up!
You can install the Surface-Linux kernel at any time – just follow the instructions for Ubuntu – if there’s no instructions specifically for Ubuntu then follow the Debian instructions.
Hope that helps
any suggestions for a better on screen keyboard for ubuntu 20.04 on wayland ? i can’t seem to get anything apart from default.
No idea sorry – my touchscreen is playing up and I’ve not used the onscreen keyboard at all – someone else might have some suggestions though 🙂
Steve, thanks for the awesome post. I’m wondering about this line in the installation guide:
Before installing the custom kernel, make sure that you have installed the DKMS version of any out-of-tree kernel module that you have installed (zfs -> zfs-dkms, nvidia -> nvidia-dkms etc.). Otherwise these modules will not work with the custom linux-surface kernel.
How do we identify all out-of-tree kernel modules from a fresh Ubuntu 20.04 install?
If you’re on a Surface Pro 4, you probably don’t have any DKMS modules installed. It’s more for the Surface Books and such like that have nVidia drivers. Unless you have ZFS installed? But I don’t know anything about that one I’m afraid.
Hope that helps,
Nice post btw, it encourge me to try linux again on my SP4.
Did you manage to make the cameras work?
Since these days we use webconferencing for everything, i really need to get the camera working…
Thanks for your kind words – unfortunately the cameras don’t work at present. The SurfaceLinux kernel development team are working on it but as yet, they’re still not there.
Great article Steve
I look forward to getting me one of these machines and do what you have done. Thanks for making the path. I am just getting into this and feel that I would like to know more about the differences between the different types of Surface Pro’s. The 4 seem to be a few years behind, is that so? And how is the second hand quality on these things, do you have any idea?
I think the SP4 is one of the better devices, although you are absolutely right in that it is getting on a bit now. But, it’s one of the only ones (to my knowledge) that can have the SSD upgraded internally. Obviously you need to get the screen off to do that, but the screens fail on second hand ones so when you’re replacing a failed screen it’s a great time to update that SSD 🙂
I just installed Ubuntu 20.04 out of the box and everything is working except the touch screen like you pointed out. Have not messed with the camera at all, but I do not use it one bit. I wouldn’t mind seeing the touch screen for use with the pen for note taking, but I have my ipad that is WAY better for the pen and notes (thanks MS for OneNote).
I’m pretty happy with this version of Ubuntu working out of the box. This is a great secondary system to port around the house and mess with.
Thanks for your feedback, glad you found it useful. If you want the pen, have a quick look at https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup – if you only want the pen you can use the current kernel. If you want pen and touch you’ll need the LTS kernel instead, but it works a treat under Ubuntu 🙂
Don’t be put off by it being on Github – you don’t have to compile anything yourself, you can just add a PPA and install it using apt-get
The only thing I’ve noticed with the surface-linux kernel is that it seems to increase the loadavg at idle. The machine still feels plenty snappy enough though so it’s not a big drama.
Have Your Say:
This site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. We may also participate in other Affiliate programs. For further information please see our Affiliate Disclosure