Pages

Monday, March 12, 2012

CPU Undervolting with Ubuntu 11.10

Hi guys,

PHC stands for Processor Hardware Control and, as it's easy to understand, it allows users to customize some features of CPU control in a linux environment, as undervolting.




So what do we need? An Ubuntu (or Debian) box, usually undervolting is useful on laptops: it enhance battery duration and reduces the heat production. You will also need some time and patience, ;]
  1. You will need a kernel patch and a particular CPU driver so that the hardware control will be possible. First let's add the repo:
    sudo add-apt-repository ppa:linux-phc/ppa
    sudo add-apt-repository ppa:linux-phc/testing
    sudo apt-get update
  2. Now let's install the kernel and its headers:
    sudo apt-get install linux-generic-phc linux-headers-generic-phc
    First pause... restart your PC and be sure to choose your new *-phc kernel.
  3. As we will need to compile some stuff some Ubuntu users might need
    sudo apt-get install gtk2-engines-pixbuf python-gtk2-dev  build-essential
    And then:
    sudo apt-get install dkms debhelper
    Before doing anything else we have to create an empty file to match dmks autoconfiguration: Intel users go with the first, AMD with the second line!
    sudo sh -c 'echo >> /etc/modprobe.d/phc-intel.conf'
    sudo sh -c 'echo >> /etc/modprobe.d/phc-k8.conf'
  4. Now you have to download the driver, choose it looking at your CPU: there are two choices AMD and Intel, be sure to take the right one.
  5. Unpack the package to a temporary folder. Open a terminal and move there:
    cd **your_path**
    Intel users can generate a debian package:
    make dkms_mkdeb
    And install the resulting .deb package:
    sudo dpkg -i phc-intel-dkms_0.3.2_all.deb
    While AMD can't generate it, so:
    sudo make dmks_install
    Now you have your driver ready to go!
  6. So we will unload the old driver:
    sudo modprobe -r acpi-cpufreq
    Once you're done load the new one, amd users will have the second line, intel the first!
    sudo modprobe phc-intel
    sudo modprobe phc-k8
    If you experience the error: "FATAL: Module acpi_cpufreq is in use." you'll need to:
    sudo sh -c ' echo "\n#blackist required to load phc drivers
    blacklist acpi_cpufreq
    blacklist cpufreq_stats" >> /etc/modprobe.d/blacklist.conf'
    sudo sh -c ' echo "modprobe ##your module##" >> /etc/modules'
    And REBOOT =_= ...
  7. Now I guess you want a cool GUI to easier setting VIDs: get it here. Unpack it to a non temporary folder and move there.
  8. You'll need to fix an error, so download this corrected file and save it to:
    **your path**/phctool/inc/libs/
    overwriting the existent file.
  9. From the main phctool folder run:
    sudo ./install.sh
  10. Follow the instruction (both yes will be OK)
  11. Create a new program link in the menu with "Main Menu" to the command /**your_path**/pchtool.sh
  12. done!
After this installation procedure try to launch
sudo phctool
there you can set the voltages and see many infos about your CPU. If it happens that you can't refresh the actual values install msr-tools and run it with:
sudo apt-get install msr-tools
sudo modprobe msr
The correct undervoltedvalues are not universal, so you'll need some testing. If you think you'll need a guide, then take a look here:

http://linuxsolver.blogspot.com/2011/10/how-to-set-cpu-voltage.html


Cheers!

    14 comments:

    1. Hello,

      i made it to step 6 so far. but if i try to load phc-intel i get an error: "FATAL: Error inserting phc_intel (/lib/modules/3.0.0-17-generic-phc/updates/dkms/phc-intel.ko): Device or resource busy"

      i use ubuntu 11.10 on my esprimo v5535 with C2D CPU T7250.

      please help me.

      sincerly
      johnson

      ReplyDelete
      Replies
      1. Have you rebooted so far? Maybe a simple reboot will do it... let me know if it doesn't

        Delete
      2. yes i have but i still get this error.

        Delete
      3. ok, can you paste the output of "uname -a"?

        Delete
    2. I'm a total noob to the whole linux world. usung linux for the first time today and decided to undervolt cause i think the laptop is getting too heated...

      Anyways, great guide... But i'm kinda left clueless at step 11.
      What do you mean by creating program links to menu?

      ReplyDelete
      Replies
      1. Amoung the other stuff in the program list you should find something like "Main Menu". Once you lauche that you can edit the main menu, and also create a new link to phctool ^_^

        Cheers

        Delete
      2. Thanks a lot man... Undervolting works like a charm... This is a really cool blog you have up here too.

        Delete
    3. Step 9, when trying to exec sudo ./install.sh the bash returns command not found. But the file is definitve there /home/Downloads and I'm in the right directory. I just don't know how to go on. Is it maybe i chose the option to encrypt my personal files?

      ReplyDelete
      Replies
      1. Try with

        sudo sh install.sh

        maybe you don't have running permissions

        Cheers

        Delete
    4. ok, i forgot to load the driver ... now i was able to run install.sh, but when i run (in the right directory) sh phctool.sh oder sudo phctool nothing happens.
      When i run sh phctray.sh it tells me:
      Traceback (most recent call last):
      File "./phctray.py", line 6, in
      import egg.trayicon
      ImportError: No module named egg.trayicon

      ReplyDelete
      Replies
      1. It might be a problem of symlink. Try to launch it from your installation folder.

        Cheers

        Delete
    5. Isn't it dangerous to unload acpi-cpufreq totally? After unloading it and using phc, my fan doesnt speed up by high temperatures. PHC definately works, but for example the fan only turns uo @ 80°C with phc loaded, but turns up @ 55°C with acpi-cpufreq loaded.

      ReplyDelete
      Replies
      1. No, it shouldn't. AFIK phctool does not change your fan policy nor apci-cpufreq does, so double check your BIOS settings. What do you use to monitor the temperatures?

        Cheers

        Delete