Tuesday, March 12, 2013

> Asus UL30VT - Tweaking Hardware and Software for a leaner linux laptop


Several years back, Asus released a sleek and dynamic laptop line utilizing the the then-new Intel Ultra-low voltage CULV chipset: the UL30VT, UL50VT, and the UL80VT. With excellent battery life, reasonable pricing, and a Dual-graphics solution that allowed for gaming, the UL's have lasted reasonably well (I'm typing this on one right now :) Naturally, there has been a lot of work to get it working on Linux, and for the most part, it's been sucessful. However, most flavors of linux by default are not optimized for laptops, let alone the somewhat unique hardware in the UL's. For this post i'll be showing you how I lowered my battery usage on the UL30VT, using the latest version of Linux Mint (14, MATE edition). I have also made hardware changes to increase battery life, which may not be feasible for everyone.

Just look at that sexy thing.


UL30VT replacement battery:
http://www.amazon.com/4400mAh-A42-UL30-A42-UL50-A42-UL80-Replace/dp/B004HFFID8/ref=pd_cp_pc_0

My SATA II SSD:
http://www.newegg.com/Product/Product.aspx?Item=N82E16820220390


One of the most useful Linux laptop tools out there is called Powertop. Essentially, it keeps track of devices and processes running on your machine, and gauges their average power usage. For anyone who wants to pinpoint what's eating the most of their battery, it can't be beat. Installing and using Powertop is simple enough on the Ubuntu-based Linux Mint, just install and calibrate, like so:

sudo apt-get install powertop
sudo powertop --calibrate


Now it's important to let the calibration run on battery power and to leave your laptop alone while it happens. Powertop will analyze and aggregate the power usage of your hardware components, and for a power estimate based on the total power used and battery capacity. As we start making our optimizations, you should notice a marked increase in estimated battery life.


UL30VT specific battery optimizations:

The UL30VT has a very unique hardware configuration, as it utilizies 2 graphics cards: An intel onboard solution for low power usage (the one we want here), and a beefier Nvidia discrete card (it uses its own memory and a lot more power, so this is the one we will turn off), usually used for gaming. This configuration is very well supported in the Windows 7 it ships with, but we want to optimize it for Linux! The best solution that i've found at the time of writing is to simply disable the Nvidia card altogether. In order to do this, I followed this thread on Ubuntu Forums, with some slight modifications. The debian file didn't install for me, so I ended up compiling the module from source (after adding a module header to the code), and manually adding it via the modprobe command. What this does is install the module to the Linux kernel for the current session. In order to turn the Nvidia card off at every startup, however, it needs to be a permanent module. This can be done by adding the name of the module to /etc/modules. Normally this should work fine, but it ended up bricking my installation a few times. The workaround I found is to run the 'modprobe' command itself at every startup (by adding it to the /etc/rc.local file). After this, I noticed a 4 Watt decrease in overall power usage from powertop.

After extensive trial and error, these are the exact steps that worked for me (your mileage may vary):

cd Downloads (or wherever your .deb is downloaded to)
ar x *.deb
tar xzf data.tar.gz
cd usr/src/
tar xzf nvidia-*.tar.gz
cd dkms_source_tree
add #include<linux/module.h> to the top of asus_nvidia_g210m_acpi.c (or whatever the c file is called)
sudo make clean install
sudo cp nvidia_g210m_acpi.ko /lib/modules/$(uname -r)/kernel/
depmod
modprobe nvidia_g210m_acpi

To run on boot:
add 'modprobe nvidia_g210m_acpi' /etc/rc.local

Enabling brightness keys:
The UL30VT seems to have had some issues with getting the brightness keyboard keys working by default in Linux. However, by following the guide provided here, I managed to get them operational.


General laptop battery optimizations:
For awhile now, I've been a big fan of Hak5 on Revision3. Most recently they put out a segment on linux battery optimizations, from which many of these following tips are drawn. For the full episode, go here: http://hak5.org/episodes/hak5-1225

1. Disable unneccessary Startup applications.
If you're like me, there are few startup applications/applets in most linux environments that you actually need. Some others, such as bluetooth manager and default-keyring are optional and consume battery when run in the backround. To disable, simply search for startup applications in your menu bar, and uncheck what you don't need. (WARNING: If you don't know what a startup application does, DO NOT disable it. Seriously, that's like dividing by zero.)

2. Lower backlight brightness
Most of the time, you likely won't need the absolute brightest setting your laptop has to offer. You can usually set the brightness from your power management console (click the battery icon, then preferences), or there may be keyboard keys that map to brightness functions (like on the UL30). Whatever your setup, you will need to make this behavior default in power management. I reccommend using the lowest brightness you can stand, but comfort may weigh more than battery life, depending on your preferences.

3. Turn off unused devices
Most of the time, I use my laptop on wireless only, so I don't really need my ethernet interface. In linux, you can see your interfaces with the ifconifg command. Try it, and you should see a few different ones, a lo (don't worry about this), a wlan0 (your wireless interface), and eth0 (we'll disable this).
To turn off eth0, run this command:

ifconfig hw eth0 down

To make this change run on startup, add this same command to your /etc/rc.local, like we did for our G210m module.

Do you know any other devices you can safely disable on your linux laptop? Post it in the comments!

4. Disable Swappiness
Straight out of the Hak5 segment, we'll be disabling our swappiness. But what is Swappiness? Swappiness (tired of it yet?) is a tool which controls when your machine starts to use its Swap memory (reserved hard drive space which is used as an overflow for RAM). By setting this to 0, we will force Swap to not be used until absolutely necessary. Because HDD space is more expensive to access, this will save us power if we have available RAM. To set, find your swappiness file:

/proc/sys/vm/swappiness

and edit it, setting whatever value it has (mine was 60) to 0. Make sure you do this as root (or run sudo with your command!)


Conclusions:
And that's it! If you've been following along, your laptop should now be consuming significantly less power than when we started.
According to powertop, I get about 6 hours @ 10 Watts when idle and 4-5 hours @ 14-15 Watts under reasonable use, but every machine is different. How'd yours do?
If you have any questions or additional suggestions for power optimization, please leave a message in the comments!

Thanks to:
Hak5.org
ubuntuforums.org
wiki.daviddarts.com/Main_Page
Google (for all the searchability)

2 comments:

  1. Very informative and well written post! I prefer to read this kind of stuff. The quality of content is fine and the conclusion is excellent hp bezel

    ReplyDelete