Pages

Sunday, February 20, 2011

Undervolting CPU in Ubuntu


Hi guys,

as for MakeMKV I want to open another tool to Ubuntu users too: PHC. It 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**

    Now we have to generate a debian package (AMD users with newer kernels might find troubles, in case leave a comment):
    make dkms_mkdeb
    And install the resulting .deb package. 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
  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. relogin and make two links to let you launch these programs directly from terminal:
    sudo ln **your path**/phctool.sh /usr/bin/phctool
    sudo ln **your path**/phctray.sh /usr/bin/phctray
  12. done!
After this installation procedure try to launch
sudo phctool
there you can set the voltages and see many infos about your CPU. The correct values are not universal, so you'll need some testing.

UPDATE

I wrote a new guide to tune voltages, take a look here:

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


Cheers!

    127 comments:

    1. Following these set of instructions is the closest I got to getting undervolting to work on my AMD M500 powered laptop to work.

      The phctool instructions work. I can't get the PHC modules to load. Phctool says PHC extensions missing.

      Any help would be appreciated.

      ReplyDelete
    2. This means there's something wrong in kernel or driver... have you installed and booted the patched kernel? Try to issue

      uname -a

      and post the output, the step 5 did work or you've received an error? as you have an AMD this might be possible

      ReplyDelete
    3. nayagan:~$ uname -a
      Linux nayagan 2.6.35-27-generic-phc #48~phc0-Ubuntu SMP Wed Mar 2 00:39:51 UTC 2011 x86_64 GNU/Linux

      That's the output I get.

      Let me try Step 5 again and see if I get any errors. Don't remember getting any.

      ReplyDelete
    4. nayagan:~/phc-k8_v0.4.3$ make prepare
      make: *** No rule to make target `prepare'. Stop.

      nayagan:~/phc-k8_v0.4.3$ make
      make: Nothing to be done for `all'.

      nayagan:~/phc-k8_v0.4.3$ sudo make install
      install -m 644 -o root -g root phc-k8.modprobe /etc/modprobe.d/phc-k8.conf
      mkdir -p /lib/modules/2.6.35.11/updates/kernel/arch/x86/kernel/cpu/cpufreq/
      install -m 644 -o root -g root phc-k8.ko mperf.ko /lib/modules/2.6.35.11/updates/kernel/arch/x86/kernel/cpu/cpufreq/
      depmod 2.6.35.11 -a

      ReplyDelete
    5. everything looks ok, try to issue:
      lsmod

      ReplyDelete
    6. This comment has been removed by a blog administrator.

      ReplyDelete
    7. Why is Step5 making updates to 2.6.35.11 when my current kernel is 2.6.35-27-generic-phc?

      Is that normal?

      ReplyDelete
    8. The module is ok and loaded, the phctool interface loads properly? can you please paste the exact terminal output? The kernel is different because the phc driver it's built against the headers, not the whole kernel so their version is slightly different, but it's ok.

      I'm thinking it's kinda interface trouble or your cpu it's not fully supported

      ReplyDelete
    9. The phctool loads properly. But I can't change any of the voltages etc.

      Which terminal output would you like me to post? Step 6?

      ReplyDelete
    10. I thought it didn't load, forget about it. It looks like (but I'm not 100% sure) your cpu is not yet supported. Maybe you can try with a beta from phc forum, if you don't find nothing try to open an help thread here

      http://www.linux-phc.org/forum/

      Sorry but I think we've done both our best ^_^"

      ReplyDelete
    11. Name: AMD Turion(tm) II Dual-Core Mobile M500
      CPU MOdel: Vendor:AuthenticAMD, Family:16, Model:6, Stepping:2
      Frequencies: 2200Mhz 2000Mhz 1500Mhz 1100Mhz 800Mhz
      Throttling: not available
      PHC extensions: missing
      PHC Version
      MSR extensions: not available
      Vcc calculation: CPU not recognized - calculation not available

      The above is under info. Voltages and Throttling show nothing. Analysis shows n/a for each processor.

      ReplyDelete
    12. Oh. Darn. Thanks a lot for helping. Your instructions were the easiest to follow.

      I couldn't get it to work in Windows before either. I think Toshiba locked the voltages. But I'm holding out hope that I can get it working in linux because the temps range from 65-90. And once it hits 90 it reboots.

      ReplyDelete
    13. It seems to confirm this cpu it's not supported... try with this driver

      http://www.linux-phc.org/forum/download/file.php?id=111

      but it's not sure...

      ReplyDelete
    14. If the temp is so high check your cpufan!!! It should not rise so much!

      ReplyDelete
    15. I tried 4.4a2 with the same result. Not supported.


      I will give TurionPowerControl a shot and if that doesn't work live with the overheating.

      The fan does get quite loud so I know that it is working.

      ReplyDelete
    16. Double check everything, heatsink, thermal compound etc, it should not reach such temps in any case...

      ReplyDelete
    17. I got in contact with the AMD driver developer for the PHC project, please answer back, he needs your help to test a new version supporting your processor too!

      ReplyDelete
    18. I have strange problem. PHCTool runs with no problems, reports all is available, but does not apply VID-s. Nothing changes when I click "save values". Any clues?

      ReplyDelete
    19. Do you mean you see always the same VIDs in the analysis tab? Keep in mind that not all the VIDs are actually applicable by the motherboard (for instance I can set from 9 to 43 but it won't go below 15). If what happens is that VIDs remain stuck at their default values, be sure to have correct rights (try to launch "sudo phctool") and be sure to check all the available frequency steps.

      BTW with which CPU are you having troubles?

      ReplyDelete
    20. Hey,
      I tried you're method with 11.04, and everything went perfect; However, nothing happens when I enter "sudo phctool"

      What should I do?

      ReplyDelete
    21. Hi,sorry I am new to ubuntu terminal tweaking and every guide I've seen says step 5.. but what am I supposed to type there? I have no clue. The directory that the extracted folder is in is

      /home/sunil/Downloads/phc-intel-pack-rev1

      I've tried different things but can't get anything to give me a good result.

      uname -a gives this;
      Linux sunil-3000-N200 2.6.35-28-generic-phc #50~phc0-Ubuntu SMP Thu Apr 21 10:44:36 UTC 2011 i686 GNU/Linux

      Could you type what I'd need to for step 5 please.

      Thanks for the guide and any help is much appreciated.

      Sunil.

      ReplyDelete
    22. I don't understand what you mean...

      "but what am I supposed to type there?" there... where?

      if you want to know how to move to that folder you just need to:

      cd /home/sunil/Downloads/phc-intel-pack-rev1

      if I'm missing something please explain better where is the point in step 5

      ReplyDelete
    23. Ye that was it. I didn't know about the CD thing, thanks. Ran into a problem on step 6 though.

      ~$ sudo modprobe -r acpi-cpufreq
      FATAL: Module acpi_cpufreq is in use.
      FATAL: Error running remove command for acpi_cpufreq

      Sunil.

      ReplyDelete
    24. You're not the first complaining about that behaviour... I believe you have the right kernel (looking at the uname output) but for no reason your acpi-cpufreq seems to be still built-in kernel.

      Can we try a reboot?

      ReplyDelete
    25. Thanks that did the trick. Worked my way to step 11 but not sure what to do there.
      Sorry for the hassle, I have't done much terminal work in ubuntu yet so figuring things out still. Lol but would prefer my laptop to stop burning me :P.

      Sunil

      ReplyDelete
    26. Ok, I'm going to fix the guide with the two suggestions. At step 11 the two codelines are already there, the only thing to modify is **your_path** wich should be /home/sunil/Downloads/phc-intel-pack-rev1

      we're almost done ^_^

      (consider some sponsor support >_>)

      ReplyDelete
    27. :( done it all, running phctool but it doesn't affect anything I think, the temperature stays the same so pretty sure there is no change. I like how you edited the guide a bit to make it more idiot proof :D

      Sunil.

      ReplyDelete
    28. Hi, I have an AMD turion cpu and I tried to download build-essential on ubuntu 11.04 and it said it was up to date. So I can't do steps 4-6. I continued on but when i run "sudo phctool" nothing happens. I don't get any errors.

      ReplyDelete
    29. Hi, I have AMD Turion X2 TL-56 and in step 5. after 'make prepare' I get:
      'make: *** Brak reguł do wykonania obiektu `prepare'. Stop.'
      It means more or less 'make: *** There are no rules to make the object 'prepare'. Stop.'

      I skept it and went to next steps, but in step 6. after 'sudo modprobe phc-k8' I got
      'FATAL: Error inserting phc_k8 (/lib/modules/2.6.38-10-generic/updates/kernel/arch/x86/kernel/cpu/cpufreq/phc-k8.ko): Invalid module format'

      ReplyDelete
    30. the same on step 6 though.

      ~$ sudo modprobe -r acpi-cpufreq
      FATAL: Module acpi_cpufreq is in use.
      FATAL: Error running remove command for acpi_cpufreq

      I had reboot the machine. the next step are
      sudo modprobe phc-intel
      FATAL: Error inserting phc_intel (/lib/modules/2.6.38-10-generic/extra/phc-intel.ko): Device or resource busy
      thanks

      ReplyDelete
    31. can I use PHC in 3.0.1 kernel?
      Give me advise please ?

      ReplyDelete
    32. @ Andrew
      I can't figure out where the problem stands... Try to answer these few questions... where did you get the sources? Are you running the command in the right folder? Which distro are you running?

      @ Stefan
      After the reboot you simply run "sudo modprobe phc-intel", when you were supposed to "sudo modprobe -r acpi-cpufreq" and then "sudo modprobe phc-intel"

      @ Anonyous
      AFAIK the latest supported kernel is 3.0, be patient and stay tuned for further kernels releases

      ReplyDelete
    33. sudo modprobe phc-intel
      FATAL: Error inserting phc_intel (/lib/modules/2.6.38-10-generic/extra/phc-intel.ko): Device or resource busy
      sudo modprobe -r acpi-cpufreq
      FATAL: Module cpufreq_stats is builtin
      FATAL: Error running remove command for acpi_cpufreq
      ?

      ReplyDelete
    34. The patched kernel stands to avoid that issue, so you might be running the plain kernel... try to issue "uname -a" to check it ^_^

      ReplyDelete
    35. uname -a
      Linux Generator 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
      thanks

      ReplyDelete
    36. In Ubuntu 11.04, the 2nd step does not work. I am running ubuntu 11.04 and when i tried to install the linux-phc package I got the following. Would you please help?

      lastdylan@ubuntu:~$ sudo apt-get install linux-generic-phc linux-headers-generic-phc
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      Some packages could not be installed. This may mean that you have
      requested an impossible situation or if you are using the unstable
      distribution that some required packages have not yet been created
      or been moved out of Incoming.
      The following information may help to resolve the situation:

      The following packages have unmet dependencies:
      linux-generic-phc : Depends: linux-image-generic-phc (= 2.6.38.8.22~phc0) but it is not going to be installed
      E: Broken packages

      ReplyDelete
    37. @Last Feremenga
      It looks like you are missing some dependencies, if the behaviour shows in any 11.04 installation I'm going to update the guide. I think you might solve just issuing:

      sudo apt-get install linux-generic-phc linux-headers-generic-phc linux-image-generic-phc

      Cheers

      ReplyDelete
    38. I followed your advice regarding sudo 'modprobe -r acpi-cpufreq' and restated a bunch of times without any result.

      I ran lsmod command and discovered that the module mperf was using acpi-cpufreq. I tried blacklisting mperf with no success, but then I tried disabling several performance services in BIOS (Multi-Core Support, Dynamic Acceleration and Speedstep). After rebooting mperf was no longer using acpi-cpufreq and I could modprobe it. So far so good.

      M1330 / 2.6.28

      ReplyDelete
    39. can't get it to work with the last line from the terminal.. i got it successfully but whenever i'm goin to run the tool it's just tells nothing..

      ReplyDelete
    40. @ p0dde
      Can you now see the phc driver among the output of lsmod? Hope so ^_^

      @ stratocaster
      Do you mean you have no output when issuing "sudo phctool"?

      ReplyDelete
    41. hi there,

      i followed your guide step by step and did not encounter any obstacles (no error messages etc.). until ..

      when i type "sudo phctool" nothing happens (i.e. no output in the terminal).

      "lsmod | grep acpi_cpufreq" also gives no output at all (so i guess i did not install anything afterall or is my cpu not supported (its quite old)?)

      thx

      ReplyDelete
    42. @Anonymous

      It does not mean your cpu is not supported. Try to look for the phc driver in lsmod output. If it does not you haven't installed anything... As you may have seen a reboot may do the deal...

      cheers

      ReplyDelete
    43. hi,

      thanks for your reply.
      lsmod yields:

      phc_intel 18278 1
      mperf 12667 1 phc_intel
      cpufreq_stats 13257 0

      I did/had to reboot in step 6.
      Still no luck.

      Tom

      ReplyDelete
    44. Ok, so it seems you have the driver installed, the issue stands in the GUI. Try to launch the GUI from your path as:

      sudo sh **yourpath**/phctool.sh

      and let's see if we can get an output at least...

      ReplyDelete
    45. hi,

      it works! Somehow I didn't manage to set the link, however I can start it from **mypath**.

      Sorry for bothering you cause I was to stupid to try it without the link.
      Thanks a lot.

      Tom

      ReplyDelete
    46. hi,

      so i tried following your guide and when i get to sudo phctool it says:command not found.

      I tried running it (./phctool.sh) from the **mypath** directory and a new tab appeared on my bar but after 5 seconds it disappeared.

      I tried doing sudo sh **mypath**/phctool.sh and I got this as a message.

      File "./phctool.py", line 468, in
      app=appgui()
      File "./phctool.py", line 83, in __init__
      self.throttling=throttling.throttlecontrol(self.cpuinfo.data)
      File "inc/libs/throttling.py", line 16, in __init__
      self._cpus_have_interface() ##check which CPU has a trottling interface
      File "inc/libs/throttling.py", line 23, in _cpus_have_interface
      if os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/throttling') & os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/limit'):
      KeyError: 'acpiname'

      What did I do wrong and how can i correct this?
      Thanks in advanced

      ReplyDelete
    47. @ Daniel

      Something's wrong at step 8, try to download the patch once again and overwrite the existing file.

      ReplyDelete
    48. Hi, I have i5-540m which in Windows downscales from 2.4GHz to 600MHz, but in Ubuntu only down to 1200MHz. Have you seen such cases before, any idea where to dig? cpufreq shows min frequency as 1199000

      ReplyDelete
    49. @ Pavel

      Actually you're the first complaining about that. I looked around and found this:

      http://download.intel.com/design/processor/datashts/322812.pdf

      at page 55 you can see that the lowest clock available physically for your CPU is 1.2GHz (as your CPU is 540M -> SV table). This means that linux rocks (as always) and shows you the truth, while windoze, I believe, halves the CPU clock as it is shared by two thread for each physical core... which actually does not make any sense, but who knows what comes from Redmond?

      Cheers

      ReplyDelete
    50. Hi,

      I managed to get everything except the hard links part. I keep getting this error


      justin@justin-laptop:~$ sudo ln /home/justin/tool/phctray.sh /usr/bin/phctray
      ln: creating hard link `/usr/bin/phctray' => `/home/justin/tool/phctray.sh': Invalid cross-device link


      Could you help me with this?

      ReplyDelete
    51. @QM ASEAN

      It might mean you are linking over two phisical different devices, try with "sudo ln -s"...

      Anyway the only thing you're missing is the capability to launch phctool just writing the command in the term: if you right ./home/justin/tool/phctool it will launch anyway

      ReplyDelete
    52. Hi Docet,

      Thank you very very much!

      Anyway just to update you that I had to install "gtk2-engines-pixbuf" as I got an error (Unable to locate theme engine in module_path: "pixmap") as well.

      I run Ubuntu 11.10 x64 bit. But after a bit of fiddling with it it works now!

      ReplyDelete
    53. Thanks for your report, I added it to the guide ^_^

      ReplyDelete
    54. After 'Makefile:37: *** Only support for 2.6 series kernels. Schluss.' noting happens. What might be the Problem? AFAIK i should habe the newest patch with intel-0.3.2-12-1

      Im Using a Lenovo T61 with latest Ubuntu 11.10

      ReplyDelete
    55. Well, after I've reread the article I came to step 6. I can't remove the current driver because it's used (as you say) so I rebooted via 'sudo reboot' but I neither can't unload the old driver (it's still in use) nor 'insert' the new one (device or resource busy).

      Any ideas?

      Thanks in Advance...

      ReplyDelete
    56. This comment has been removed by a blog administrator.

      ReplyDelete
    57. This comment has been removed by a blog administrator.

      ReplyDelete
    58. This comment has been removed by a blog administrator.

      ReplyDelete
    59. This comment has been removed by a blog administrator.

      ReplyDelete
    60. Ciao, ho seguito la tua guida e al momento di caricare il driver con

      sudo modprobe phc-intel

      mi esce il seguente errore

      FATAL: Error inserting phc_intel (/lib/modules/3.0.0-14-generic-phc/updates/dkms/phc-intel.ko): Device or resource busy

      qualche consiglio?

      PS: al comando

      make dkms_mkdeb

      mi dava errore. ho risolto installando il pacchetto dh-make con

      sudo apt-get install make dkms_mkdeb

      ReplyDelete
    61. This comment has been removed by the author.

      ReplyDelete
    62. Hi,
      I am getting this as well:

      sudo sh ./phctool.sh
      Traceback (most recent call last):
      File "./phctool.py", line 468, in
      app=appgui()
      File "./phctool.py", line 83, in __init__
      self.throttling=throttling.throttlecontrol(self.cpuinfo.data)
      File "inc/libs/throttling.py", line 16, in __init__
      self._cpus_have_interface() ##check which CPU has a trottling interface
      File "inc/libs/throttling.py", line 23, in _cpus_have_interface
      if os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/throttling') & os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/limit'):
      KeyError: 'acpiname'

      I checked 4 times and I copied the patched file at step 8.
      The same happens with phctray, but I can see the icon in the tray, it just throws that at startup and each time I push it.
      I am on 11.10 with gnome-shell, if it can help.

      ReplyDelete
    63. ok, then my problem was I couldn't compile the .deb file with

      make dkms_mkdeb

      and I solved it installing the dkms_mkdeb package with

      sudo apt-get install dkms_mkdeb

      Now I can't load the drivers with

      sudo modprobe phc-intel

      and the output error was

      FATAL: Error inserting phc_intel (/lib/modules/3.0.0-14-generic-phc/updates/dkms/phc-intel.ko): Device or resource busy

      If I understand correctly, to resolve it I need to do

      blacklist acpi_cpufreq cpufreq_stats

      and after add in /etc/modules with

      sudo gedit /etc/modules

      the string "phc-intel" in any location of the file.
      Is that correct? I aspect of your confirmation before proceeding. =)

      PS. I read your blog. Congratulations I really liked it

      ReplyDelete
      Replies
      1. Based on Step 5 on this blog, what is the difference between "make dkms_mkdeb" and "sudo apt-get install dkms_mkdeb"?

        Delete
    64. This comment has been removed by the author.

      ReplyDelete
    65. ok the problem seems to be solved. I finish to follow your guide but at the end, when I launch

      sudo phctool

      what should happen? because no windows is open.

      ReplyDelete
    66. I guess you messed up with the step 11... A GUI should open as it happens when you go to the path and run

      sh phctool.sh

      in term.

      Thanks for your help, I'm not running an Ubuntu box but a Gentoo one, so fixing those issues without any help would have been a pain.

      Cheers

      ReplyDelete
    67. I tried

      sh **my path**/phctool.sh

      and it works. I removed my old links and recreate them: I thought I had the wrong link because when I was in the directory /*mypath*/phctool I simply made

      ln phctool.sh /usr/bin/phctray

      it was wrong, wasn't it?
      So I recreate the link using the "long form" but it still doesn't work.

      ReplyDelete
    68. Solved, in a very stupid way. I created a new .sh file in whice I wrote only the path

      **my_path**/phctool.sh

      I made it executable with

      chmod +x new_file.sh

      and I used it for the link with

      ln /**my_new_file_path**/new_file.sh /usr/bin/phctool

      In this way it works. I'm unable to undestand why the normal link doesn't work. I think it's a unity problem.

      Now, two final questions:
      1) "Update Manager" (in italiano si chiama "gestore aggiornamenti") ask me to install the new kernel. I guess that if I install it, then I unable to change the CPU voltage. So, how can I disable the request of installing the new kernel? My fear is that thoughtfully I can upgrade all, forgetting to disable the kernel upgrade, and that might happen to other users.
      2) I'm using a netbook Samsung N145P with ubuntu 11.10.
      Is gentoo lighter than Ubuntu? Looking at the hardware requirements, seems don't change so much.

      ReplyDelete
    69. I got some feedback from developers and this is how it should go, no need to blacklist or manual edit conf

      if you run a phc kernel you should not need the mainstream kernel. Just to be sure you can block the mainstream kernel updates and follow just the phc one.

      Gentoo is a radically different distro... take a look here http://linuxsolver.blogspot.com/2010/09/g-for-gentoo.html

      ReplyDelete
    70. Hi fabio, I am trying to undervolt my laptop & using your post as guidance

      I am using Ubuntu 10.10 Kernel 2.6.35.31-generic
      Processor Intel Core2Duo T6600@2.2GHz

      Here we go,
      Step 1. No problem
      Step 2. done & restart the machine
      I get this from uname
      uname -a
      Linux lennyG430 2.6.35-31-generic-phc #63~phc0-Ubuntu SMP Fri Dec 9 05:18:22 UTC 2011 i686 GNU/Linux

      Step 3. there is no dkms-mkdeb in my maverick repository, so I've change it to
      sudo apt-get install build-essential dkms
      done
      & then, this command
      sudo sh -c 'echo >> /etc/modprobe.d/phc-intel.conf'
      done

      Step 4. Get the phc-intel-pack-rev4.tar.bz2 done,
      extracted to $HOME/phc/phc-intel-pack-rev4

      Step 5. Not quite sure which folder **your_path** means
      what I do,
      cd /phc/phc-intel-pack-rev4
      then
      make dkms_mkdeb

      Here what I got:

      Creating symlink /home/raafi/phc/phc-intel-pack-rev4/.dkms/phc-intel/0.3.2/source ->
      /home/raafi/phc/phc-intel-pack-rev4/.dkms//usr/src//phc-intel-0.3.2

      DKMS: add Completed.
      Using /etc/dkms/template-dkms-mkdeb
      copying template...
      modifying debian/changelog...
      modifying debian/compat...
      modifying debian/control...
      modifying debian/copyright...
      modifying debian/dirs...
      modifying debian/postinst...
      modifying debian/prerm...
      modifying debian/README.Debian...
      modifying debian/rules...
      copying legacy postinstall template...
      Copying source tree...
      Building binary package... dpkg-source --before-build phc-intel-dkms-0.3.2
      fakeroot debian/rules clean
      make[1]: dh_testdir: Command not found
      make[1]: *** [clean] Error 127
      dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2
      (bad exit status: 2)

      Error! There was a problem creating your deb.
      make: *** [dkms_mkdeb] Error 7

      Got stuck there. I am not quite familiar with creating kernel module, so will you please help me?
      Am I missing/forget something?
      what I did do wrong?

      -Raafi-

      ReplyDelete
      Replies
      1. **your_path** is the temporary folder you are supposed to create in step 5. the most common place might be just

        /home/[your_user]/phc/

        that might solve the issue.

        Delete
      2. This comment has been removed by the author.

        Delete
      3. in my case actually there is some package need to be installed
        which is 'debhelper'

        the hint is in this line error

        make[1]: dh_testdir: Command not found

        I got this from http://ubuntuforums.org/showthread.php?t=607797&page=3 post #25

        then when I re-do the step 5. It's done with no error & I get the .deb package

        Install the .deb package by double-click it in nautilus...done

        If I go directly to step 6 then got some error

        $ sudo modprobe -r acpi-cpufreq
        FATAL: Module acpi_cpufreq is in use.
        FATAL: Error running remove command for acpi_cpufreq

        So you should restart the machine, between step 5 & step 6
        (cmiiw, this need to be done because we are installing & removing kernel module aren't we)
        then step 6 will finished gracefully

        step 7 downloading the phctool
        put it & extracted on

        /home/raafi/phctool

        then the full path become

        /home/raafi/phctool/0.5.2-2/phctool/

        step 8 download the patch done
        get the file 'cpuinfo.tar.bz2'
        extract it, filename inside actually 'cpuinfo.py'
        patch it (move and replace) to

        /home/raafi/phctool/0.5.2-2/phctool/inc/libs/

        done

        step 9
        main phc folder in my case is

        /home/raafi/phctool/0.5.2-2/phctool/

        then

        sudo ./install.sh
        done

        step 10
        something like this:
        need to create group (answer with y then enter)
        need to create sudo permission (answer with y then enter)

        done

        step 11 LOG OUT then LOG IN
        done

        then
        create hardlink
        for phc tool
        sudo ln /home/raafi/phctool/0.5.2-2/phctool/phctool.sh usr/bin/phctool

        for phctray
        sudo ln /home/raafi/phctool/0.5.2-2/phctool/phctray.sh usr/bin/phctray

        done

        step 12
        when I try

        sudo phctool

        nothing happens

        but if I run the script directly from the folder
        (/home/raafi/phctool/0.5.2-2)
        then
        sudo ./phctool.sh

        then It runs well & the GUI shows up
        maybe something missing with the command in step 11?
        I don't really know, cause I am not quite familiar with hardlinking command anyway.

        But anyway. It works!
        Thank you fabio for your guide

        Delete
    71. Hello Fabio,

      Udervolting is my best subject and I appreciate you sharing with us meaningful topics. Since I am still a Ubuntu 11.10 Linux newbie, I got a few to ask:

      1) In Step 2, "First pause... restart your PC and be sure to choose your new *-phc kernel." What do you mean by choose your new *-phc kernel?

      2) 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. Again, what do you mean by "move there"?

      My system:
      Pavilion dv2210us
      AMD Turion 64 X2 1.6Ghz TL-52
      2GB DDR2 RAMs
      nVidia Geforce Go 6150
      160GB WD 5400RPM

      Thanks,
      Cason

      ReplyDelete
      Replies
      1. Glad to help newbies ^_^

        1) the * in informatics (and maybe in other fields) but at least surely here means "whatever".. you can read the output of Raafi, jright before your comment: "... 2.6.35-31-generic-phc ..." that's a *-phc kernel. Just run in terminal "uname -a" and make sure you have something like that... if you don't we can manage it.

        2) "move there" means: open a terminal and "cd [that folder]"

        If you need further help just ask

        Cheers

        Delete
    72. Yeah, the Italians are always helpful. ^.^

      Alright, here goes error for Step 1:

      cason@Casonade:~$ sudo add-apt-repository ppa:linux-phc/ppa ppa:linux-phc/testing
      [sudo] password for cason:
      Error: need a repository as argument
      cason@Casonade:~$ ^C
      cason@Casonade:~$

      I tried "sudo -i" command and repeated, still yielded same error.

      Cason

      ReplyDelete
      Replies
      1. My fault ^_^ I've updated the post content.. thanks

        Delete
    73. I followed "Fix for linux-3.x support in phc-k8" to delete the bug but now I get this instead,

      cason@Casonade:~$ cd Downloads
      cason@Casonade:~/Downloads$ cd phc-k8_v0.4.4
      cason@Casonade:~/Downloads/phc-k8_v0.4.4$ make dkms_mkdeb
      make: *** No rule to make target `dkms_mkdeb'. Stop.
      cason@Casonade:~/Downloads/phc-k8_v0.4.4$

      I am stuck in Step 5. Can you help me?

      ReplyDelete
      Replies
      1. I knew that there was the 3.x bug ("AMD users might fid troubles..."), but I think it'll be fixed soon.

        I can't get where the problem is.. try with

        sudo make clean

        and then

        make dkms_mkdeb

        it sounds strange...

        Delete
    74. Thanks for replying. I tried those commands above and still get the same thing. Furthermore, when doing a cold boot, the log in screen is blank. I typed my password blindly, hit enter, waited for the hard drive activity to finish, then put it to sleep mode and resume - only way to access Ubuntu GUI.

      I think it has something to do with the steps prior to Step 5. It's driving me nut...Can we reverse the steps and uninstall?

      ReplyDelete
      Replies
      1. I guess you messed up with something else, no way to do such a disaster 'cause of PHC... did you update your system recently? Try to google around, maybe it's a known issue.

        If you want to undo the phc installation just delete the phc folder (since you did not create nor install the package); then uninstall the *-phc kernel using synaptic and reboot your box.

        Sorry about that...

        Delete
    75. Well, I started using Ubuntu 11.10 about a month now so besides running Update Manager after Clean Installation, I never made anything drastic change to the system. The only major I did was updating my GeForce Go 6150 173 driver to 290.10.

      As far as following your instruction, I made sure of that. I still have a copy of what appeared on the Terminal, saved in a text file.

      Here is the link:
      https://docs.google.com/document/pub?id=1QDBnEphLcnS7VhjQkNreg_ULN-bThrxkqFiyFv4FFqI

      I've had a look and bolded the part which appeared to be some errors. Please have a look and tell me what you think. Thanks!

      ReplyDelete
      Replies
      1. it looks to be the cpu driver loading procedure... the errors refers to drivers tha don't fit your cpu, so nothing strange. Do you still have that issue? try to step back the videocard drivers...

        Delete
    76. to get rid of error message dh_testdir not found - you need to install package debhelper

      I think there in an error in your instructions, dkms_mkdeb is not a valid package for me, and dkms will not install not til you add the gtk2-engines-pixbuf package
      so the lines
      sudo apt-get install build-essential dkms-mkdeb
      sudo apt-get install gtk2-engines-pixbuf

      has to become
      sudo apt-get install gtk2-engines-pixbuf build-essential
      sudo apt-get install dkms debhelper

      ReplyDelete
      Replies
      1. thanks for suggestion, post updated ^_^ Cheers

        Delete
    77. I managed to get to the last step aka run "sudo phctool" but nothing came up. Here is what I did:

      Redo Step 1 - 5: I had to run "sudo make dkms_install" to get it to install (see the BOLD part). the make dkms still resulted same error. Have a look at the Terminal output.
      https://docs.google.com/document/pub?id=1mRHrjWrOrt7apt32SMvgUO6wejZsrGhzecyXoEPg-sI

      Step 6 - 10
      https://docs.google.com/document/pub?id=1DEOXRvoqdq8rGrmjrQrv5fc_1nN3X_6d6D9JdqwOnZI

      Stuck on Step 11
      relogin and make two links to let you launch these programs directly from terminal:
      sudo ln **your path**/phctool.sh /usr/bin/phctool
      sudo ln **your path**/phctray.sh /usr/bin/phctray

      I unzipped the file to Home/Downloads/0.5.2-2/phctool
      so I put:
      sudo ln Downloads/0.5.2-2/phctool/phctool.sh /usr/bin/phctool
      sudo ln Downloads/0.5.2-2/phctool/phctray.sh /usr/bin/phctray

      If this is incorrect, let me know.

      Then tried to run "sudo phctool" and nothing popped up.

      ReplyDelete
      Replies
      1. Maybe you just need a reboot. Try to launch the program with:

        sudo sh Downloads/0.5.2-2/phctool/phctool.sh

        if it runs then try

        sudo sh /usr/bin/phctool

        if this runs too:

        sudo ./usr/bin/phctool

        if this does not run you must change permissions with:

        sudo chmod 755 Downloads/0.5.2-2/phctool/phctool.sh

        Delete
    78. This is what I get after sudo sh Downloads... command:


      cason@Casonade:~$ sudo sh Downloads/0.5.2-2/phctool/phctool.sh
      You need to install pyGTK or GTKv2 or set your PYTHONPATH correctly.
      try: export PYTHONPATH= /usr/local/lib/python2.2/site-packages/
      cason@Casonade:~$

      ReplyDelete
      Replies
      1. The answer it's in the question:
        try: export PYTHONPATH= /usr/local/lib/python2.2/site-packages/

        if it doesn't work try installing pyGTK

        Delete
      2. Same problem here. No matter what. I have pyGTK installed and so on... ubuntu 11.10 here.

        Delete
      3. sorry, solved by installing:
        apt-get install python-gtk2-dev
        Thnks

        Delete
      4. Fabio, could you add this information (apt-get install python-gtk2-dev) to the main entry at the top? I'm on ubuntu 11.10 and I've had the same problem. Having had python-gtk2 installed, I did not recognize what was missing.

        Delete
    79. I see that this problem has already been asked about but I still dont understand.
      I go through the steps fine, use sudo modprobe -r acpi-cpufreq and it doesnt give output, then I use sudo modprobe phc-intel and it gives me this:

      FATAL: Error inserting phc_intel (/lib/modules/3.0.0-15-generic-phc/updates/dkms/phc-intel.ko): Device or resource busy

      how can I make this work? my laptop runs very hot without undervolting and I fixed this in windows but when I switched to linux I cannot figure out how to do it.
      thanks

      ReplyDelete
      Replies
      1. Sorry I forgot to mention that I used uname -a and I am running the phc version

        Delete
      2. Ok, it seems that for some reason there is still some module loaded on cpus... have you tried a reboot? Have you created the empty file in /etc/modprobe.d/phc-intel.conf?

        If the answers are both yes you've just to blacklist a couple of modules (ask me and I'll tell you), don't worry, but this procedure has been discouraged by developers.

        Cheers

        Delete
    80. yes I have rebooted and created the file. So how do I blacklist the modules and which ones?

      ReplyDelete
      Replies
      1. One last attemp before blacklisting... try with

        sudo update-initramfs -u

        if it still does the same just blacklist acpi_cpufreq and cpufreq_stats by adding

        #blackist required to load phc drivers
        blacklist acpi_cpufreq
        blacklist cpufreq_stats

        in /etc/module.d/phc (eventually create it)

        and put phc-intel to /etc/modules

        Cheers

        Delete
    81. I am running ubuntu 11.10 and currently having this error trying to run the GUI:
      richard@richard-laptop:~/Downloads/0.5.2-2/phctool$ sudo sh phctool.sh
      Traceback (most recent call last):
      File "./phctool.py", line 468, in
      app=appgui()
      File "./phctool.py", line 83, in __init__
      self.throttling=throttling.throttlecontrol(self.cpuinfo.data)
      File "inc/libs/throttling.py", line 16, in __init__
      self._cpus_have_interface() ##check which CPU has a trottling interface
      File "inc/libs/throttling.py", line 23, in _cpus_have_interface
      if os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/throttling') & os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/limit'):
      KeyError: 'acpiname'

      Any help would be great.

      ReplyDelete
      Replies
      1. Double check step 8 ^_^

        Cheers

        Delete
      2. Long time no see, man. Been busy with school but now that Spring Break is here, I'm up for a little Linux.
        I'm getting exact error as the person above me. I did double checked Step 8.


        cason@Casonade:~/Downloads/0.5.2-2/phctool$ sudo sh phctool.sh
        Traceback (most recent call last):
        File "./phctool.py", line 468, in
        app=appgui()
        File "./phctool.py", line 83, in __init__
        self.throttling=throttling.throttlecontrol(self.cpuinfo.data)
        File "inc/libs/throttling.py", line 16, in __init__
        self._cpus_have_interface() ##check which CPU has a trottling interface
        File "inc/libs/throttling.py", line 23, in _cpus_have_interface
        if os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/throttling') & os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/limit'):
        KeyError: 'acpiname'
        cason@Casonade:~/Downloads/0.5.2-2/phctool$

        What else, sir?

        Delete
      3. Try with sudo rm ~/Downloads/0.5.2-2/phctool/incs/libs/cpuinfo.pyc

        And try again. If it still does not run paste the output of:
        sudo cat ~/Downloads/0.5.2-2/phctool/incs/libs/cpuinfo.py

        Delete
      4. Same error.

        Output of:
        sudo cat ~/Downloads/0.5.2-2/phctool/incs/libs/cpuinfo.py

        https://docs.google.com/document/pub?id=1ulTR7y3QYC7_rek_i2x1mPQ_M1WQTgmXDp1HRi1kw5c

        Delete
      5. mmm.... really strange... can you please paste the output of:

        ls /proc/acpi/processor/
        ls /sys/devices/system/cpu/

        I think we are close to the point ^_^

        Delete
      6. cason@Casonade:~$ ls /proc/acpi/processor/
        ls: cannot access /proc/acpi/processor/: No such file or directory
        cason@Casonade:~$ ls /sys/devices/system/cpu/
        cpu0 cpufreq kernel_max online present release
        cpu1 cpuidle offline possible probe
        cason@Casonade:~$

        Don't know why the first command turned out that way? Am I missing something?

        Delete
      7. Hello,

        The very same thing happens to me (I'm under Mint 11 / Natty). Installation went all right, driver installed, no error, but running phctool does not work (see below). Like Casonade, the directory or file /proc/acpi/processor/ does not exist.

        What's wrong? Many thanks in advance

        -------------------
        fs@Ligeia ~/phctool $ sudo sh ./phctool.sh
        Traceback (most recent call last):
        File "./phctool.py", line 468, in
        app=appgui()
        File "./phctool.py", line 83, in __init__
        self.throttling=throttling.throttlecontrol(self.cpuinfo.data)
        File "inc/libs/throttling.py", line 16, in __init__
        self._cpus_have_interface() ##check which CPU has a trottling interface
        File "inc/libs/throttling.py", line 23, in _cpus_have_interface
        if os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/throttling') & os.path.exists('/proc/acpi/processor/'+self.cpus[cpu]['acpi']['acpiname']+'/limit'):
        KeyError: 'acpiname'

        Delete
      8. Sorry, I forgot to mention that I'm running a Toshiba R500 with Intel Core2 Duo U7700.
        ls /sys/devices/system/cpu/ gives, like in Casonade's case:
        cpu0 cpufreq kernel_max online present release
        cpu1 cpuidle offline possible probe.
        Thanks for the great tuto anyway.

        Delete
      9. Nothing wrong apparently.. both of you have the newer path.. try to download the new version of cpuinfo.py at step 8, delete both cpuinfo.py and .pyc

        If you have still troubles please paste the output of:
        python -V
        cat /sys/devices/system/cpu/online
        ls /sys/devices/system/cpu/cpu0/

        Delete
      10. Thank you Fabio for the quick reply.
        I reloaded cpuinfo.py from step 8, deleted both .py and .pyc, and got the same result (ending with " KeyError: 'acpiname' ").
        Here is the output:
        fs@Ligeia ~/phctool $ python -V
        Python 2.7.1+
        fs@Ligeia ~/phctool $ cat /sys/devices/system/cpu/online
        0-1
        fs@Ligeia ~/phctool $ ls /sys/devices/system/cpu/cpu0/
        cache cpufreq cpuidle crash_notes node0 topology

        Can this help you?

        Delete
      11. Try again please... it looks like your cpus have no throttling at all, so you missed a path.. I should have fixed that.

        Cheers

        Delete
      12. Molte grazie, tutto funziona a meraviglia ora!

        The GUI is now active. I hope I can get now my processor to cool down a bit! Thank you again. Francis

        Delete
      13. I went ahead and upgrade to Ubuntu 12.04 LTS yesterday (release date) and boy, it is much more fine tune in performance and battery life. One exception is that I cannot log in through Unity 3D due to some bug with new nVidia 295.40 driver. I hope it gets fixed soon. Cheers.

        Delete
    82. Hi Fabio,

      I got stuck on number 5. I put the correct path with cd in front of it but this what I get:

      al@ubuntu:~$ cd /home/al/downloads/phc-intel-pack-rev4
      bash: cd: /home/al/downloads/phc-intel-pack-rev4: No such file or directory


      I tried moving the file to a different folder, but I got the same thing.

      uname -a gives:
      Linux ubuntu 3.0.0-15-generic-phc #26~phc0-Ubuntu SMP Tue Jan 24 02:57:43 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


      Thanks,
      Al

      ReplyDelete
      Replies
      1. Are you sure you have successfully extracted the archive in that folder? Take a look if that folders exists and there's any file in there... maybe try with
        ls /home/al/download/
        ls /home/al/download/phc-intel-pack-rev4

        Delete
      2. I tried both and this is what I got:

        al@ubuntu:~$ ls /home/al/Downloads/
        phc-intel-pack-rev4.tar.bz2
        al@ubuntu:~$ ls /home/al/Downloads/phc-intel-pack-rev4
        ls: cannot access /home/al/Downloads/phc-intel-pack-rev4: No such file or directory

        As you can see in the picture of the screen below, that is where I have my file, I even moved it to different places, but I keep getting the same thing.

        [IMG]http://i39.tinypic.com/104jo5g.png[/IMG]

        Delete
      3. By the way, I have ubuntu 11.10.

        Delete
      4. Sorry, Fabio. It was a stupid mistake on my part, I did not unzip the file before, but when I did it worked.

        Now, I am stuck on step 11:

        al@ubuntu:~$ sudo ln Downloads/0.5.2-2/phctool/phctool.sh /usr/bin/phctool
        ln: creating hard link `/usr/bin/phctool': File exists
        al@ubuntu:~$ sudo ln Downloads/0.5.2-2/phctool/phctray.sh /usr/bin/phctray
        ln: creating hard link `/usr/bin/phctray': File exists
        al@ubuntu:~$ sudo phctool
        al@ubuntu:~$

        Is that it? I understand that a program should open up, but nothing did.

        Delete
      5. I have the same issue... I think the program doesn't like being lauched from another location (relative paths maybe?) anyway i'll modify the guide to create a menu placeholder, which is better ^_^

        Delete
    83. Hi, will this soon be updated for ubuntu 12.04?
      I tried to compile the AMD k8 patch but I get an error saying it only supports kernel 2.6

      ReplyDelete
      Replies
      1. Take a look at the newer guide. amd-k8 has a little trouble, it will be ready soon...

        Delete
    84. I am on Ubuntu 11.10,
      download install until here:

      $ make dkms_mkdeb
      does not work
      $ make install dkms_mkdeb
      works, but
      got this:
      ... Fehler: Implizite Deklaration der Funktion »cpufreq_debug_printk« [-Werror=implicit-function-declaration]
      /home/thomas/Downloads/Ubuntu/phc-k8_v0.4.4a2/phc-k8.c:336:4: Fehler: »CPUFREQ_DEBUG_DRIVER« nicht deklariert

      ReplyDelete
      Replies
      1. Oh.. here you are! Have you tried taking a look to the up-to-date guide?

        Delete
    85. works great on my T7500 CPU. rebuilt my standard kernel with CONFIG_CPU_FREQ_STAT=m and also rebuilt phc-intel driver module.

      ReplyDelete
    86. It worked! Thanks for the helpful guide, as a linux noob I'm not sure how I would have done without this.

      I used PHC to undervolt my Dell Latitude E6400 w/ Intel P9700 and significantly drop my temps.

      ReplyDelete
    87. Are the ppa still up ? I get an error on apt-get update !

      ReplyDelete