Open Minded Brain Open source, open mind, open future


Undervolting in Ubuntu 10.04 (Lucid) LTS

This is a guide to Undervolting your Intel CPU under Ubuntu 10.04 LTS. For the ones that do not know, Undervolting means taking some of the voltage from the CPU which in return gives a longer battery life and lower temperature during intensive use of the CPU.

And what are the negative aspects of Undervolting? Well actually taking some voltage from the CPU could bring in computational problems, basically when taking too much of it the CPU could start mixing 1's and 0's which can crash the entire system (reset needed) or bring in data loss/corruption. Not so good eh? So how is that people manage to do it without causing those side effects?

It depends on every CPU. Because it is not possible to create two CPU's 100% alike in the factory, tests are made to ensure all CPU's sold can work with the voltages specified under all circumstances. The fact is that some of the CPU's can work with voltages many times inferior than others that came from same factory/same box. The trick is to discover the limits of your CPU and set the voltage just a little above this limit and you are good to go.

WARNING because of the negative aspects shown above, by following the steps given below, I am not under any circumstances responsible for any data loss or corruption, damage to the CPU/PC. Those next steps were proven to work for many people around the world, but no guarantee is given that it would work for you without possible side effects. Just make sure that at least you have an updated backup of the data before continuing.

Ok, so now that you accept full responsibilities for the steps below, let's get going. I actually did this several years ago under other version of Ubuntu (using a single core Pentium M CPU back then) and it worked alright, but many things changed since then, we've got multi core CPU's everywhere and the way the undervolting issue is handled in Linux is very different also.

So what do we need? A single or multi core Intel Mobile/Laptop CPU and Ubuntu 10.04 LTS installed on it and some time because it will take a little before having everything configured. Here are the complete steps that worked for me:

  1. As we are going to use a custom kernel, we need to add the linux-phc PPA repository, so just open a terminal and execute:
    $ sudo add-apt-repository ppa:linux-phc/ppa
    $ sudo apt-get update
    Basically they provide the same kernel as the Ubuntu one but with the patch that is capable for Undervolting.
  2. Next we need to install the phc kernel, with headers:
    $ sudo apt-get install linux-generic-phc linux-headers-generic-phc
    Ok, now we need to restart and use the installed phc kernel when booting. After restarting, you can check if you are using the phc kernel by using
    $ uname -r
    If no "phc" appears, then you have to configure grub2 to allow you to chose boot options and select the phc kernel at boot time. This can be done many ways one would be:
    sudo update-grub
    and count the number of lines that says "Found linux image" (first one is 0) and, when you found the phc one, do:
    sudo gedit /etc/default/grub
    then just change the "GRUB_DEFAULT=0" to the number of the entry you found that has phc. Save the file and do a update-grub command again like in the first step. Now you can reboot into the phc kernel.
  3. Great, we are using a phc kernel, now we need to add the actual undervolt module, as the kernel comes only with support for it, not the actual module. First download phc-intel offtree module from here. Right now they have "phc-intel-0.3.2-10 offtree" version. Direct link to the tar.bz2 file here. Unpack the files anywhere and point the terminal to the directory where you extracted the files and do:
    $ make prepare
    $ make
    $ sudo make install
    Right now you should have the module installed, check if everything worked by typing:
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids 
    40 34 31 27 23 15
    If everything worked, you should see some numbers (the ones above are the default ones for my CPU). If not, you may try to restart and check back to see if it works.
  4. So right now we are set, the only thing we have to do is... undervolt the CPU.
    Now we have to discover the limits of the CPU by lowering it's current voltage one step at a time and set the voltage 4 steps above the critical limit (where the cpu starts to give wrong calculations or the PC simply crashes).

    Why four? Well the recommendation was 2 steps above, but with this limit the PC crashed in the same day hours later, so I made it 3 steps, then some days after it crashed again. So I think 4 steps should actually do it. If not, you may increase this value until it suits you.

    Ok great now how to find the actual critical limit? There exists a script, created by the community, but it's old and it does not work for multi core CPU's and also in my particular case it sets the voltage directly below this critical limit so the PC crashes instantly.

    I updated this script and made it work on multi core CPU's (hopefully it will work for you too), so you just have to download the script, then give it execution permissions and execute it and follow on-screen indications:
    $ chmod +x intel-phc-undervolt.bash
    $ ./intel-phc-undervolt.bash
    Oh and make sure you close as many applications as possible when executing the script as the system may actually turn instable (it is intended actually) just to prevent any data loss. The script treats all CPU's cores with the same voltages, so if one of them is weaker than the other (does not support such a aggressive undervolting) is this the critical value that the script uses for all of the others, even if they could possibly use a even lower value.
  5. After you finished with the script, now you should have a "phc_tweaked_vids" file, containing the acceptable steps for your CPU. Now you only have to make changes permanent (load them at every boot of the pc) by editing /etc/rc.local file:
    $ sudo gedit /etc/rc.local
    and adding one entry for every core you have, something like:
    echo "23 20 4 4 4 4" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
    echo "23 20 4 4 4 4" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
    echo "23 20 4 4 4 4" > /sys/devices/system/cpu/cpu8/cpufreq/phc_vids
    just before the "exit 0". Note that "23 20 4 4 4 4" are my values, you have to replace the above with your values, that came from the "phc_tweaked_vids" file. So that's about it. Not too easy, not too complicated.

So... is it worth it? I have done some tests to see if the above actually works as said, so first I tested to see if on battery using powertop application and the CPU temperature I could see any differences. None actually, if the CPU is in idle state, there is no actual gain using undervolting, be it battery or temperature.

But when I've done the test under full load (using 2 burnMMX instances, one for every core) and with the CPU set at it's maximum 2.4Ghz I could see a very very noticeable difference.

First let's see the power drain of the battery in Watts, as indicated by powertop application (with the PC disconnected from the charger, of course):

It seems that Undervolting can spare you 10 Watt of power under full CPU load (Actual values from 38.4Watt to 28.7Watt). Now let's see how this translates actually to CPU temperature:

So those 10 Watt of power actually translates into having the CPU 7°C cooler (from 59°C to 52°C) while doing the same tasks under full load.

UPDATE: Thanks to aldeby in comments, just to clarify a little about the results of the CPU undervolt script. If the result of the script goes down to 0, that means is a fake value and that the CPU is locked and actually can't go below the lowest value (in my example the last values that have "4" value are faked by the CPU because he is actually running at it's lowest hardware allowed value, that would be 15). What this means is that at idle for example (when on 800Mhz in my case) I don't benefit anything by undervolting, but at higer frequencies (especially the 2.4Ghz one) I benefit a lot from it (see the charts abobe).

So that's about it. Hope you enjoyed the reading and that the steps were easy and clear to follow. Any questions/suggestions you can add them below, in the comments.

Comments (80) Trackbacks (2)
  1. test was succesfull by all vid’s=0, should i accept 0 0 0 0 for my cpu?

  2. and, of course, big thanks for this manual!! 🙂

  3. I do not think so, what CPU is it?

  4. The CPU seems to be locked. For instance also in Mihai output the last four 4 are fake values since the CPU simply works at its lowest voltage (in his case is vid 15) and cannot go lower due to hardware lock inside the CPU itself.

  5. thanks for the clarification, I updated the end of the article, just to clarify a little those values given from the script.

  6. Hi, How do I boot the phc kernel via Grub2 like mentioned in step 2.?
    Sorry I’m a Linux noob….

  7. Just do:
    sudo update-grub
    and count the number of lines that says “Found linux image” (first one is 0)
    then, when you found the phc one, do:
    sudo gedit /etc/default/grub
    then just change the “GRUB_DEFAULT=0” to the number of the entry you found that has phc. Save the file and do a update-grub command again like in the first step.

  8. i’ve core2duo P8700, it seems that test doesnt run correctly, he just passes all VIDs to 0 without any errors, once he gave an error on the second multiplyer.. i will just experiment with setting random values and working..

  9. Oh, ok, thank you.
    By the way thank you for sharing your knoledge.

  10. do you use lm-sensors to check temperature?

  11. Great article. Not working for me…

    sudo make prepare
    ./ line 10: patch: command not found
    make: *** [prepare] Error 127


  12. gnome-sensors-applet

  13. @Litaud

    make sure that you have package “patch” installed

  14. On a 1.7Ghz celeron…. Mine got down to 920mv (default vid 41) then computer crashes. No phc_tweaked file :((

  15. Oh the script restarted after “poweroff” 🙂
    Result: Default VIDs: 41 32 25 18
    Current VIDs: 17 10 5 4

  16. echo “17 10 5 4” > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
    paste this in rc.local?? and make rc.local +x?

    i don’t have /cpu/cpu1/ directory, so one line will do the trick? it’s a single core. Dont understand why you have so many lines in rc.local?

  17. you do not have to do +x, only add one line per cpu core, in your case one line should do it.
    I have so many lines to show the example here, I actually use 2 lines in my file because I have dual core.
    Just add the line you suggested before the line with “exit 0” and you’re done. After restart you can check to see if values are applied correctly: cat /sys/devices/system/cpu/cpu0/cpufreq/phc_vids

  18. Great thanks! I do wonder what happens if Ubuntu releases a new kernel? Will this phc-kernel be overwritten, or will newer kernel be auto downloaded from the phc-project?

  19. Great article, followed it on Ubuntu 9.10 and finished without any problems.

    I do have a question:
    My first VID went all the way down to zero without crashing, the script came back and said it didn’t trust this, and set it back to default value.

    Values are: 45 23 4 4 4

    My assumption is that because it is still the default value I won’t experience any benefits under full load (2.00GHz). Is it safe to manually set this to a lower value in “rc.local”? Or is there something I don’t know about and I’m better off just leaving it alone?

  20. Hello.
    I made the script that way because:
    If you do cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies and check you will see that the first frequency is not 2000000. It is a little higher. In my case, a 2.4Ghz CPU my first one is 2401000 instead of 2400000. I do not know why this happens on some CPU’s but if this happens it means that the first frequency does not count as the cpu completely ignores the 45 value in your case. Only the second one is correct. By those values, undervolting went perfectly when in full load. For the other values the CPU will not use 4, will use higher values, maybe 15 which is the hardware limit but it does not matter, will use the minimum available. So instead of 45 you could insert any value since it is completely ignored anyway.

    I made this extra case to the script because since this happens on some cpu’s, when the script starts with the second value will start from the last previous value which would crash your pc instantly (would mean 4 instead of 23)

  21. That makes sense, I noticed how it was taking the last number tested. Also my frequencies are:

    2001000 2000000 1600000 1200000 800000

    Just like you said, so I’ll just leave it alone. How do you find out the actual hardware limit? Would that just be something on a chips spec sheet from Intel?

  22. Actually the chip is locked and even if you say use 0 or 4 he will say ok and use the limit he was locked with by intel. That is why the last numbers go down to 0. The CPU says ok, I have 0 now despite the fact he actual has other value…

  23. I followed your instructions, but your bash-script also stops at zero.
    I think my chip is locked at 17, so every value below 17 is not accepted and treated as 17. So is there a way to handle this the correct way? Under Windows with RMClock I always had temperatures at about 30°C, but under Linux with phc it is at ~55°C…
    help please =(

  24. until it finishes all the values you have to keep restarting the script to continue with the next one.

  25. Yes, I’ve done this, every value is at zero.
    Even if I put these values into my rc.local, my computer doesn’t freeze.
    So I think there is a problem with phc…
    Entering “uname -a” shows me, that I already have the phc kernel and intel-phc is running too. I have an Intel Core 2 Duo T6600 running Ubuntu 10.04 lucid.

    Is there maybe another way to undervolt? I could not believe, that under windows it’s always 30°C, but under Linux it’s constantly at 50°C.
    Thanks for your help!

  26. I tried doing this .. and after unpacking the module and doing the cat it can’t find the phc_default_vids file am i doing something wrong? it doesn’t seem to be unpacking properly since the files aren’t there

  27. Managed to shave off 10°C on my maximum temperature at full speed! Nice. 🙂

    P.S.: My CPU is a Pentium M 1.6 GHz (it’s a Dothan, if my memory does not fail me), and the values I got are: 18 14 10 6 4 4.

  28. nothing on Samsung N220 with Atom N410, also with VID 0,0,0…..
    Same performance, same battery life….is supported this cpu?

  29. product: Intel(R) Core(TM)2 Duo CPU P7350 @ 2.00GHz

    Energy use of the laptop diminishes with 12% under full load.

    CPU has a hardware limit to undervolting, during testing no instability.

    normal: 34 23 17
    advised by the script: 34 4 4
    used: 4 4 4

    (The testing script advises the first value normal, but this is not correct, there is actually a gain when it is set to 4, or the hardware limit of the processor)

  30. ok slightly confused by the numbers used 🙂

    On windows I’ve used a program to do this, and I know that all 7 “steppings” of my CPU run quite happily and completely stable at 0.9500v.

    Any idea how to translate that voltage into the numbers this module uses?

  31. Thanks for this great article and script! The loud fan noise was actually the only remaining problem with my 5 years old Sony Vaio VGN-S5HP laptop with Pentium M-740 Centrino CPU (1,73 GHz). Now the machine is noticeably queiter, just like under WinXP using NHC. The undervolting is very significant e.g. @1.73GHz from 1,34V down to under 900mV.

    Thank you very much again!

    One Question though:
    What happens if Ubuntu releases new kernel? Will the new version of PHC kernel automatically downloaded too? Or do I need to download and install it manually again?

  32. Anyway my VIDs are:
    Original: 41 32 25 18
    Tweaked: 18 10 6 4

  33. Thank you so much for this tutorial, I was searching for something like this for ages. Kudos! 🙂

  34. Merci for the step-by-step howto and the esp. the script to determine the values to choose. My note on this:

    With the Intel(R) Pentium(R) M processor 1600MHz (output of /proc/cpuinfo) I had to add not four but six to the values that caused the system to crash. Now the system seems to be stable; up to that change I experienced sudden system power-offs rather than kernel oops.

  35. Thanks a million!

    My hands are not frying anymore on my laptop.
    HP Pavilion dv1000
    — Intel(R) Pentium(R) M processor 1.60GHz —

    Dropped cpu temp from 69/70 down to 54, according to conky. Gave new life to my old laptop 🙂

    This laptop suffers from the integrated Intel video bug in Lucid, so I was hesitant to roll back the kernel from 2.6.33 to 2.6.32, but it seems to be quite stable. Maybe undervolting helped with the video card crashing issue, who knows. Just know I’m a happy penguin once again 🙂

  36. if you get “sudo make prepare
    ./ line 10: patch: command not found
    make: *** [prepare] Error 127” run ‘sudo apt-get install patch’ or just install it from synaptic

  37. Guys, they have a nice GUI to set the voltages. It`s written in python (usually you have it) and called “PHCTool” see and here is the AMD patch:
    I`ve patched for AMD, then modified the file with my (AMD) CPU model and voila :). It worked.

  38. Thanks for the How-To!

    On my SU9600 the script goes down to 0 and the terminal closes. When i start the script again the values are the same as default (27 17 15 13). Seems like i have fake values – how do i check which are the lowest “true” values?


  39. I cannot get to undervolt module installed properly. I’ve followed all the directions in step 3 but when call cat: I get a “No such file or directory” error. When I try to navigate to /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids the further folder that exists is cpu0. I do have a cpufreq folder but it is located at cpu/cpufreq.

    Here is the output of step 3:

    me@Asgard:~/Desktop/phc-intel-0.3.2-10$ make prepare
    patching file phc-intel.c
    me@Asgard:~/Desktop/phc-intel-0.3.2-10$ make
    make -C /lib/modules/`uname -r`/build SUBDIRS=/home/me/Desktop/phc-intel-0.3.2-10 modules
    make[1]: Entering directory `/usr/src/linux-headers-2.6.32-24-generic-phc’
    CC [M] /home/me/Desktop/phc-intel-0.3.2-10/phc-intel.o
    Building modules, stage 2.
    MODPOST 1 modules
    CC /home/me/Desktop/phc-intel-0.3.2-10/phc-intel.mod.o
    LD [M] /home/me/Desktop/phc-intel-0.3.2-10/phc-intel.ko
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-24-generic-phc’
    me@Asgard:~/Desktop/phc-intel-0.3.2-10$ sudo make install
    install -m 644 -o root -g root phc-intel.modprobe /etc/modprobe.d/phc-intel.conf
    mkdir -p /lib/modules/
    install -m 644 -o root -g root phc-intel.ko /lib/modules/
    depmod -a
    me@Asgard:~/Desktop/phc-intel-0.3.2-10$ cat /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids
    cat: /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids: No such file or directory

  40. you have to load the installed module or restart the system to load it for you.

  41. Some advice regarding the true values? Thanks!

  42. I’ve rebooted and still have the problem. I then figured out how to manually unload and load the new module but got the “Device or resource busy” error.

    me@Asgard:~/Documents/phc-intel$ sudo modprobe -r acpi-cpufreq
    me@Asgard:~/Documents/phc-intel$ sudo modprobe phc-intel
    FATAL: Error inserting phc_intel (/lib/modules/2.6.32-24-generic-phc/extra/phc-intel.ko): Device or resource busy

    I’ve ran through the instructions a few times and reinstalled the individual components but to no luck yet

  43. sorry im a bit of a noob to linux how do i download the scrip and run it?

  44. my voltage for cpu 1 resets after i put my computer in hibernation whats that about

  45. Does anyone know how I can change the 4 steps above critical value to 3 or 2 steps above critical value?

  46. alhamdulillah…
    it works..
    From 87 C to 75 C is owesome of full load!
    Thx man..
    Great article
    Great man
    Great community

  47. Thanks a lot for this tutorial! Just one question: Will this work the same way under kubuntu?

  48. cpuburn showed that my CPU (P7350) can run with VIDs 0 0 0 (2.0GHz, 1.6GHz, 800MHz), as minimum real VID is 17 (972mV).

    then again, mprime (prime95) quickly showed that it’s impossible for CPU to be stable with anything lower then VID 20 under full load.

    so, after setting VIDs with this great script, check stability running mprime.

  49. If you get “Device or resource busy” on “sudo modprobe phc-intel” remove acpi_cpufreq with “sudo rmmod acpi_cpufreq” and retry “sudo modprobe phc-intel”

  50. This is great news!
    Thanks to you I finally had enough courage to try undervolting in Ubuntu. I already used it under Windows and as my notebook got noisier with every month I finally googled again and found this text. Great work!

    I would like to write an article based on yours, or better said a translation enriched with my personal experience, for a German blog on Ubuntu&Co: It’s not my own but it has lots of readers in the German Ubuntosphere.


Leave a comment