Intalling Linux on an Lenovo Thinkpad X301



Jump within this page:
- Back to my homepage

Lenovo Thinkpad X301, model: 2777-CTO, serial: L3AAV0H
Weight: 1.525kg (3.3 lbs)
2GB RAM, 128GB SSD disk
13.3" WXGA+ (1440x900) TFT display wit LED backlight
Size: 23cm x 31.5cm x 2.5cm
Size in inch: 9 x 12.5 x 1
The hight includes the feet, otherwise it would be only 2cm [0.8"] high.
Date of purchase: June 2009

Function key to enter Bios: F1
Function key to select boot device: F12


I use my laptops a lot. Hardware quality is therefore a very important to me. I have been looking at both Apple macbooks and Thinkpads. Apple is probably at the moment the one company with the most innovations in the IT sector. Apple has notebooks which are very similar to the X301. The reason that I still decided to go for the X301 is that it seemed better suited for running linux. I also like the fact that it has 3 mouse buttons and a keyboard light (called Thinklight). I used Thinkpads for many years. My IBM Thinkpad 600e is now 11 years old and I still use it. It is impressive from a product quality point of view. Let's hope that Lenvo can deliver the same quality.  

The X301 hardware in general

This notebook is very light and thin yet it feels solid (the case is made from carbon-fiber and glass-fiber). I really like the design. A problem that plagued previous Thinkpads was fan noise. This problem seems fixed. The fan makes almost no noise at all although it is on all the time. The power consumption and battery life is very good. Lenovo talks about a whole working day on battery on their marketing pages. I don't know how they came up with that but I get about 3 hours of normal use. It is sufficient for me.

With the low power consumption comes also low heat. My T43 would get at times very hot especially below the palm rest. The X301 is warm but you don't get the feeling it is overheating.

Before buying I have read a few reviews and one of the comments was always that the display hinges are now plastic. That is not true. The hinges of the x301 are also metal hinges. They are just painted black.

On the T43 I needed every two years a new keyboard because the keys would get shiny and slippery or they would stop working. I have the impression that the X301 has an extra coating on the keys. The plastic seems somehow harder. It seems similar to the Thinkpad 600e keyboards. I am still using the first original keyboard on my 600e. Let's see what the X301 will look like in 2 years but my first impression is good.

The solid state drive on this laptop is great. For me it was the first time I had used a solid state drive and I am impressed. It is incredibly fast. What seems to make a huge difference is the random access performance. Traditionally harddrive manufactures have measured the speed of their drives by reading data sequentially. In practice this never happens. When you boot or start an application the files are read from all over the drive. This is what an SSD is really good at. Linux boots in 10-15 sec to the console login prompt. Firefox is on the screen almost the same moment you started it.

The display is very good and bright indoors. I have the feeling that the colors are much better because of the LED backlight. Outdoors you can notice that the anti-reflection coating that Lenovo uses is not as good as the one that IBM used to put on the screens when thinkpads were still made by IBM.

2017: The Thinkpad x301 after 8 years of continuous use

Most of my previous laptops needed after a couple of years of typing a new keyboard. My T43p required e.g about every 2-3 years a new keyboard. Typically the space-bar, the enter key or the shift key would start to be come unresponsive. Thinking that this might be normal I bought this laptop with a spare keyboard. I did not need it. The laptop is still running with its original keyboard. Some keys are looking a bit shiny and used but the response and feel of the keyboard is still perfect. The only thing that broke is the cover of the left speaker. My palm rests on it while typing and it caused the plastic mesh to break after about 4 years. I replaced it with a piece of stainless steel speaker cover. Rock solid, it will never bend or break.

[thinkpad X301 after 8years of use]
My thinkpad X301 after 8 years

July 2017, re-install with xubuntu 16.04.2 LTS

Gentoo served me well for the last 8 years but it's difficult to install a new web browser on such an old Linux distribution. I decided therefore that I finally needed to install a new OS. I upgraded the memory of the machine to a total of 6GB to be able to run 64bit Linux, amd64 (the old gentoo installation one was i386). I used the 16.04.2 LTS iso from https://xubuntu.org/and everything was working without any tuning. The only exception was the LCD backlight.

After resume from suspend triggered by a lid close the LCD backlight was set to brightness 0. One had to manually adjust it again. I searched for xfce4-power-manager and backlight off after resume from suspend and many people seem to have this problem.

The cause is however not the power manager (xfce4-power-manager) but the way the lid on this Thinkpad works. One can read the current brightness value of be backlight as a number between 0 and 15 from /sys/class/backlight/acpi_video0/brightness. I like to keep it at 14. First I thought that the xfce4-power-manager does not save the old backlight setting at suspend and therefore I wrote a /lib/systemd/system-sleep/lcd-backlight script. In ubuntu 16.04 everything is in the hands of systemd. Systemd notifies all programs about suspend and resume. If you put a script in /lib/systemd/system-sleep/ then systemd calls it with "pre suspend" before the system is going to suspend (the lid is already long closed if you trigger the suspend by closing the lid). systemd is slow. It can take several seconds between the hardware trigger and systemd taking action. At resume (lid open) systemd calls "/lib/systemd/system-sleep/lcd-backlight post suspend" What I discovered is this: Just closing the lid causes the hardware to dim down the backlight. Thus by the time systemd calls everybody to let them know that we will suspend the value of /sys/class/backlight/acpi_video0/brightness is already 0. So everybody saves "0" as old brightness value. At resume the old brightness values (stored as 0) is restored. The LCD remains dimmed down. The solution is to restore a reasonable value if /lib/systemd/system-sleep/lcd-backlight discovers that "0" is the brightness at resume. Here is the script (you can simplify it a bit and just implement a check at resume to see if brightness is zero. If so write 14. I needed the bigger script and the pre-suspend code to figure out what was going on):
#!/bin/sh

#echo "/lib/systemd/system-sleep/lcd-backlight $*" >> /tmp/lcd-backlight.log
#date >> /tmp/lcd-backlight.log

# the script gets called by systemd like this:
# /lib/systemd/system-sleep/lcd-backlight pre suspend
# /lib/systemd/system-sleep/lcd-backlight post suspend

# we save data to:
# /var/run/lcd-backlight/brightness.state
statedir=/var/run/lcd-backlight
statefile=brightness.state

if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ]; then
	if [ ! -d $statedir ]; then
		mkdir $statedir
	fi
	if [ "$1" = "pre" ]; then
		# going to sleep
		#
		# default value to prevent script errors, we will never use it
		b=0
		echo "# /lib/systemd/system-sleep/lcd-backlight saving /sys/class/backlight/acpi_video0/brightness" > $statedir/$statefile
		echo -n "# " >> $statedir/$statefile
		date >> $statedir/$statefile
		[ -r /sys/class/backlight/acpi_video0/brightness ] && b=`egrep "^[0-9]" /sys/class/backlight/acpi_video0/brightness`
		
		# there is as well /sys/class/backlight/intel_backlight/actual_brightness 
                # and /sys/class/backlight/intel_backlight/brightness but it behaves the 
                # same way, just different numbers.
		#
		# There is a bug that brightness can be already 0 when you close the 
		# lid because the lid turns the light off first. In that case we set it to 14
		echo "# brightness=$b " >> $statedir/$statefile
		if [ "$b" -lt 4 ]; then
			echo "# we use 14 if brightness=0 " >> $statedir/$statefile
			b=14
		fi
		logger "/lib/systemd/system-sleep/lcd-backlight pre $2, saving $b"
		echo "$b" >> $statedir/$statefile
	fi
	if [ "$1" = "post" ]; then
		# waking up
		if [ -r $statedir/$statefile ]; then
			r=`egrep "^[0-9]" $statedir/$statefile` 
			if [ -w /sys/class/backlight/acpi_video0/brightness ]; then
				echo -n "# restore to $r in + 1 sec " >> $statedir/$statefile
				date >> $statedir/$statefile
				# we have to delay because other services like power 
                                # manager applications might fiddle around with the  
                                # brightness after suspend. We want to write last.
				sleep 1
                                echo "$r" > /sys/class/backlight/acpi_video0/brightness
                                echo -n "# restore done ">>$statedir/$statefile
                                date >> $statedir/$statefile 
			else
				echo -n "# error no writable /sys/class/backlight/acpi_video0/brightness file " >> $statedir/$statefile
				date >> $statedir/$statefile
			fi
		fi
	fi
fi
This was the only problem. Xubuntu works well but it's expected that an older laptop runs problem free on a new linux distribution.

I like to use a tmpfs (RAM only filesystem) for /tmp or /var/tmp. It's fast, convenient and wipes itself clean at every shutdown. It reduces as well the wear on the SSD drive. I do all kinds of work in /tmp, reviewing documents, writing code, editing photos... everything. Add this to /etc/fstab and you have one:
# manual: mount -t tmpfs -o size=400m,mode=1777 tmpfs /var/tmp
# automatically create /tmp as tmpfs on startup:
tmpfs      /tmp           tmpfs  size=750M,mode=1777      0 0
# no tmpfs for /var/tmp/, we leave that on the normal disk


As for the performance: Yes, you can notice that this is not a new laptop but 6G of RAM and a SSD go a long way in making it responsive and snappy. I was first using firefox 52 ESR as my main browser but it is too sluggish and slow at times. I switched to google-chrome and then to firefox quantum beta (firefox 57). Frefox quantum made a big difference. No more delays while scrolling down a page that is just loading. I found as well that setting layers.omtp.enabled to true under about:config makes a big difference for an older laptop. The most annoying thing was a that firefox would freeze on some pages until the page was mostly complete. Even if you were not even interested in the top of the page you had to wait until it was possible to scroll down. Now everything is smooth. I don't need a new laptop. This is great. This is better than new, I love this machine I love every minute I type on the keyboard.
 

The original Gentoo install article from 2009

I like gentoo because it can stay on the computer and you can still add things later. With most distributions you have to scrap the installation after a few years. In Gentoo you can most of the time add newer packages even a few years later. The downside is a very long installation process. Plan for 2 weeks. If there are issues with faulty drivers (as in my case) then it can take even longer. You learn a lot along the way but you have to keep your motivation up.

This is a new laptop and requires very recent drivers. One would expect some problems until the hardware is more widely used and the faults are fixed. I had only a few problems with the graphics driver and the wifi driver. Everything else is problem free. I explain the problems and the solutions below.

The X301 cames supposedly with Windows Vista installed but I never booted it. I inserted a Linux boot disk and deleted all partitions at the first power on. There is no special or hidden partition (the T43 had this). You can just scrap all and use the whole disk.

The installation process of gentoo is very well explained at gentoo.org What seems missing is a cheat-sheet with the most important package management commands:
Search for a package
emerge --search substring_of_packagename

Check what would be installed:
emerge -k -p packagename

Check which USE flags are important for this package:
emerge -pv packagename

Install the package:
emerge package_name
Install a certain version:
ACCEPT_KEYWORDS=~x86 emerge  =category/packagename-version

List all files belonging to an already installed package:
equery f category/packagename

Check to which package a given file belongs:
equery b /the/file

List installed packages:
equery l
or
equery --nocolor list -i

List USE-flags:
equery uses packagename
My installation is based on gentoo-install-x86-minimal-20090623.iso and gentoo-stage3-i686-20090623.tar.bz2

On the desktop I use xfce4. My favorite terminal is x11-terms/terminal  

Hardware compatibility table

Device Status Notes
Processor: Intel Core 2, U9400 @ 1.40GHz Working CFLAGS="-O2 -pipe -march=core2 -msse4.1"
Disk: SSD, SAMSUNG MMCQE28G8MUP-0VA Working serial ata driver, AHCI, shows up as /dev/sda
3 USB sockets, Intel Corporation 82801I (ICH9 Family chipset) Working uhci, ehci
Graphics, Intel GMA X4500 Working i915, intel, you need a framebuffer console as well as specific versions of x11-base/xorg-server and x11-drivers/xf86-video-intel. Otherwise it is working very well.
Suspend to RAM Working
echo mem > /sys/power/state
works very well, comes back everytime.
Open the lid or press Fn to wake it up.
Power management, access to special IBM features, ACPI Working thinkpad_acpi, CONFIG_THINKPAD_ACPI
Network eth0 OK, wlan:
5300AGN suspend problems,
5100AGN working.
Wire: Intel Corporation 82567LM Gigabit Network, driver: e1000e

Wlan: Intel Wireless WiFi Link 5300AGN (Intel WiFi Link 5300), driver: iwlagn, problems see notes below

Wlan: Intel Wireless WiFi Link 5100AGN (Intel WiFi Link 5100), driver: iwlagn, works without problems
Suspend to disk I don't use it -
Bluetooth I don't use it -
Accelleration sensor Not yet tested Normally thinkpads have this. I am not sure about the x301. The hdaps driver would be needed but it does not find a hdaps device. Maybe the x301 does not have this sensor.
Finger print reader I don't use it Other pages say there is no driver
Mouse Working I use /dev/input/mice, touchpad is from synaptics (shows as AlpsPS/2)
Camera Working usb uvcvideo, v4l USB driver
CD/DVD reader and burner Working CD-ROM MATSHITA DVD-RAM UJ-844 RC02PQ, shows up as /dev/sr0
 

Partitioning

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc8cec26b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          31      248976   83  Linux
/dev/sda2              32         275     1959930   82  Linux swap / Solaris
/dev/sda3             276       15566   122824957+  83  Linux
The first partition is the boot partition. Everything else is in sda3. I use ext3 as filesystem.  

/boot/grub/grub.conf

# This is grub.conf
# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
# How many seconds to wait before the default listing is booted.
timeout 10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Linux-2.6.31-rc3-2
# Partition where the kernel is located
# hd0,0=sda1=/boot
root (hd0,0)
kernel /kernel-2.6.31-rc3-2 root=/dev/sda3

title Linux-2.6.30.1-3
# Partition where the kernel is located
# hd0,0=sda1=/boot
root (hd0,0)
kernel /kernel-2.6.30.1-3 root=/dev/sda3

Wlan, wifi, iwlagn

I used the iwlwifi-5000-ucode-8.24.2.12.tgz firmware from http://www.intellinuxwireless.org/?n=downloads. After downloading it you need to copy it to /lib/firmware/iwlwifi-5000-2.ucode for udev to load it.

The important parts of the kernel configuration are:
CONFIG_WLAN_80211=y
CONFIG_IWLWIFI=m
CONFIG_IWLWIFI_LEDS=y
CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
CONFIG_IWLAGN=m
CONFIG_IWL5000=y


Not possible to use any card other than wifi link 5100 or 5300
One thing that I have never understood about Ibm/Lenovo is their bios enforced customer hardware lock-in. On my T43 it is not possible to change the harddisk. If it brakes on day then I have to get an original thinkpad IDE harddisk otherwise the PC will not boot.

The x301 has a similar customer unfriendly feature: You can only use intel wifi link 5100 or 5300. You can plug in an atheros mini pci express card but then the PC will not boot. I have tried it.

If you boot with a wifi card other than the two supported models the you get this error:
1802: Unauthorized network card. Power off and remove the miniPCI network card.
One has to live with the intel card no matter how many problems it has ... this really sucks.

Almost all brand name laptops have unfortunately such a whitelist of permitted cards. Lenovo is not exceptionally restrictive in this respect. It might just be less known because not many laptops get documented in as much detail as the thinkpads.

Loading the driver and RFKILL
1) You must not use the kernel configuration option CONFIG_IWLWIFI_RFKILL on a 2.6.30.1 kernel otherwise Wifi will not work. On later kernels you can use CONFIG_IWLWIFI_RFKILL.
2) When you run "iwlist scan wlan0" to seatch for wlans then it will not work. The radio seems down. You will also see that the driver has not yet loaded the firmware (dmesg | grep iwl):
iwlist wlan0 scan

wlan0     Interface doesn't support scanning : Network is down
You must first run "ifconfig wlan0 up". This will bring up the radio. It will load the firmware via udev and the LED for wlan will go on.

I think that this is not a fault but rather implemented like this by intension.

Annoying wifi LED
The wifi led is right under the display and by default it will blink with a very annoying frequency. Fortunately one can change this with a module parameter:
/sbin/modinfo iwlcore
filename:       /lib/modules/2.6.31.4-1/updates/drivers/net/wireless/iwlwifi/iwlcore.ko
license:        GPL
author:         Copyright(c) 2003-2009 Intel Corporation 
version:        2.6.31.4-1-k
description:    iwl core
srcversion:     4BBF9CB751CE89E997C5C4B
depends:        mac80211,cfg80211
vermagic:       2.6.31.4-1 SMP preempt mod_unload modversions CORE2
parm:           led_mode:led mode: 0=blinking, 1=On(RF On)/Off(RF Off), (default 0)
 (int)
 parm:           no_sleep_autoadjust:don't automatically adjust sleep level according to maximum network latency (bool)
Create a file called /etc/modprobe.d/wlan.conf and add in there:
# 1 means do not blink:
options iwlcore led_mode=1
After that run update-modules to propagate the settings to /etc/modprobe.conf

DHCP problem:
You can not use this wifi driver in combination with the "pump" dhcp client. If I use pump then the interface is down after the IP address is configured. dhcpcd or udhcpc works. iwconfig shows that there is no association to the access point:
iwconfig wlan0 
wlan0     IEEE 802.11abgn  ESSID:"sansfil"
          Mode:Managed  Frequency:2.442 GHz  Access Point: Not-Associated
          Tx-Power=15 dBm
...

dmesg shows this:
[ 1623.467113] wlan0: deauthenticating by local choice (reason=3)
It seems like a driver bug to me but for the moment it is ok because I can work around it by using dhcpcd or udhcpc.

New break through/update:
With compat-wireless-2009-12-07 from http://wireless.kernel.org/download/compat-wireless-2.6/ this "pump dhcp" problem has disappeared. At a later point in time this will then also go into the main line kernel.

Wake-up from suspend to ram problem:
I had a strange problem is the resume of wlan after suspend. It seems to work partially. rsh, ssh and telnet connections stay but Firefox has problems. I can see requests going out when looking at the interface with wireshark but no data comes back. I can see syn, syn ack, ack, http get, http get, .... There is never any reply to the http get. When I capture on the web server side I can see that the "http get" did never arrive. The problem seems to be related to big packets. It is not a general networking problem because eth0 (wire) does not have that problem.

In wirehark the problem looks like this. You can see the syn/syn ack but the http get is never answered:
intel wifi problem

I have opened a bug report on this:
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=2054

My work around for this problem was to run a perl suid script (must enable perlsuid in /etc/make.conf) and execute in there the following commands.
 /sbin/iwconfig wlan0 essid "YourCurrentESSID"
 /sbin/ifconfig wlan0 up

To work around this I am now using two scripts which are called from /etc/acpi/default.sh after wake-up from suspend to ram. The /etc/acpi/default.sh calls laptop_wlan_reassoc_acpi & with the "&" to send it into the background. laptop_wlan_reassoc_acpi will then call after 2 sec laptop_wlan_reassoc which takes down the interface and brings it up again. It does as well re-associate using iwconfig. This initializes the wifi driver completely and cures the problem.

New break through/update:
After several weeks of no progress I found out that some of the developers at Intel don't have access to Intel's high-end hardware.

It turns out that their laptops have only a WiFi Link 5100AGN card.

I decided therefore that this problem is severe enough and I invested 100$ in a 5100AGN card. I took the 5300AGN out and put the 5100AGN in. It was worth the investment. The 5100AGN is much better. It is more stable in general. The 5300AGN would sometimes (once or twice a week) loose its assocication to the access point. The 5100AGN does also not exhibit this strange packet loss problem.

A after 6 month and changing the kernel a couple of times to the latest version I put back the 5300AGN. I did also disable 802.11n support. The 5300AGN card seems now as good as the 5100AGN. It does no longer show this strange packet loss problem.
#add to /etc/modprobe.d/wlan.conf
options iwlcore led_mode=1
options iwlagn 11n_disable50=1
Channel settings for Europe
If you want to use the Laptop on Europe and have access to channels 12 and 13 then you can create the file /etc/modprobe.d/wlan.conf add in there the line
options cfg80211 ieee80211_regdom=EU
and after that run update-modules to add it into /etc/modprobe.conf.

Changed behaviour of the battery status LED

The LEDs of a thinkpad can be controlled via
/sys/devices/platform/thinkpad_acpi/leds*
or
/proc/acpi/ibm/led

In /proc/acpi/ibm/led the LED 0 is the power connector LED, LED 1 is battery yellow, LED 2 is battery green.

Those sys/proc files can be written to but normally you want the BIOS the take care of that. It makes sense to have it BIOS controlled because it should work even if the OS on the computer is sleeping or not booted.

The X301 has a new behaviour when it comes to the battery LED. The battery LED is a dual color LED (green and yellow). All my previous Thinkpads where showing a yellow LED when the battery is beeing charged. The X301 is behaving differenly. It shows a yellow LED when the battery is almost empty otherwise it is green.
  • Green: The battery is charged between 80% to 100% of the capacity, and being discharged between 0% to 80% of the capacity.

  • Blinking green: The battery is charged between 20% to 80% of the capacity, and being charged.

  • Orange: The battery is charged between 5% and 20% of the capacity, and being discharged.

  • Blinking orange (slow): The battery is charged between 5% to 20% of the capacity, and being charged.

  • Blinking orange (rapid): The battery is charged between 0% to 5% of the capacity.

    This is documented in the hardware maintenance manual. The blinking is unfortunately not very visible. It is not real blinking. It is more like all the time on and then once in a while off for a very short moment.

Miscellenious

acpid and buttons for suspend to ram

Here is my /etc/acpi/default.sh script Fn-F4 and lid open/close are used for suspend to ram. A strange fault of the BIOS of my X301 is a missing beep on the frist going to sleep on that day. On any consecutive wake-up and sleep it emits a beep to confirm the action. Just the first time you send it to sleep it will not beep at wake-up.

Update July 2010: I used to have the following bios:
BIOS  (BIOS ID)   ECP   (ECP ID)
3.01  (6EET41WW)  1.04  (6EHT10WW)
I updated in July 2010 to the following bios using the bootable CD from Lenovo (6euj38uc.iso):
BIOS  (BIOS ID)   ECP   (ECP ID)
3.11  (6EET51WW)  1.05  (6EHT11WW)
After that the problem with the missing beep on the first wakeup from suspend to ram has disappeared.

You can check the bios version with the command:
# dmidecode -s bios-version
and the ECP (IBM ThinkPad Embedded Controller Program) version with the command:
# dmidecode -t 11

My make.conf file

My kernel .config and lsusb/lspci/lshw

Surprises: intel i915 graphics

Problem + solution:
X fails to restore the console on exit. Xorg would start and work properly but I would get all the time a black screen on exit. The solution is to not use a VGA console. You must configure the Kernel with a frame buffer console. (CONFIG_FRAMEBUFFER_CONSOLE=y, CONFIG_FB_VESA=y, CONFIG_FB_INTEL=y)
It took me a long time to figure that out.

For the X11/Xorg to work with the intel driver you need to merge the following versions. Those are higher versions than the currently stable version. Lower versions will not work. Note also the installation order:
ACCEPT_KEYWORDS=~x86 emerge =x11-base/xorg-server-1.6.2-r1 
ACCEPT_KEYWORDS=~x86 emerge =xf86-video-intel-2.7.99.902 
ACCEPT_KEYWORDS=~x86 emerge =x11-drivers/xf86-input-keyboard-1.3.2 
ACCEPT_KEYWORDS=~x86 emerge =x11-drivers/xf86-input-mouse-1.4.0

ACCEPT_KEYWORDS=~x86 emerge -pv =media-libs/mesa-7.4.4 =mesa-progs-7.4.1

An xorg.conf can be downloaded below (copy to /etc/X11/xorg.conf)

My xorg.conf file


DPMS -- monitor power control (DPMS=Display Power Management Signaling)

The above xorg.conf files enables DPMS:
grep DPMS /var/log/Xorg.0.log
(II) Loading extension DPMS
(**) intel(0): DPMS enabled
You should however know that those settings can easily be changed at run time with xset command:
xset dpms 300 300 360
The first parameter is the standby time in seconds the second parameter
the suspend time and the last the monitor off time.

print current settings:
xset q
Various screen saver applications do change those settings. If you enable a screen saver then you should check there for the desired time intervals and not on the xorg.conf file.

To test that your monitor and back-light goes off you can use those commands:

sleep 1;xset dpms force standby
sleep 1;xset dpms force off



Why is DPMS important for a LCD monitor with LED backlight?
The lifetime of LEDs is in contrast to common believe not infinite. White power LEDs age particularly fast because the become usually hot. LEDs don't stop working like light bulbs but the all degrade over time. That is: they are less bright when they are older. This aging process is temperature dependent. Therefore switch off the backlight when you do not need the screen.

EmulateWheel

The xorg.conf file uses the EmulateWheel feature. I like it very much.

You can use the red trackpoint mouse button to scroll. Just press and hold the middle mouse button and then move the red trackpoint pin up or down. This will cause the mouse to emulate a mouse wheel and scroll in the application windows.

A lean network init.d script

Gentoo used to be a very fast and light weight distribution. Instead of having everything standard, fat and generic it used to be specific, fast and lean. Unfortunately it is no longer the case for the /etc/init.d/net.* scripts. It is a shell script of 1136 lines. Incredible if you consider that you can configure a network interface with just 2 commands.

To save on startup time I have deleted those scripts and written my own: They are now specific. If you want to adapt them to your network then you just edit them. Usually you would just change a few lines. Those scripts do not read /etc/conf.d

USB camera

You need to enable the following (under multimedia support in the kernel config):
CONFIG_VIDEO_V4L2=y
CONFIG_VIDEO_CAPTURE_DRIVERS=y
CONFIG_VIDEO_HELPER_CHIPS_AUTO=y

CONFIG_V4L_USB_DRIVERS=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
The resulting modules are:
lsmod | grep uvcvideo
uvcvideo               50612  0 
videodev               34092  1 uvcvideo
v4l1_compat            12372  2 uvcvideo,videodev

Skype video calls and the cheese application work.

Sound

Sound works out of the box with alsa and the following modules (part of the standard 2.9.30.1 kernel):

ac97_bus
snd_ac97_codec
snd_intel8x0
snd_intel8x0m
snd_mixer_oss
snd_page_alloc
snd_pcm
snd_pcm_oss
snd_seq
snd_seq_device
snd_seq_midi_event
snd_seq_oss
snd_timer
The mute and volume up/down buttons work very well. Note that they apply only to the loudspeakers. The volume of phone jack output does not change.

X301 hardware maintenance

Adobe crashplayer

Adobe Flashplayer is a problem. You can only download the latest version from their official download site. There is however a possibility to download an archive with all kind of versions of flashplayer for linux, windows, mac, solaris at http://kb2.adobe.com/cps/142/tn_14266.html. That helps a lot. Linux versions are not available for flashplayer 8 but the flashplayer 7, 9 and 10 archives contain linux versions.

I tried the latest version, "ldd libflashplayer.so" showed that all libraries are found, yet it would crash the browser almost instantly. Fortunately some of the older ones work:

A very good addon the firefox is the flashblock plugin. With flashblock you can decice if you want to see flash content or not.

Samsung MLC SSD

This laptop has a Samsung MMCQE28G8MUP-0VA disk. It is silent and very fast. SSDs are however a bit special. They are very fast in reading random data. This is what a computer does most of the time. It is very rare that data is read sequentially under normal laptop working conditions. Most of the time data is read and rarely data is written to disk. The way I use the PC causes 10 times more blocks to be read than written. Those are all things that SSDs are very good at.

Writing is a lot slower than reading on a SSD and there is also a limit as to how often data can be written back to the same storage cell:

"Compared with traditional HDDs, most SSD designs have a write performance penalty when writing data. In addition, unlike HDD bits, SSD bits degrade over time from a "writability" perspective. The general rule is that an SSD single-level cell (SLC) bit is good up to 100,000 writes. The endurance of today's multilevel cell (MLC) flash typically is about one-tenth that of SLC flash."

In other words for this drive used here in the x310 one can write 10000 time to the same storage cell and then it is broken.

There is a bit of firmware in the disk that tries to reduce the write load on cells by using different cells as often as possible but the message is clear.

In /etc/fstab I put the noatime option on all partitions:
  /dev/sda1               /boot           ext2            noauto,noatime  1 2
  /dev/sda3               /               ext3            noatime         0 1
  
This avoids the update of the access-time field on a file when you read the file. This reduces the disk writes a lot.

In /etc/conf.d/local.start I added a line to reduce the write frequency and keep changes longer in ram:
  echo "$0 vm dirty write back 20sec..."
  echo 2000 > /proc/sys/vm/dirty_writeback_centisecs
  


You can "watch your" disk with the iostat commands (part of app-admin/sysstat )

The exact version of this ssd is:
hdparm -I /dev/sda

ATA device, with non-removable media
        Model Number:       SAMSUNG MMCQE28G8MUP-0VA
        Serial Number:      SE924B3548
        Firmware Revision:  VAM08L1Q

During initial installation and troubleshooting (the first few weeks) it is good to have persistent log files but later on it is OK to have logs written to a ramdisk. This accelerates the startup a little bit more and it saves lifetime on the SSD-MLC disk.

For this I just mount a 16Mb ramdisk over /var/log. You do not have to clean the content of that directory. If you want to go later on back to normal disk based logs then just don't use the ramdisk anymore.

The loading and kernel internal initialization of the ramdisk takes a moment. The best is therefore to load the ramdisk module (rd) at the beginning of the the /etc/init.d/localmount script and mount the ramdisk on top of /var/log at the end of localmount. localmount is executed before the logging starts (start of metalog in my case).

Here is what you have to do:
1) Compile the kernel with ramdisk support:
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_SIZE=16384

2) Edit /etc/init.d/localmount:
At the beginning of the start function add:

        einfo "loading ramdisk module..."
        # load ramdisk module first. It takes time to come up:
        modprobe rd

at the end of the start function add:
        ebegin "$0 formatting ramdisk for /var/log..."
        /sbin/mke2fs -q -m 0 /dev/ram0
        einfo "mounting ramdisk on top of /var/log..."
        mount /dev/ram0 /var/log
        eend $?

Now we have normal log files but they are discarded at shutdown. In my opinion that is very much acceptable for a laptop.

It worked so well that I decided later to do the same for /tmp I just added the following lines to /etc/init.d/localmount:
    ebegin "$0 formatting ramdisk for /tmp ..."
    /sbin/mke2fs -q -m 0 /dev/ram1
    einfo "mounting ramdisk on top of /tmp ..."
    mount /dev/ram1 /tmp
    chmod 1777 /tmp

Another big disk user is portage. When you compile then it generates a lot of temporary files under /var/tmp/portage The problem is that this filesystem can get very big and normally you don't need it (unless you compile files with emerge).

SSDs are now so popular that there is even a gentoo wiki on this subject and it suggests to use tmpfs as that is a filesystem that can grow dynamically ( http://en.gentoo-wiki.com/wiki/Solid_State_Disk ).

In the kernel config you need (CONFIG_TMPFS=y):
File systems --->
    Pseudo filesystems --->
            [*] Virtual memory file system support (former shm fs)

In the fstab I added:
# to avoid the SSD from beeing worn out by portage compilations:
tmpfs      /var/tmp             tmpfs  size=500M,mode=1777      0 0


# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3            120895888  13134460 101620184  12% /
udev                     10240        84     10156   1% /dev
shm                    1504436         0   1504436   0% /dev/shm
tmpfs                   512000      1096    510904   1% /var/tmp
/dev/ram0               253871      2326    251545   1% /var/log
/dev/ram1               253871      2061    251810   1% /tmp

A bag for the X301

I very much like those Neoprene Sleeves. It looks like a wet suit for divers it. It protects the notebook a bit but it does not make it too big. Lenovo does unfortunately not seem to have those. For all my other Thinkpads I bought them at umates.com but they did not have the right size.

The 13" MacBook has alsmost the same size as the X301. A bag that is good for a 13" MacBook will also be a good X301 bag as long as it can be streched a bit. I bought first at http://store.apple.com/ an "Incase 13" Neoprene Sleeve". It fits exactly but unfortunately it has too much padding. It protects the notbook well but it is too bulky.

The "Case Logic 13.3" Laptop Sleeve" is quite good. The width fits exactly but it is 2cm too deep. In other words there is a bit of slag.

I am still looking for other options. Crumpler Europe (not the Crumpler in Canada/US) has some nice sleeves (http://www.crumpler.eu/).

Battery

There are 2 types of batteries available for the X300 and X301 thinkpads: From the inside (label side of the battery) you can only distinguish the different types by their power ratings. On the outside the rubber feet are clearly visible if it is the bigger 6 cell battery. The laptop will then stand on those battery feet instead of it's own.

Links


TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones   This page was written by Guido Socher

Mon Aug 7 12:01:14 EDT 2017