7ae25a76f8421e68877a9904dd1e9f3c868100c9 — Tim Morgan 1 year, 7 months ago
Initial commit
5 files changed, 91 insertions(+), 0 deletions(-)

A .gitignore
A board.bin
A fix_wifi.sh
A hibernate_when_inactive.sh
A  => .gitignore +1 -0
@@ 1,1 @@

A  => README.md +69 -0
@@ 1,69 @@
# Ubuntu Linux on the Surface Go Tablet

These are just my notes and settings for getting everything running nice on the Surface Go tablet.

As of this writing, I was using Ubuntu 18.10.

## Installation

Generally, you need to:

1. Disable Secure Boot
1. Boot from USB live media
1. Choose to manually partition and create a swap partition at least the size of your ram. In my case, I made it 10 GiB because I have 8 GiB of ram. (I wasn't quite sure on the GiB/GB units, so I just rounded up to 10.)
1. Install Ubuntu as usual.


* Since I totally wiped Windows from the tablet, I didn't have to deal with dual booting issues.
* I chose not to enable LLVM, as it makes hibernation more difficult. The tablet needs hibernation for decent battery life when you throw it in your backpack.

## Display and Font Scaling

Once booted up for the first time, everything in the UI is huge and difficult to use. Open up the "Displays" config panel and change the scaling to 100%.

Once that is done, fonts are a bit hard to read. To increase font sizes, you can go to "Universal Access" and enable "Large Text."

Alternatively, you can run the following to set a specific font scaling factor:

gsettings set org.gnome.desktop.interface text-scaling-factor 1.4

## Fixing Wifi

This worked for me on the Surface Go 128gb and Ubuntu Linux 18.10. File paths will vary from version to version, so you may need to make some tweaks.

Run `fix_wifi.sh` and reboot.

If it doesn't work or you get errors running the script, open the `fix_wifi.sh` script and type the commands manually. Sometimes file paths change slightly and you can TAB your way through it.

After running updates on the system, the wifi firmware might get replaced, breaking your wifi. Just run the script again to fix it.

## Automatic Screen Brightness

I noticed that in certain light conditions, the display on my tablet would shift brightness lighter/darker and it was distracting. Disabling "Auto Brightness" in the "Power" config panel fixed this. I'll just control the brightness manually.

## Enable Hibernation

For the Surface tablet, Microsoft designed a special low power mode that is not compatible with standard "suspend" supported by Linux. As a result, when you close the tablet cover, the screen is disabled, but everything is still running. Batter life in this state is measured in hours -- not days.

As a workaround, you should enable hibernation and set the tablet to automatically hibernate after a reasonable period of inactivity.

1. Run `cat /etc/fstab` and note the UUID of your swap partition.
1. `sudo vim /etc/default/grub` and find the setting `GRUB_CMDLINE_LINUX_DEFAULT`.
1. Inside the quotes of this setting, after any existing settings, put a space, then `UUID=`, followed by the UUID of your swap partition.
1. Save the file and run `sudo update-grub`.

Test that hibernation works by running `sudo systemctl hibernate`. Wait a minute, then power on your tablet again and ensure that your previously open windows are restored.

## Automatically Hibernate When Idle

I couldn't find a setting to hibernate the tablet after a period of inactivity, even though I'm sure there is one somewhere. If you know where it is, please let me know!

What I did was write a script to do it and run it every 10 minutes with cron. The script is included in this repo, named `hibernate_when_inactive.sh`.

1. `sudo su`
1. `crontab -e`
1. Add the following at the bottom: `*/10 * * * * /root/hibernate_when_inactive.sh`

A  => board.bin +0 -0

A  => fix_wifi.sh +13 -0
@@ 1,13 @@

set -e

# first make a backup
if [[ ! -e old-wifi-firmware.zip ]]; then
  zip -r old-wifi-firmware.zip /lib/firmware/ath10k

rm -f /lib/firmware/ath10k/QCA6174/hw3.0/board-2.bin
cp board.bin /lib/firmware/ath10k/QCA6174/hw3.0
chmod +x board.bin /lib/firmware/ath10k/QCA6174/hw3.0/*
echo "options ath10k_core skip_otp=y" > /etc/modprobe.d/ath10k.conf

A  => hibernate_when_inactive.sh +8 -0
@@ 1,8 @@

timeout=$((10 * 60 ** 1000)) # 10 minutes

if (( $idle > $timeout )) && xset -q | grep "Monitor is Off"; then
  systemctl hibernate