Running with Ruby

Tag: ubuntu (page 1 of 13)

Lenovo ThinkPad X1 Carbon (6th Gen / 2018) Ubuntu 18.04 Tweaks

Warning: I’m not responsible for any damages or injury, including but not limited to special or consequential damages, that result from your use of this instructions.

Yesterday I’ve finally received my new Lenovo ThinkPad X1 Carbon 6 gen laptop. I cannot say anything bad about the hardware. It fits exactly into my needs and requirements. Unfortunately, there are some flaws when used with Linux (Ubuntu in my case). Here are some hints on how to make things better.

Touchpad and Trackpoint under Linux

This is the most irritating issue that you will encounter.

Note: There are few of ways to solve this problem. None of them worked for me apart from this one.

If you have a touchpad with NFC you may observe following behaviors:

  • it may not detect movements,
  • won’t work with tap-to-click,
  • will occasionally wake up for a couple of seconds and will stop working again.

Unfortunately for this moment, you will have to disable trackpoint to make it work.

Here are the steps you need to follow.

Note: I’m mentioning also things you should not do just in case you’ve followed other instructions that didn’t work.

  1. Disable trackpoint in the BIOS settings.
  2. Disable NFC in the BIOS settings.
  3. Don’t disable trackpad in the BIOS settings (or enable it if you did) – this will make your touchpad embedded buttons work.
  4. You don’t have to use psmouse.synaptics_intertouch=1 at all for GRUB (no GRUB changes) and if you’ve applied this change, please revert it as followed:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    
  5. Don’t remove i2c_i801 from /etc/modprobe.d/blacklist.conf (it needs to be present and uncommented).
  6. Install the 4.17.0-41770rc5-generic (or newer) Linux kernel from the mainline based on the instructions presented below.
  7. Reboot your system with the new Kernel.
  8. Be happy with your working touchpad with the bottom physical buttons.

Installing the mainline kernel

  1. Go here: http://kernel.ubuntu.com/~kernel-ppa/mainline/
  2. Download all the files for a selected kernel version from the Build for amd64 group except those with the lowlatency in their name. For me that was 4 files overall.
  3. Open a terminal and go to the location where you’ve downloaded the files.
  4. Run following command:
    sudo dpkg -i *.deb
    
  5. Reboot.

low cTDP and trip temperature in Linux

This problem is related to thermal throttling on Linux, that is set much below the Windows values. This will cause your laptop to run much slower than it could under heavy stress.

Before you attempt to apply this solution, please make sure that the problem still exists when you read it. To do so, open a Linux terminal and run following commands:

sudo apt-get install msr-tools
sudo rdmsr -f 29:24 -d 0x1a2

If you see 3 as a result value (or 15 when running on battery), you don’t have to do anything. Otherwise:

  1. Disable Secure Boot in the BIOS (won’t work otherwise)
  2. Run this command:
    sudo apt install git virtualenv build-essential python3-dev \
      libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev
    
  3. Clone this git repository and enter it:
    git clone https://github.com/erpalma/lenovo-throttling-fix.git
    cd lenovo-throttling-fix/
    
  4. Install the patches:
    sudo ./install.sh
    
  5. Check again, that the result from running the rdmsr command is 3

Too small (or too big) letters for WQHD resolution

If you’ve got yourself Carbon version with the WQHD screen, you may notice that everything is extremely big (or super small). That’s because of the scaling factor. Unfortunately, you cannot use fractional scaling (more details here), which means that you’ll end up either with everything being super small (100%) or super large (200%).

Luckily for you, there’s an easy way out. Install Gnome-Tweak-Tools as followed:

sudo apt-get install gnome-tweak-tool

run it and set the Font Scaling Factor to 1,50.

Summary

I was kinda surprised with the amount of tuning required to make this laptop work with Ubuntu. I always considered Lenovo to be Linux friendly, especially that it is a brand loved by many programmers. On the other hand, maybe that’s exactly the reason why they didn’t put too much effort into making sure everything works out of the box. We’re programmers – we can fix that stuff on our own ;)

Anyhow, enjoy your X1 Carbon as much as I do!

Picture taken from the Lenovo website

Ruby – Installation and compilation from sources on Debian

If you don’t want to use Ruby from your repositories and you don’t want (or can’t because of some reason) to use RVM, here’s a quick howto download and compile Ruby from sources (all the commands should be executed with sudo or as a super user):

First a small update and some neccessery libs:

sudo su
apt-get update

# Not sure if all of them are required but nothing bad will happen if you just install them

apt-get install build-essential bison openssl libreadline6 libreadline6-dev \
libyaml-dev libxml2-dev libxslt-dev zlib1g zlib1g-dev libssl-dev autoconf \
libc6-dev ncurses-dev libaprutil1-dev libffi-dev libcurl4-openssl-dev libapr1-dev

Then we should go here and download the most recent stable version:

# Still as root
cd ~
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz

Of course we need to unpack it:

tar -xvf ruby-2.1.2.tar.gz
# go to where it was unpacked
cd ruby-2.1.2/

and now the whole installation process:

./configure  
make  
make test  
make install 

and a small cleanup:

cd ~
rm -rf ruby-2.1.2*

To test it, just:

ruby -v
# output: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Olderposts

Copyright © 2018 Running with Ruby

Theme by Anders NorenUp ↑