Install Ubuntu Linux on a USB stick for Microsoft Surface
The following quick and dirty procedure will install the latest version of Ubuntu on a USB stick. Contrary to many procedures found on the Internet, this procedure does not result in a “live preview” version of Ubuntu, but results in the full blown version.
Ubuntu 17.04 is the lowest version that works with the advanced hardware of the Microsoft Surface (e.g. the detachable keyboard).
Note: This procedure could be a lot easier, when compressed image files become available with version 18.04 of Ubuntu.
Since we might need to modify the Secure Boot settings in order to allow booting from the Ubuntu stick , please verify that the Bitlocker recovery key (in case anything goes wrong) is available at https://account.microsoft.com/devices/recoverykey (or you have a safe copy on a thumb drive).
If not, go to Control Panel > System and Security > Bitlocker Drive Encryption and choose “Back up your recovery key”.
Open the Surface firmware settings:
- Shut down your Surface device.
- Press and hold the volume-up button on your Surface and at the same time, press and release the power button.
- When you see the Surface logo, release the volume-up button. The UEFI menu will display.
In the Secure Boot Menu, make sure that both Microsoft and third party CA’s are allowed (this was the default on my new (2017) Surface Pro, but not for my older Surface 4 Pro).
Change the boot-order to make the Surface device boot from USB first.
Download and install Rufus from http://rufus.akeo.ie/ on your Surface. This software is needed to prepare the USB stick and install the Ubuntu Linux distribution.
Download the special light-weight desktop version with mkusb-dus from https://help.ubuntu.com/community/Installation/UEFI-and-BIOS#Installation_from_a_compressed_image_file. The file you are looking for is named dd_dus-lxde_16.04-UEFI-n-BIOS_2017-05-07_intel-4-pendrive-7.8GB.img.xz.
Insert the USB stick into your Surface.
Start Rufus by double-clicking the downloaded file from Step 1. Use the following settings:
- Device -> double-check it is the choosen stick!
- Partition scheme -> GPT partition scheme for UEFI
- File-system -> FAT 32
- Cluster-size -> 16 kilobytes
Select Create a bootable disk using DD image and select the downloaded file from step 2. Start the installation procedure.
Reboot without removing the USB stick. A minimal installation of Ubuntu 16.04 should now load. If not, check your BIOS settings whether booting from USB is configured.
Login with userid guru and password changeme.
Start “GParted” (icon on the desktop).
In the application (menu top right) choose to view your USB stick: in my case this was the drive /dev/sdb, but depending on how your Windows drives are configured, this might be a different number.
- Do not touch the “/dev/sdb1” partition (fat32, /boot/efi)!
- Remove the “/dev/sdb2” partition
- Remove the “linux-swap” partition, by first right-clicking it and choosing “swapoff” and repeating this and choose “Delete”.
- Right-click the /dev/sdb3 partition and choose re-size. Make it the maximum size of the stick (0 bytes after partition).
- Click “Apply all operations”.
Edit the /etc/fstab file.
Remove the line containing “swap”. Save the file (CTRL-W).
Reboot without removing the USB stick. Sign on again as guru. Configure networking (wired should work out of the box, wireless need set-up).
From the menu, choose a terminal, and execute the following commands, to install the full blown Ubuntu desktop.
sudo apt update
sudo apt upgrade
sudo apt install ubuntu-desktop
sudo apt autoremove
sudo dpkg-reconfigure resolvconf
Install the utilities to encrypt the home-directory.
sudo apt install ecryptfs-utils cryptsetup
Add your own user and give it “sudo” rights (here “igbuend”):
sudo adduser igbuend
sudo usermod -aG sudo igbuend
Encrypt the home folder of this newly create user:
sudo ecryptfs-migrate-home -u igbuend
Log-out and login again with user-id “igbuend” (or your choosen ID). Note: from the login screen choose the standard Ubuntu Desktop.
Remove the “guru” user.
sudo deluser --remove-home guru
Upgrade to version 17.04 (necessary for support of advanced Windows Surface features).
Update: latest version is now 18.04.
Open Software & Updates. Select the Updates tab. Locate the section titled ‘Notify me of a new Ubuntu version‘ and in the drop-down menu switch from ‘For long-term support versions’ to ‘For any new version’.
Enable “multi-verse”. Upgrade the distribution:
Reboot and sign on again.
Install some nice-to-have software:
sudo apt install ttf-mscorefonts-installer ubuntu-restricted-extras
Install some needed utilities:
sudo apt install wget curl gdebi htop tmux xtightvncviewer openvpn network-manager-openvpn
Install some nice applications:
sudo apt install gimp gimp-data gimp-plugin-registry gimp-data-extras vlc unity-tweak-tool
Many tools need additional software libraries to compile. Install a bunch of these with:
sudo apt install autoconf build-essential git-core libffi-dev libpcap-dev libreadline6-dev libsqlite3-dev libssl-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev python-dev python-setuptools python-pip python-software-properties sqlite3 subversion default-jre zlib1g-dev lua5.2 lua5.2-dev
That’s it! Now your Ubuntu system is ready and you can install other needed software.