Install Ubuntu on Microsoft Surface Pro

Microsoft's Surface Pro tablets look like an attractive work tool because they allow you to install traditional desktop applications.

The theme with installing Linux on Surface is not new and quite popular:



Microsoft Surface Pro with Ubuntu installed 19.10 (Eoan Ermine)

My interest in Microsoft Surface Pro arose when I found out that the American online store Amazon sells officially restored 12-inch tablets from previous generations in good trim levels at prices of two or even three times cheaper than the latest generation of devices. But when you buy a tablet restored by the manufacturer, you actually get a new device in films and a box with a Refurbishment mark, and all this at a low price.

In general, I could not resist and bought Microsoft Surface Pro specifically in order to install Linux on it and use it in work.

The Surface product line is quite wide and includes tablets, laptops, interactive whiteboards and it’s not always clear which model the seller on Amazon means - it happens that the sixth generation is indicated, such as in the announcement “ Microsoft Surface Pro 4 (2736 x 1824) Tablet 6th Generation (Intel Core i5-6300U, 8GB Ram, 256GB SSD, Bluetooth, Dual Camera) Windows 10 Professional (Renewed)”, but in fact the seller is misleading mentioning sixth generation - you can confuse, thinking that this is Surface Pro 6, but actually it is Surface Pro 4. So mindfulness will not hurt.

image
Microsoft Surface Product Line

Why Linux?


I have been using Windows for more than 25 years, but less and less in recent years - there is no need to use any special programs that exist only under Windows - everything smoothly moves to cloud services that depend only on the browser.

Moreover, my passion for smart homes contributes to the use of the command line in particular and Linux in general. Some actions are easier or faster if you have a Linux computer.

About Surface Pro tablets, I had some doubts about how easy it would be to replace the system from Windows to Linux, but as it turned out in the future, these doubts were completely in vain. Installing Ubuntu went smoothly like on a regular laptop. It is on a laptop, not a tablet, although the Surface Pro is positioned by the manufacturer as a tablet. In my opinion, this is still a laptop, not a tablet - touch control for Windows and Linux is still not a priority in my opinion.


The Surface Pro tablet after purchase works on Windows.

Please note - by default, the Autodesk SketchBook is rendered in the start menu - I'll talk about it below.

Digital painting with Surface Pro


In addition to all the basic functions of a regular laptop, Surface Pro can be used as a graphic tablet (that's why Autodesk SketchBook is in the main Windows menu by default). When using a stylus (not necessarily branded, but compatible), the Surface Pro screen recognizes the degree of depression, which is important for digital drawing on the screen.


A picture of an Autodesk SketchBook from the Internet when this application was still paid

When using Linux on a Surface Pro tablet, the screen does not lose its ability to be a graphic tablet and although Autodesk SketchBook for Linux does not exist, there is Krita , a free open-source raster graphics editor included with KDE Krita is convenient and allows you to create beautiful drawings, for example, even existsopen source web comic by French artist David Revois called Pepper & Carrot .

Looking ahead, I’ll say that the stylus also works under Linux - pressure levels are recognized.


The main page of Pepper & Carrot comics , drawn exclusively in Krita on Kubuntu 18.04 LTS

From the general features of the Surface Pro tablet, let's move on to installing Linux.

Before installing Linux


Immediately after purchase, the tablet runs on the English version of Windows 10, and before installing Linux, create a Windows backup disk.

For the Linux installation itself, you will definitely need a USB hub to connect the keyboard and mouse, because there is only one physical port on the device, and the touchscreen will not work during the Linux installation.

Create a Windows 10 recovery disc



Creating a recovery disk on Surface Pro

Even if you don’t have plans to leave Windows on your Surface Pro tablet and use only Linux, it’s better to create a recovery disk so that you can restore the system, for example, before selling the device. Detailed instructions in Russian on how to do this are on the Microsoft website . The English-language names of the menu items can be found in another language section of the same instructions on the Microsoft website .


The creation process is long enough and we can talk about the clock if you write on MicroSD 16 GB

Surface UEFI


To configure boot from a USB flash drive, turn off the computer completely and go into the BIOS, hold the volume up button and press the power button to change the order of the boot devices.


Surface UEFI

In the Boot configuration section, drag the boot from the USB flash drive to the first place with your finger.

For further manipulations, a USB hub is already needed. In my case, the monitor became a hub with connected wireless keyboard and mouse, as well as free USB ports for connecting a bootable USB flash drive.

Linux installation


Before choosing a specific distribution kit, you should know that both cameras on tablet models, starting with Surface Pro 4 and above , will not work under Linux , due to the fact that the cameras are on the PCI bus instead of the usual USB bus, like the previous models. And on Surface Pro 7, the pen (stylus) will not work under Linux yet. You can choose any distribution based on Debian / Arch Linux / Fedora / Gentoo.

My choice fell on Ubuntu, because, in my opinion, the desktop shell with its large buttons is more suitable for touch control. Easy setup of HiDPI high-resolution display is only a plus of this distribution.

After loading the tablet from a bootable USB flash drive, a menu of boot options appears and boot options can be selected using the on-screen keyboard.


GNU GRUB on Surface Pro

After booting Ubuntu from a USB flash drive, the touch screen does not work, but Wi-Fi works.


Sample Ubuntu before installation

To paint the installation steps, probably does not make much sense, because the installation is the same as on a regular computer . Windows decided not to leave, but completely erase the disk and install only Ubuntu.

Immediately after the installation is complete, Ubuntu and login will not work:
  1. Touchscreen.
  2. Stylus.
  3. Cameras.

Restore Touch Screen and Surface Pro Stylus for Linux


Install the custom kernel


To restore the touchpad and pen, we will use the custom kernel for the corresponding distribution . Commands for Ubuntu are given below.

Before adding a repository, you must import the keys that developers use to sign the packages.

wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
    | sudo apt-key add -

After that, you can add the repository itself by doing:

echo "deb [arch=amd64] https://pkg.surfacelinux.com/debian release main" | sudo tee /etc/apt/sources.list.d/linux-surface.list

Then refresh the list of packages for updates:

sudo apt-get update


Screenshot of the terminal with commands to add the linux-surface repository.

Install the kernel, but not the latest kernel surface, which was version 5.5.10 in March 2020 - with this version of the kernel, neither the pen, nor the touchscreen, nor the multi-touch worked correctly. Developers recommend installing the 4.19 kernel (Long-Term Support until the end of 2020):

sudo apt-get install linux-image-surface-lts linux-headers-surface-lts linux-libc-dev-surface-lts surface-ipts-firmware linux-surface-secureboot-mok libwacom-surface

But if you still want to try the latest kernel, you should use other commands:

sudo apt-get install linux-headers-surface linux-image-surface linux-libc-dev-surface surface-ipts-firmware linux-surface-secureboot-mok libwacom-surface

Screenshot of the terminal with commands for adding a new kernel 4.19 (LTS).

Then there are two options (if you have not changed the Secure Boot security settings):

  1. If you installed the Linux kernel version 5.5.10 on Surface Pro, then immediately after installing the new kernel reboot and enter the password “ surface”, which was specified during installation, as in the screenshot above. This can be done by choosing the menu items: Enroll MOK / Enroll the key (s) -> Yes / Password -> surface.

    Configure Secure Boot after reboot
  2. If you installed the kernel 4.19.110, then the tablet will boot as usual and you will not get to the Enroll MOK menu.

The idea behind this safe download is to allow only trusted software to be downloaded to your computer and thus block potential viruses and rootkits that would not otherwise be detected by our operating system. Since custom kernels such as the one we used can be compiled and distributed by any user, they are considered untrustworthy by your bootloader, and therefore, if you have secure boot enabled, the download will not be allowed.

Editing GRUB to set another kernel to load by default


After installing a new kernel, surfaceyou need to update the bootloader of the GNU GRUB operating system, pointing to this kernel. By default, the kernel is installed along with the main distribution provided by the distribution. Thus, it turns out that there is a backup core that can be used if something goes wrong.

There are also two options, depending on which core was installed:

  1. Kernel version 5.5 - in the bootloader, it will automatically be installed in first place, you do not need to do anything extra.
  2. Kernel version 4.19 (LTS). For the default boot to take place with this particular kernel, additional steps are required.

Actions to be taken to register surfacedefault kernel load in GRUB :

  1. First back up / etc / default / grub. If something goes wrong, you can easily return to the well-known copy:

    sudo cp /etc/default/grub /etc/default/grub.bak
  2. Then edit the file using the selected text editor (e.g. gedit for Ubuntu):

    sudo -H gedit /etc/default/grub
  3. Find the line that contains GRUB_DEFAULT - this is what you need to edit to set the default value. For my case I write:

    GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.19.110-surface-lts"
  4. Save file a, then create an updated GRUB menu with the command:

    sudo update-grub

Using Linux on Microsoft Surface Pro


After all these settings, you can use the tablet for Linux - all the features of Microsoft Surface Pro, except cameras, work, but can you take pictures on the phone?


Microsoft Surface Pro with Ubuntu 19.10 (Eoan Ermine) installed.

Author: Michael Shardin ,
March 30, 2020

All Articles