02-18-2012 05:59 PM
Having switched from Ubuntu to Mint since Christmas, I am pretty happy with the GNOME classic interface. I usually use a desktop, but I just bought a Thinkpad T420 for occasional usage. I spent last two days tinkering around various issues and it's time to share some of my experience, as I got quite a lot of help from others’ discussions.
I have no intention to make it complete (but should be correct). It's just another thread for Googlers to refer to. Please post if you have better ideas or corrections.
For all instructions, DO NOT JUST COPY EVERYTHING. MAKE SURE YOU AT LEAST CHECK EACH COMMAND'S OUTPUT. THE FILE PATH CAN BE VERY DIFFERENT FOR DIFFERENT CONFIGURATION OR MODEL. It's better if you understand them though. (I don’t claim that I fully understand them, but nevertheless, it worked for me. )
$ indicates a command. I skip sudo for convenience. Whenever you have a permission error, try sudo first. Also ignore #BEGIN and #END when editing files.
A. My T420 Hardware
i5 2430M 2.4GHz
HD3000 <- I decided to get rid of NV graphics due to the lack of support of Optimus, and Intel driver is always quite friendly to Linux
14.0 HD+ (1600x900) <- Definitely worth upgrading. Otherwise I would go E420, which is much cheaper
Intel centrino wireless-N <- same before, betting on better Linux driver support
Virtualization is disabled by default. Make sure you turn it on if you will be using VM. You also need to turn on "USB power when off" if you want to directly charge your phone when your laptop is off.
Access BIOS by pressing F1. Or the blue "Enter" button for other menus.
There are lots of discussion on this topic. Here is a quick version.
$ apt-get install lm-sensors
Use default suggestions until when asking if you want to write to /etc/modules, select YES.
At this point, you can either manually load the list modules ($ modprobe xxxx) or just reboot.
Then you can use "$ sensors" to check
You should be able to see core temperature and fan speed.
D. Hardware monitor applet
That's the applet which can display temperature, fanspeed on menu bar. My instruction is only for GNOME classic, but I guess it will work for MATE too. To add applet to your menu bar, ALT + right click on the menu bar.
It's no longer in the package system. Go to http://sensors-applet.sourceforge.net/index.php?co
Download the source code, untar it
$ ./configure --prefix=/usr
$ make install
You need to install several dev packages along the process. Once it's done, you should see "Hardware Sensors Monitor" from "Add to Panel". Add it and configure the sensors you want in preference.
E. HDD Temp
If your lm-sensors didn't detect HDD temperature, you can install hddtemp.
$ apt-get install hddtemp
Default config is fine. Then use
$ hddtemp /dev/sd?
to check HDD temperature. Or just add it in your applet display. Your first HDD is /dev/sda, second is /dev/sdb, etc.
F. Control the fan
By default, my fan is stuck at 3300RPM, no matter what. This seems to be a common Thinkpad problem. Here is the thread I used to fix that: http://ubuntuforums.org/showthread.php?t=1749186
Make sure the order is correct and you understand your /etc/thinkfan.conf. Otherwise you could mistakenly stop your fan when CPU is at 80C.
1. $ apt-get install thinkfan
2. make sure coretemp is in /etc/modules (should be done by sensors-detect already)
3. load kernel module coretemp (should be done by sensors-detect already)
4. add sensors to /etc/thinkfan.conf
Here is what my thinkfan.conf looks like. Pretty easy to understand with comments in that file. YOU NEED TO FIGURE OUT THE sensor LINE ON YOUR OWN! IT COULD BE DIFFERENT FOR A DIFFERENT CONFIG/MODEL. Use "$ cat xxxx" to check if its output (in milli-Celsius) matches "$ sensors".
(0, 0, 55)
(1, 48, 60)
(2, 50, 62)
(3, 52, 64)
(4, 56, 66)
(5, 59, 70)
(6, 63, 75)
(7, 66, 32767)
5. add following line to /etc/modprobe.d/thinkfan.conf
options thinkpad_acpi fan_control=1
6. reload kernel module "thinkpad_acpi"
$ modprobe -r thinkpad_acpi && modprobe thinkpad_acpi
7. set START="yes" in /etc/default/thinkfan
8. start thinkfan:
$ /etc/init.d/thinkfan start
9. check whether it works:
$ cat /proc/acpi/ibm/fan
02-18-2012 05:59 PM
G. Power usage regression
There were a huge buzz about Linux kernel power regression since 2.6.39, from Phoronix. Not sure if it’s true (out of my knowledge), but adding this won’t hurt.
H. Extend battery life
It’s better to keep LION battery within 30-85% of charge. Under Windows, you can do it with the Thinkpad software. The tp-smapi tool does the same thing under Linux.
Thinkwiki has great information, but some of them might be outdated. I generally followed their guideline, except for some changes. Didn’t find a good place to put them back to the wiki though.
1. $ apt-get install tp-smapi-dkms
Now you should be able to set charging threshold:
$ sh -c 'echo 85 > /sys/devices/platform/smapi/BAT0/stop_charge_thres
This makes charging stop at 85%. For me, the start_charge_thresh didn’t work, but that’s not critical. There are other interesting things you can do, and please refer to the previous thinkwiki link.
2. Now let’s make the changes persistent
Load tp-smapi on reboot:
$ echo tp-smapi >> /etc/modules
Then set the threshold automatically using sysfs:
$ apt-get install sysfsutils
Add the following line to /etc/sysfs.conf
devices/platform/smapi/BAT0/stop_charge_thresh = 85
I. Automatically adjust screen brightness on startup
Each time I boot up, the screen brightness is set to maxmium. Hurts my eyes and hurts the battery.
/sys/class/backlight/acpi_video0/brightness is the special file which controls the brightness. For example, change brightness to level 6 (0-15):
$ echo 6 > /sys/class/backlight/acpi_video0/brightness
To make it automatic
1. Add a new script in /etc/init.d/adjustbrightness, and edit /etc/init.d/adjustbrightness (use whatever filename you want) to:
echo 6 > /sys/class/backlight/acpi_video0/brightness
2. $ chmod 755 /etc/init.d/adjustbrightness
3. $ update-rc.d adjustbrightness defaults
J. CPU frequency stuck at lowest level on AC only
Or when your Laptop is fully loaded, the recharging time becomes 10-20hrs or larger. It’s not your OS’ problem. (I wasted lots of time trying to “fix” this.) Check if you have a 65W adapter. You need to get a 90W one if you want to run full speed on AC only.
02-20-2012 01:58 AM
Hello wujj123456, Hello Forum
Thank you for the nice guide. I am using Linux Mint 12 on my T420s.
For completeness sake i just want to recommend the use of powertop / laptop-mode-tools to reduce power consumption.
Just install both pakets via apt-get.
By using this tools i reduced the consumption of my T420s to 8 W using wlan and usable brightness, 5 W with wlan off and brightness set to zero.
Although there is a little workaround necessary to have everything working:
First you have to tell laptop-tools to work with your kernel ( only 3.x ).
Therefore ou have to edit the file /usr/sbin/laptop_mode near line 506
case "$KLEVEL" in "2.4" ) ;; "2.6" ) ;; "3.0" ) ;; *) log "ERR" "Unhandled kernel version: $KLEVEL ('uname -r' = '$(uname -r)')" >&2 exit 1 ;;
After the editing it sould look like this. ( You have to add your kernel )
Powertop sets /sys/bus/pci/devices/*/power/control to "auto"
This can lead to strange behavior on shutting down the system when on battery : the system is going to power up as it shuts down.
This bug can be solved by setting all pci powercontrols to "on" via the following script that should be run on rc0.d and rc6.d
for con in /sys/bus/pci/devices/*/power/control; do echo on > "$con" done
Furthermore I would not recomment to use tp-smapi on T420 and T420s as it is not really supportet.
Only some of the functions work properly. For example it isn't possible to use force_discharge.
Although there is no harm if using it.
I think there might be some other problems you have to face, like keeping powertop suggestions persistent - but there are plenty of guides over the internet.
Hope i could give useful tips.
02-20-2012 01:32 PM
Thanks for the info. I will try it some time this week. I just dug out a note about undervolting the CPU, which I used to do on my laptop. Probably worth trying too. SNB has wide voltage margin, and any voltage reduction leads to dramatic power decrease.
Does anyone know if PHC officially supports SNB now?
02-23-2012 05:18 PM - edited 02-23-2012 05:21 PM
I tried the laptop-mode-tool, and it significantly reduces the power usage. However, it seems to interfere with my thinkfan configuration. Do you observe similar effect?
In addition, if I manually start the laptop mode service, it crashes, saying buffer overflow detected.
Btw, thank you for the powertop fix. I actually always turn off my laptop with AC plugged in, and never realized the bug.