Linux configuration for laptop

After deciding to install Linux on my new laptop (Lenovo G50-70 i5)  I was surprised to find that the system was a lot more unstable than when running Windows 8.1. Unlike the desktop, the laptop install of Ubuntu had several problems.

1. First and worst of all, it froze after coming back from suspend (sleep) .

2. Battery was draining too fast.

3. No gestures such as two finger scrolling were available by default.

4. Screen backlight was always at maximum after boot

5. No image through HDMI but the wallpaper

Solutions

1. In order to get Ubuntu to work at all, during installation I had to go to a console environment and install a general AMD graphics package (fglrx). However, this turned out not to be the best driver choice for my laptop, these drivers were the cause of crushes. The solution was downloading a Catalyst Package from AMD website which in turn created four different driver packages based on my configuration. After installing these (there were four because drivers were split between core functionality drivers, basic drivers, graphic acceleration drivers and developer package) the system stopped freezing.

2 days later I found out that sometimes when waking up from suspended/sleep the system crushed and I had to do a cool reboot. The bug appears in several threads such as:

https://bugzilla.novell.com/show_bug.cgi?id=817552#c1

From the error message I get: “RADEON dpm resume failed” or similar, I figure it has something to do with the dynamic power management of the GPU. This wiki page explains what dpm is:

https://wiki.archlinux.org/index.php/ATI

2.

Update: The following steps are the cause of the nasty buggy behaviour mentioned above. The power optimiser called “tlp” when set to run on battery mode will make the laptop fail to wake from suspend  after a second suspend or to shut down after a suspend.

Battery drainage proved to be a lot simpler to solve than I thought it would be.

– install powertop utility to check for main power consumers and for tunables.


sudo apt-get install powertop

sudo powertop

– install tlp optimisation application, a very capable and smart program with plenty of functionality to be found online

sudo apt-get install tlp

run with sudo tlp start

or:

sudo add-apt-repository ppa:linrunner/tlpsudo 
apt-get update
sudo apt-get install tlp tlp-rdw smartmontools ethtool

tlp will check if the laptop runs only on battery and optimises the system accordingly. If the laptop is plugged then tlp runs in AC mode. I noticed the power optimisations are greatest when power comes from battery alone and tlp runs in “bat” mode (tlp bat).

After running tlp bat, powertop no longer displays unsolved tunables.

To start tlp at startup add tlp start or tlp bat or better /usr/sbin/tlp start ( or bat) in /etc/rc.local before the “exit 0” line.

3.

There seems to be a bug related to Lenovo trackpads that caused the issue but I am not sure.

I installed tpconfig and tried several solutions from the internet but I kept encountering the error :

Couldn’t find synaptics properties. No synaptics driver loaded?

So I actually have no synaptics drivers installed, only the generic evdev Linux drivers. What is worse is that synaptiks package was maintained only until version 13.10 (I am running 14.04) si it will not solve my problem.

Basically I have the exact same problem with the one described here: https://bbs.archlinux.org/viewtopic.php?id=176279 and at the current time the is no answer given.

I found a possible solution here:

http://askubuntu.com/questions/529974/elantech-touchpad-not-working-at-all/541966#541966

After upgrade to 3.18.1 kernel everything worked as expected, although for some reason the sensitivity of the trackpad was very very low.

This brought it to a normal state:

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Finger" 1 10 256

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Pressure Motion" 1 160

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Pressure Motion Factor" 0. 65 0.65

To upgrade the kernel:

Download the Linux kernel (3.18.*) from official website and Linux headers from here:

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-headers-3.18.1-031801-generic_3.18.1-031801.201412170637_amd64.deb

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-headers-3.18.1-031801-generic_3.18.1-031801.201412170637_all.deb

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-image-3.18.1-031801-generic_3.18.1-031801.201412170637_amd64.deb

And then install all packages:

sudo dpkg -i linux-headers-3.18.1-031801*.deb linux-image-3.18.1-031801-generic_3.18.1-031801.201412170637_*.deb

Another useful script for trackpad configuration:

#!/bin/bash

xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Pressure" 1

# Below width 1 finger touch, above width simulate 2 finger touch. - value=pad-pixels
xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Width" 10

# vertical scrolling, horizontal scrolling - values: 0=disable 1=enable
xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Scrolling" 1 1

# vertical, horizontal, corner - values: 0=disable  1=enable
xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Edge Scrolling" 0 0 0

# stabilize 2 finger actions - value=pad-pixels
xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Jumpy Cursor Threshold" 250

exit

I have also added the script to the startup list.

Good source for trackpad tweaking:

http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html

To simulate middle click with with two finger tap:

synclient "TapButton2"=2

source: http://askubuntu.com/questions/306412/how-can-i-setup-my-touchpad-multi-finger-tapping-functionality

Notice

Enabling the horizontal scroll my cause a buggy behaviour in Java based programs such as NetBeans. To disable horizontal scrolling change this line like this:

xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Scrolling    " 1 0

4. Added this command to rc.local

echo 200 > /sys/class/backlight/intel_backlight/brightness

Where 200 is how bright the screen should be.

5. Found the solution here:

http://superuser.com/questions/701716/disabling-laptop-monitor-when-external-hdmi-monitor-is-plugged-in

Check the available displays with

xrandr

xrandr --output eDP1 --off

Where eDP1 is my laptop’s display.