As I started traveling a bit more recently, I went into search for a small laptop I can carry with me. As an alternative to my 17" work and 15" personal laptop, I wanted to go much smaller. Here comes Surface Go.
It’s not a powerful device by a long shot and any heavy load is out of question. That is doubly so for the one I selected - with 4 GB RAM and only a 64 GB disk. What worked in its favor was a really cheap price (Craigslist) and reasonably mainline components ensuring Linux compatibility. Yep, I wanted to use this as my portable Linux machine.
The first step was to create a bootable media. I personally use Rufus if doing it from Windows. For those doing it from Linux, there is an excellent page with other options available. What you want is MBR-based FAT32 format. If you use GPT, all you’ll get is GRUB command line.
The easiest way to install Ubuntu is if you start from Windows. Go to Recovery Options and select Restart now. From the boot menu then select Use a device and finally use Linpus lite. If Linpus lite doesn’t appear, select EFI USB device and repeat the process. For some reason Linpus option appears every second boot for me. If you are using Ubuntu, there is no need to disable secure boot or meddle with USB boot order as 19.10 fully supports secure boot (actually Microsoft signs their boot apps).
From there on, you can proceed with Ubuntu installation as you normally would do. For me that meant going with Minimal and no other changes. If you select third party drivers, you will have to setup UEFI password but I’ve found that Surface doesn’t need such special treatment.
PS: If you do want to mess with boot order, start with the Surface Go powered off. While holding Volume Up button, press Power button, and then release Volume Up. This will give you UEFI menu. There you can change boot order and/or disable Secure Boot. To reset BIOS settings to the default values, use F9 key.
PPS: Between the time I wrote this post and its publishing time, any further travel became unlikely due to COVID-19. There goes my reason for getting this laptop. :)
Booting from the USB is easy enough if you have Windows installed. Just go to Recovery Options and restart from there. But what if you installed Linux on your Surface Go an you want to get Windows back?
Yes, you can meddle with BIOS an change boot order there. But there is an easier way - just use GRUB.
To enter GRUB on Surface Go, just press Escape multiple times while booting. Once there, press c to enter command mode. All magic will happen here.
First “magic” part will be finding USB drive. For that just write ls and you will be presented with a list. Depending how you had your drive setup, you might be able to recognize it. If you used MBR it will be something like (hd0,msdos1) and if you used GPT it will be slightly different (hd0,gpt1). Frankly, that’s the probably single biggest reason I use MBR for my recovery drives - since all else uses GPT, it makes it painfully obvious which drive is correct one.
With drive selected, we just need to “chainload” it:
I find Surface Go quite nicely working with Ubuntu. If you are searching for a small capable Linux machine, it’s hard to beat it. However, one issue is really annoying. Its WiFi driver.
Fortunately, there is a nice guide on Reddit on how to fix this. Unfortunately, you will need to fix it again and again as system will overwrite your changes upon many (e.g. kernel) upgrades.
Well, not anymore. I created a package that automates this task. Each time WiFi driver gets its board.bin replaced, this package will change it back. One thing less to think about.
You can download package here or check build it yourself.
To install it, use the command line (GUI route doesn’t work without Internet access).
I am a big fan of ZFS and I have it installed on every Linux/Unix machine I own. Including the machine I use for playing with Docker containers. And it was that machine where I saw a bunch of ZFS snapshots with weird random hexadecimal names. And it wasn’t one snapshot, nor two - it was hundreds of them. So I deleted them.
Guess what, Docker build started complaining:
error creating zfs mount: mount system/root/a4f339f95f920b918bb23290a3e831dc22477bc76ef0d3496224fc424e65ec67:/var/lib/docker/zfs/graph/a4f339f95f920b918bb23290a3e831dc22477bc76ef0d3496224fc424e65ec67: no such file or directory
Well, I guess that sorted who was to blame for all those long snapshots. You see, Docker gets smart if it detect ZFS and does a lot of smart things. Unfortunately those smart things result in a lot of snapshots. And I don’t like people (or software) messing with my ZFS. And obviously Docker didn’t like me messing with it either. :)
Fortunately, the solution is easy enough. One should reconfigure Docker to use overlay2 storage driver instead of ZFS one and short daemon restart later one can continue playing with Docker without having to deal with ZFS snapshot hell.
Now only if I could remember this when I reinstall the OS…
MAC address should be unique for each network card - whether it’s wireless or wired. It’s this uniqueness why some networks will use it to distinguish an authorized user from the unauthorized one. If you ever had a time-limited access to the network, chances are that your MAC address was used to block you once time is up.
I will leave it up to you to think of scenarios but I find randomizing my MAC address a useful option in Linux. Therefore, I created a script to automatically generate a new one. This script will randomize the last three octets of the MAC address while leaving the first three octets as they originally were. In effect this makes your computer present itself to the network as the new adapter from the same manufacturer.
#!/bin/bashINTERFACE="^^eth0^^"CURRENT_MAC=`/usr/sbin/ifconfig $INTERFACE |grep ether |awk'{print $2}'`ORIGINAL_MAC=`/usr/sbin/ethtool -P $INTERFACE |rev|cut -d' '-f1|rev`ORIGINAL_MAC_PREFIX=`echo $ORIGINAL_MAC |cut -d: -f1-3`NEW_MAC="$ORIGINAL_MAC_PREFIX`/usr/bin/hexdump -n3 -e'3/1 ":%02x"' /dev/urandom`"echo"Current MAC : $CURRENT_MAC"echo"Original MAC: $ORIGINAL_MAC"echo"New MAC ....: $NEW_MAC"sudo /usr/sbin/ifconfig $INTERFACE down
sudo /usr/sbin/ifconfig $INTERFACE hw ether $NEW_MACsudo /usr/sbin/ifconfig $INTERFACE up