Linux on the Surface Pro 3

I am running Ubuntu 18.04 on my Microsoft Surface Pro 3, and in general it works really well.

WIFI

I have had problems with the wifi going down, which seems to be related to power changes. Following the instructions given in this Reddit thread I edited the file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf and set the value wifi.powersave = 2.

There is some useful information for setting up Linux on the Surface Go here.

Power Saving

To get the best out of the battery, I recommend building and running powertop. Boot up your surface, so all the kernel settings are set to their defaults, and then run 'sudo powertop --html'. This will create an HTML file in the current directory named "powertop.html". Open it with an editor and do a search for all the 'echo' command line statements. These are the proc settings to optimise your power. You can copy these commands to a shell script that can either be run manually or on boot.

This is what is in my shell script:

echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'
echo '0' > '/proc/sys/kernel/nmi_watchdog'
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy'
echo 'auto' > '/sys/bus/i2c/devices/i2c-5/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-7/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-2/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-3/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-4/device/power/control'
#echo 'auto' > '/sys/bus/usb/devices/1-6/power/control'
#echo 'auto' > '/sys/bus/usb/devices/1-1.4/power/control'
#echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-6/device/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:03.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control'

(Note that I have commented out a couple of lines that change the power settings on some USB controllers. I found that they caused problems with my external keyboard and mouse)