Ubuntu 18.04 on Thinkpad P51

2018/09/30

Tags: linux

Back to Linux after almost 3 year hiatus.

Switching back from MacBook to Thinkapad and Ubuntu as the main work machine.

My MBP 13'' aged quite nicely, but compiling large scala codebases and running VMs / containers became quite frustrating. I was eligible for a refresher at Elastic and I’ve decided to try Thinkpad P51 + Ubuntu. This is a 15'' beast with 64 GB of RAM. It is quite heavy, but working remotely I don’t need to carry it to the office every day, while still being able to travel if needed. I consider the trade off acceptable.

This post is a short note and what works and a note on setting it up if I need to do it again.

Out of the box experience #

The out of the box experience is surprisingly good. P51 is about 1 year old, so 18.04 kernel (4.15) contains everything it needs. Basically, after the installation I’ve needed only to install nvidia drivers and change display scaling (4k screen). Second display (also 4k) works, sleep works, etc.

What doesn’t work? #

Battery life #

I get around 3h of regular work (compilations & build, IDE, spotify, external display, mails, slack, I have it all). It is a far cry from MBP, but acceptable. I plan to experiment with TLP to see if I’ll get more out of it. Also, I’ve haven’t got a chance to test it without IDE + sbt combo; hope it’ll be a bit better in reading / surfing mode. I’m using the discrete nvidia card.

KDE vs Gnome #

I’ve played a bit with kubuntu and ubuntu live cds and decided to go with KDE. But after a few days I’ve installed ubuntu-desktop and stick with it. I like KDE more, but the number of configuration options and perceived stability made me switch to gnome for now.

Setup #

Windows #

Kubuntu Installation #

After installation #

Chrome #

$ sudo apt install chromium-browser

Nvidia #

$ ubuntu-drivers devices

## and if you agree with the recomendation
$ sudo ubuntu-drivers autoinstall

## reboot and then you can:
### check with card is in use
prime-select query

### select one of them
sudo prime-select intel
sudo prime-select nvidia

### and reboot
  1. glxgears on intel

    $ glxgears
    367 frames in 5.0 seconds = 73.211 FPS
    301 frames in 5.0 seconds = 60.027 FPS
    301 frames in 5.0 seconds = 60.023 FPS
    301 frames in 5.0 seconds = 60.023 FPS
    
  2. glxgears on nvidia

    $ glxgears
    Running synchronized to the vertical refresh.  The framerate should be
    approximately the same as the monitor refresh rate.
    71605 frames in 5.0 seconds = 14320.992 FPS
    72945 frames in 5.0 seconds = 14588.849 FPS
    73311 frames in 5.0 seconds = 14662.161 FPS
    C73643 frames in 5.0 seconds = 14728.479 FPS
    

Keybase #

https://keybase.io/docs/the_app/install_linux

cd ~/Downloads
sudo apt install curl

curl -O https://prerelease.keybase.io/keybase_amd64.deb
curl -O https://prerelease.keybase.io/keybase_amd64.deb.sig
curl -O https://keybase.io/docs/server_security/code_signing_key.asc
gpg --import code_signing_key.asc
gpg --verify keybase_amd64.deb.sig keybase_amd64.deb
sudo dpkg -i keybase_amd64.deb
sudo apt-get install -f
run_keybase

Restart was needed to fix a permission issue while cloning a git repo

Github ssh key #

Follow the steps from the website

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub

And add it to the account.

Spacemacs clones some of the packages from github, and the running my config will fail, unless this is step is done.

Emacs #

$ sudo add-apt-repository ppa:kelleyk/emacs
$ sudo apt-get update
$ sudo apt install emacs26
$ git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
$ cd ~/.emacs.d
$ git checkout develop

Dotfiles #

$ sudo apt install git
$ cd ~/code
$ git clone keybase://<my-dotfiles-repo>
$ cd dotfiles
$ make do-bootstrap
$ make force-install

Zoom #

https://kupczynski.info/2018/09/08/zoom-and-kubuntu.html

IntelliJ #

Install from the toolbox https://www.jetbrains.com/toolbox/app/

Spotify #

~As per the instructions in https://www.spotify.com/pl/download/linux/~

Spotify snap seems to work fine. It’s in my dotfiles setup now.

$ snap install spotify

## There was a problem with scaling, spotify don’t honor the gnome scaling factor

$ sudo emacs /usr/share/applications/spotify.desktop

## Exec=spotify --force-device-scale-factor=2.0 %U

Conclusion #

I’m really happy with the new machine, it can handle a lot of load and the setup was surprisingly easy. If they fix my airpods and improve the hidpi and external monitor support I think this will be the year of linux on the laptops.

>> Home