Lenovo T480 config on Ubuntu
About a month ago I finally bought a new laptop. My previous one (the Microsoft Surface Pro 3) is certainly a great device, it just comes with too many quirks when used with Linux on it. On top of that the wifi chip was broken, making it somewhat useless on the go.
After reading lots of comparisons I went for the Lenovo T480. The build quality is top notch and Ubuntu 18.04 runs out of the box with no further complications. Unfortunately the device is running rather hot, even when idle. The reasons for this are the dedicated Nvidia MX150 GPU as well as the high CPU usage caused by the BIOS’ Thunderbolt settings. I managed to decrease the CPU load and the high energy consumption by performing the settings listed below.
Disabling MX150 on the T480
Out of the box Ubuntu will install “nouveau” graphics drivers. The proprietary nvidia drivers can also be installed by starting “Software & Updates”. The Nvidia driver allows you to easily change the GPU in use, but it merely changing the selection there was not sufficient in my case.
After some reasearch, there seem to be following methods that will properly turn off the dedicated GPU:
Option 1) Proprietary Nvidia drivers and powertop –auto-tune
References:
https://www.reddit.com/r/thinkpad/comments/8a7qtl/returned_my_t480s_got_a_t480_first_impressions/
https://askubuntu.com/a/490401 (register powertop service)
https://askubuntu.com/a/1061055 (disable nvidia-fallback service)
- “Software & Updates” > Drivers > Switch to proprietary nvidia drivers
- Reboot (while enrolling Secure Boot key)
sudo prime-select intel
(or: “Nvidia X Server Settings” > “PRIME Profiles” > Select “Intel (Power Saving Mode)”)
If this already works, great! Powertop was still showing the MX150 to use power though, so following steps were necessary:
- Install powertop and disable nvidia-fallback service
sudo apt install powertop
sudo systemctl disable nvidia-fallback.service
- Create file
/etc/systemd/system/powertop.service
with following contents:
[Unit]
Description=PowerTOP auto tune
[Service]
Type=idle
Environment="TERM=dumb"
ExecStart=/usr/sbin/powertop --auto-tune
[Install]
WantedBy=multi-user.target
- Enable the service:
sudo systemctl daemon-reload
sudo systemctl enable powertop.service
This will register a new systemd service, automatically running powertop optimizations on startup.
Option 2) Change Display server and blacklist Nvidia drivers
Reference:
https://askubuntu.com/questions/1031511/cant-disable-nouveau-drivers-in-ubuntu-18-04
Another option that seems to work, is blacklisting the nvidia related kernel modules. This generally works by adding something to /etc/modproble.d/blacklist.conf
, but since Ubuntu (in my case) is running on Wayland, the display server must be switched back to X11 first.
You can figure out what display server your session is running on by doing the following:
loginctl
> SESSION UID USER SEAT TTY
> c1 120 gdm seat0 tty1
> 2 1000 luca seat0 tty2
loginctl show-session c1 -p Type
> Type=wayland
To actually switch back to X11, the following step seem to be simple enough (if you are using gnome)
- Uncomment
WaylandEnable=false
in/etc/gdm3/custom.conf
While this changes the display server, it does not change much about the gpu in use. To disable the MX150:
- Add the following lines to
/etc/modprobe.d/blacklist.conf
blacklist nouveau
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off
sudo update-initramfs -u
- restart
Option 3) Proprietary Nvidia drivers and turn off gpu with a service
(This way worked best for my setup)
References:
https://github.com/stockmind/dell-xps-9560-ubuntu-respin/issues/8#issuecomment-389292575/
https://askubuntu.com/a/1061055 (disable nvidia-fallback service)
(Steps 1 - 3 are the same as in Option 1)
- “Software & Updates” > Drivers > Switch to proprietary nvidia drivers
- Reboot (while enrolling Secure Boot key)
sudo prime-select intel
(or: “Nvidia X Server Settings” > “PRIME Profiles” > Select “Intel (Power Saving Mode)”)- Disable nvidia-fallback service
sudo systemctl disable nvidia-fallback.service
- Create file
/etc/systemd/system/gpuoff.service
with following contents:
[Unit]
Description=Power-off gpu
[Service]
Type=oneshot
ExecStart=/bin/bash -c "if [[ `prime-select query` == 'intel' ]]; then echo auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control; fi"
[Install]
WantedBy=default.target
- Enable the service:
sudo systemctl daemon-reload
sudo systemctl enable gpuoff.service
This will register a new systemd service and depending on whether or not prime-select query
return intel
turns off the nvidia gpu.
Thunderbolt BIOS Assist Mode (High CPU usage fix)
BIOS: Config > “Thunderbolt(TM) 3” >
- Thunderbolt BIOS Assist Mode [Enabled]
Other power-saving options and configs
I won’t go into too much detail here, but for my own reference, here are the other settings I’ve done.
sudo apt install tlp
BIOS:
Security > “I/O Port Access” >
- Bluetooth [Disabled]
- Integrated Camera [Disabled]
- Microphone [Disabled]
- Fingerprint Reader [Disabled]
Software
Editors
sudo apt install git vim
- atom (Download from web; snap package is not handling JP input)
- IntelliJ with Scala and Android Plugins (Download from web; snap not handling JP input)
Gnome configuration
- AlternateTab
sudo apt install chrome-gnome-shell
- Install from https://extensions.gnome.org/extension/15/alternatetab/
- (dconf change alt click behaviour) => only on old distros
- Invert touchpad scrolling direction
- Settings > Devices > “Mouse & Touchpad” > Disable “Natural” Scrolling
- Disable animations
sudo apt install gnome-tweak-tool
- “Gnome tweak tool” > Appearance > Animations
- Nautilus typeahead (https://www.omgubuntu.co.uk/2018/05/enable-nautilus-type-ahead-search-ubuntu)
sudo add-apt-repository ppa:lubomir-brindza/nautilus-typeahead
sudo apt dist-upgrade
- “Fix” Alt-Tab behaviour
- Settings > Devices > Keyboard: Assign
Alt-Tab
to “Switch Windows” (instead of “Switch Applications”)
- Settings > Devices > Keyboard: Assign
Misc
- VPN
apt install network-manager-openvpn-gnome
- copy and import configs
- Privacy settings
- Disable telemetry
sudo apt purge ubuntu-report popularity-contest apport whoopsie
https://askubuntu.com/questions/1031901/how-to-disable-telemetry-for-all-users
- “Software Center” > Search “ubuntu-amazon-default” > Remove
- Disable telemetry
- Setup editor configs
git
- generate and add ssh keys
ssh-keygen -t rsa -b 4096 -C "<email>"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- config
git config --global user.name "<user>"
git config --global user.email "<email>"
git config --global core.editor "vim"
Input methods
sudo apt-get install ibus-anthy
OR
-
sudo apt install ibus-mozc
(<- this is from google) -
“System settings” > “Region & language” > Add “Japanese (anthy mozc)”