I recently replaced my Macbook with a Lenovo Thinkpad X300 notebook. Here are some notes and tips concerning GNU/Linux installation and configuration for an optimal day to day use.
Here are my current settings for power management :
/etc/rc.local: Simplified, no more vm.laptop_mode (not useful with a ssd).
# Audio powersave echo 1 > /sys/module/snd_hda_intel/parameters/power_save # For thinkfan echo watchdog 0 >| /proc/acpi/ibm/fan chmod 666 /proc/acpi/ibm/fan # For PHC Voltage regulation kernel patch http://www.linux-phc.org echo 15 15 15 >| /sys/devices/system/cpu/cpu0/cpufreq/phc_vids echo 15 15 15 >| /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
/etc/thinkfan.conf: Simplified, less fan, more silence :)
(0, 0, 40) (1, 35, 58) (2, 56, 64) (5, 58, 128)
Do not forget to follow powertop indications.
First, the specs of this new toy:
* Intel® Core 2 Duo SL7100
* 2x1Go PC2-5300 DDR
* 64GB SSD
* 1.61 Kg with 6 cells main battery and Ultrabay 3 cells secondary battery
Then, lspci output:
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c) 00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c) 00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c) 00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03) 00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03) 00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03) 00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03) 00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03) 00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03) 00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03) 00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03) 00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03) 00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03) 00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03) 00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3) 00:1f.0 ISA bridge: Intel Corporation 82801HBM (ICH8M-E) LPC Interface Controller (rev 03) 00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03) 00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 03) 00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03) 03:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)
About lsusb, just one useful line:
Bus 003 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Important note: since I disabled Bluetooth, WiMAX and the touchpad in the BIOS,
they are not present in lspci and lsusb outputs, but both Bluetooth and touchpad are functional with Ubuntu.
Quite a modern hardware, and thus some issues concerning Linux support. Indeed, only the 2.6.28 offers a good support, previous versions are either bugged or hackish.
I chose Ubuntu 9.04 beta for an easy yet fine setup, with LVM+Crypto for the root partition. However a bug in xserver-xorg-evdev in 64 bits edition breaks the must-have trackpoint scrolling feature. Thus, I decided to run 32-bit version, despite a 64 bits CPU.
Most of the hardware components work out the box, without particular setup, including the webcam. The only regression compared to previous kernel versions is the integrated microphone, which remains disabled. I hope to fix it out soon. However, the jack input line is fully functional. Update: just run alsamixer, type tab to enter in the Capture section and enable the internal microphone. Speakers offer a good (and loud) sound experience, quite surprising from a Thinkpad notebook.
No particular thoughts on Ubuntu itself, except that Jaunty Jackalope will certainly bring a better user experience than ever (new themes, new notification system, general speed improvements, boot time dramatically reduced...).
Now the real deal: how to maximize battery operation and lifetime with the Lenovo Thinkpad X300?
The average base power consumption is 14 W, WiFi on, 75% backlight, some terminals and Firefox.
First, disable everything you will never use in the BIOS. Currently, I disabled Bluetooth, WiMAX, Wireless WAN (3G),"USB Wifi" (wtf?) and touchpad. Saving: 2 W
Then disable Wake On Lan, unless you need it. It keeps the Gigabit Ethernet Controller to remain in an active state that actually use energy. Saving: 1W
Moreover, I blacklisted the e1000e module, since I mainly use WiFi. When I need wired connection, I simply modprobe it.
Then concerning the wlan0 WiFi interface, just run:
iwconfig wlan0 power on
in order to active Power Management. Saving: 0.5W
Some sysctl tweaking in /etc/sysctl.conf:
vm.laptop_mode = 5 # Activating laptop mode, power friendly I/Os vm.dirty_writeback_centisecs = 2000 kernel.nmi_watchdog = 0 vm.swappiness = 5
And in /etc/rc.local:
echo 10 > /sys/module/snd_hda_intel/parameters/power_save echo min_power > /sys/class/scsi_host/host0/link_power_management_policy echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
Saving: 2W
Quite simple, heh? :) Now, my average consumption is 8.8W, allowing a real use of the X300 for more than 6 hours, instead of 4h30.
The internal fan management is kinda broken in Linux. The workaround is to append thinkpad_acpi to /etc/modules and options thinkpad_acpi fan_control=1 to /etc/modprobe.d/fan for instance.
Then you could use thinkfan and this sample thinkfan.conf:
# thinkfan example config file # ============================ # # Syntax: # (LEVEL, LOW, HIGH) # # LEVEL is the fan level that's written to /proc/acpi/ibm/fan # LOW is the temperature at which to step down to the previous level # HIGH is the temperature at which to step up to the next level # All numbers are integers. # # You can put spaces anywhere you want. Anything that doesn't match this # syntax is ignored. # # The number of tuples is limited by the size of your system memory. # # WARNING: Sanity checks are only made for correct ordering of the fan levels # and for (LOW < HIGH) within one tuple. You can still use any kind of insane # temperature limits. (0, 0, 50) (1, 48, 58) (2, 54, 61) (3, 56, 63) (4, 58, 65) (5, 60, 66) (7, 63, 128)
Concerning lithium batteries, you should keep them charged between 40% and 80%. It is quite easy to do with Thinkpads: just append tp_smapi to /etc/modules, and the upper charge limit will be set to 86%, which is a good compromise. Moreover, instead of completely drain the Ultrabay battery before switching to the main battery, you can manually force discharge; as root type:
echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge
But do not forget that even if you replug your laptop, discharge will resume anyway!
Thus, you have to bypass forced discharge; as root type:
echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge
Annoying workaround, but I will try to find or code a proper solution.
UPDATE: See my Baswim script here.
That's all folks!
# · 23 commentsHi, thanks for these usefull hints. I'm using the same setting but didn't find all of these informations on the net.
Some questions:
I was using tp-fancontrol, which has a nice init-script, which however doesn't start anymore on my system - no idea why. Do you have an init-script for thinkfan? And where did you get the termal thresholds from? tp-fancontrol seems to read more information than thinkfan, but I didn't know which thresholds I should use (and to get the init-script back to work).
Is resume from hibernate/suspend working for you? It isn't here with KDE (kubuntu jaunty). I always get back to the login-screen.
Are all of the Fn-keys working for you? Some are not under KDE (such as the Fn+F2-key).
Ben
Ben: Thanks for your comment. I regret I can't help you with tp-fancontrol, since I dont use it. Concerning thinkfan, it supports suspend and resume seamlessly, so I just write a simple "/opt/bin/thinkfan" (or wherever you plan to install it) in my /etc/rc.local, because it is simple yet efficient enough for me: cooling the laptop while keeping noise and footprint low.
I got the thresholds from the configuration file provided in the latest thinkfan package, available here: http://phuk.ath.cx:3080/thinkfan/thinkfan-latest.tar.bz2. Actually, I recently tweaked them a few, you will find the new settings in this (updated ASAP) blog entry.
Suspend/Resume is working like a charm, and tenth time a day. The only advice I could give you is either blacklist the e1000e module or append SUSPEND_MODULES="e1000e" to /etc/pm/config.d/10-suspend-modules (you can create the file if nonexistent).
The Fn-Keys became fully functional by modprobing thinkpad_acpi module. If you use the same setup, I guess it is just KDE which messes with special keys. Does xev provides any result?
Hi guy,
thanks for this very useful article, but where are all these bios options? I nearly found nothing out there to disable...!
I updated my X300 to the latest BIOS version, but how can you turn off bluetooth or wake-on-lan separatly?
one more thing to say: the issue with the trackpoint scrolling seems not to be a evdev problem - it's just some other hardware.
Do you got it working without disabling the touchpad in bios options? can you tell me how? I really miss this feature... .-D
Greetings, Gdev
@Bve:
I got the same issue with ubuntu jaunty - and solved the problem.
I don't know why - but the UUID of my swap partition changed... (some strange matter)
so try the following steps:
1. swapon -a
Tries to mount all swap partitions listed in /etc/fstab. If an error occures you may have the same problem.
2. get the new UUID of your swap with
blkid
and replace the old one in the fstab
3. update the UUID in the initramfs config file - here your system checks if there is something to resume...
/etc/initramfs-tools/conf.d/resume
4. now update initramfs:
sudo update-initramfs -k all -d
so that's all.
I hope it works for you...
greetings, smn
@Romain,Smn:
thanks for your hints. Actually both of you where right. I had the same strange UUID behaviour, but solved that some time ago when I realized that my swap wasn't running. Putting e1000e to the resume/suspend-list now finally solved the suspend-problem, it seems to work fine now.
Smn, why do you think, the trackpoint-scrolling isn't a evdev-problem? It seems to me, that the trackpoint is recognized under a different name if the touchpad is enabled, so that evdev can't handle it any more. (btw, disabling the devices is done somewhere in the BIOS where one wouldn't expect it, I don't remember the exact name, but it was somewhere at the end of the main menu).
@Romain: xev gives some output for most of the fn-keys (but not for the zoom on space); so you're right, it is some kde-problem. I will try to find that out.
Ben
Smn: If I remember correctly, you will find these options in the 'security' section of the bios, more specifically in the I/O subsection.
I hope that helps a bit :)
hi guys,
I thought the touchpad/trackpoint problem has some hardware origin just because if I disable the touchpad with the Fn-F8 keys, the trackpoint still works (that's right!) but it's buttons won't.
To get these keys working I used a shmconfig.fdi in /etc/hal/fdi/policy :
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="input.x11_driver" string="synaptics">
<merge key="input.x11_options.SHMConfig" type="string">True</merge>
</match>
</device>
</deviceinfo>
Can you help me?
When the error in 64bit-evdev is gonna be fixed?
greetings, gdev
Smn: I'm afraid the evdev bug may remain active, since it has not been fixed for almost 2 years now, despite of several bug tickets about it. Maybe if you update one of them on Launchpad... I wish you the best luck, or go for 32bit version.
Hello!
I recieved my bay battery today and was looking for a way to switch the discharged battery without removing one physically, which is how I found this blog. Now that I know that it's possible via force_discharge I'm wondering if it's possible to let linux do this automatically.
My dream would be that linux would discharge one battery up to 40% or so and then force_discharge the other one. Unfortunately I'm quite new to Linux and have no idea how to do something like this.
Do you have an idea or propably have done something like this already? If you do it would be great if you could let me know..
Best regards from germany,
Bender
(I apoligize if my english isn't very good. :) )
Bender: Hi!
Don't worry about you english, I'm french so I guess I'm not perfect either :)
Concerning the manual switching issue, I will code a first attempt in Bash soon (Let's say this week-end :), and if it seems acceptable, I'll publish it in a new blog entry.
Stay tuned!
Bender: Go to this entry
(Yeah, I spent a little time on this during a school seminar, but shhh :P)
hey,
On My T400 the fan management seems also to be broken. I opened a bug report...
https://bugs.launchpad.net/bugs/381315
How are you calculating the Watt saved? just curious...
Al: I used powertop for these measurements, proceeding step by step and looking for a long term consumption, not only for two minutes.
This method may be not accurate as you expected, but the gain in battery life is real.
How about the webcam? I haven't got it working in 9.04
@Slingshot : well, no problem here on ubuntu. The webcam uses the uvcvideo kernel module.
Hey I'm wondering if you still run jaunty on your ThinkPad? I'm running it at the moment on my X300 due to way higher power consumption on karmic and I experienced some difference from your lspci output. Everything is similar expect for one entry:
I additionally get:
"00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)"
... But my Disk is running via SATA and I cannot imagine any device using IDE. Did you disable IDE manually in the BIOS settings? How?
And another question: Does your CPU switch to C3 state? Powertop only shows me C0..C2 and C4 but misses C3. Could this be a possible reason why the Thinkpad is still running on higher consumption on Linux than on XP? How could this be fixed? I read tests that mentioned a consumption about 7.5W. That would be nice...
Nevertheless thanks much for your advices and be greeted - happy new year btw. ;)
C4K3
Hi Kacktorte and Happy New Year :)
Indeed, I'm not running jaunty anymore, since karmic i386 perfectly fits the X300.
Your concerns about a slight energy consumption overhead are unfortunately right; indeed, the 'iwconfig wlan0 power on' command does not work anymore, due to a bug in the latest iwlagn module
*But*, since the overall consumption is lower, karmic lasts longer on battery with WiFi off and with wifi on, I can't honestly tell the difference (a mere dozen of minutes maybe). Generally, my X300 drains about 9 to 10W w/ WiFi and less than 8W w/o WiFi, resulting in an average continuous battery operation of > 5h.
Concerning the lspci output, I'm pretty confused myself, since I just tested it again, and got the IDE controller line. I can't say anything but WTF? Since my output shows 00:1f.0 and the directly 00:1f.2, I assume a copy-and-paste fail. Thanks for noticing and sorry for the inconvenience :)
Concerning the CPU's C states, I'm confused again. My systems only reports 4 C's states (from 0 up to 3) and powertop confirms that the cpu remains in C3 state most of the time. Besides, I think this feature is not related to the OS but maybe to the acpi subsystem. Did you try to load thinkpad-acpi?
Finally, I think you should try karmic again, this is so far my best GNU/Linux experience on mobile hardware, other distributions included :)
Have a nice day.
Heyhow, thanks for that quite quick reply!
Did you tweak your Karmic or did it just work fine running on low current without any changes from the plain installation? And do you use the 32 or the 64bit version? My TP hat 4GB Ram an somehow I feel bad about wasting 1GB of Ram... (Does a RAM DIMM use much power?) Because of that I installed the 64bit version and experienced that "high consumption". Atm (jaunty 64) my Pad is draining between 9 and 10.5W with WLAN (only document viewer and firefox active) and between 8 and 9 without it.
In which state of use does your Notebook use less than 8W? 50% brightness, WLAN off and just powertop-terminal?
Maybe my about 3.2h running time aren't that bad...
(I don't have the bay battery but the drive - I should try to deactivate it in BIOS settings and have a look at the consumption again...)
Regards
C4K3
Hi Kacktorte :)
I run a (almost) plain installation of Karmic i386. I was looking for amd64 as well, but since I've got only 2 GB of ram and rather concerned by the 64 bits memory overhead, I decided to use the 32 bits flavor. However, I believe there is no link between an Ubuntu flavor and power consumption, but I may be wrong.
The only tweaks I made are the usual ones in my /etc/rc.local and /etc/sysctl.conf
Your results sound very good to me, actually. On karmic, my TP drains at least an additional Watt. The screen brightness has a limited impact in power consumption since it's LED based.
I can't remember any particular BIOS setting concerning the dvd-drive...
You could try to blacklist the cdrom module, or even remove the drive and find any suitable solution to seal the drive enclosure (maybe some black tape? :P).
If you decide to buy a bay battery, I advise you to look at my blog entries concerning battery management.
Have a nice day :)
Hey hey,
I now finished my power tweaking, I guess. you're right: if 64 or 32bit seems to have no impact. I disabled the DVD Drive in the BIOS security setting (where the WAN-stuff can be found).of the installation
I now reach nearly 4 hours running time with a quite used battery (75% capacity remaining). So the ~8W consumption are reached!
But the clue was not just disabling the DVD Drive but removing one of the RAM DIMMs. Well - whatever I don't even need 2GBs of RAM so I welcome the power saving.
Note: on the DIMM slot is written "1.8V". That's the point I guess.
Well so far it seems great tweaking. Thanks alot for your hints and everything. All hail TP X300 ;)
C4K3
P.S.: Sooner or later I'll get a bay battery, I guess.
Could you update the above configuration advice for more recent versions (11.04?)
@Angel: Yes, I have planned for some time now to write a new article about Ubuntu power management and the Thinkpad X300. Please bear with me and stay tuned, maybe this week-end :)
Add comment