Installing liquidctl - How much power does my PC use?

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
mdevour
Level 2
Level 2
Posts: 75
Joined: Fri Aug 08, 2014 8:24 am

Installing liquidctl - How much power does my PC use?

Post by mdevour »

I bought a really nice power supply for my newest computer build, a Corsair HX1000i. It has status reporting and management that can be accessed by connecting it to a motherboard USB connector and running the appropriate software. Sadly, Corsair supports only Windows, so the Linux community has had to reverse engineer its features like they do with so many other products.

I wanted to know how much power my PC was drawing from the wall. I first looked at dedicated power meters. Many are available and not expensive. However I also knew my power supply had this capability already built in, if I could only get to it.

Enter liquidctl, to be found at https://github.com/jonasmalacofilho/liquidctl

Jonas Malaco and his team first built the program to manage liquid CPU coolers, but branched out to include support for certain motherboards, power supplies, and other devices.

The project doesn't offer packages for Ubuntu derived distros, so you have to compile it from source. The build instructions in the README file on the main page of the github site are not optimized for Ubuntu (or Mint), though they give enough guidance to succeed. This is my account of the process, distilled to the steps needed to build and test the program on Linux Mint 19.3, Tricia.


First, lets prepare your machine to build the new software: satisfying all the dependencies and installing any build tools that are absent.

From the table listing dependencies for various distributions: the first column is the required program and the second column is the specific package that needs to be installed:

Code: Select all

Dependency      Ubuntu
Python 3.6+     python3
libusb-1.0      libusb-1.0-0
pkg_resources   python3-pkg-resources
docopt          python3-docopt
PyUSB           python3-usb
cython-hidapi   python3-hid
You can test to see if they're installed on your system with the dpkg command. Open a terminal and copy/paste the following command after the $ prompt and press enter...

Code: Select all

dpkg --list python3 libusb-1.0-0 python3-pkg-resources python3-docopt python3-usb python3-hid
When I ran it on my system, this is the output I got:

Code: Select all

$ dpkg --list python3 libusb-1.0-0 python3-pkg-resources python3-docopt python3-usb python3-hid
||/ Name                     Version           Architecture      Description
+++-========================-=================-=================-=====================================================
ii  libusb-1.0-0:amd64       2:1.0.21-2        amd64             userspace USB programming library
ii  libusb-1.0-0:i386        2:1.0.21-2        i386              userspace USB programming library
ii  python3                  3.6.7-1~18.04     amd64             interactive high-level object-oriented language (defa
ii  python3-pkg-resources    39.0.1-2          all               Package Discovery and Resource Access using pkg_resou
dpkg-query: no packages found matching python3-docopt
dpkg-query: no packages found matching python3-usb
dpkg-query: no packages found matching python3-hid
The ii indicates the package is installed already. For any packages that are not, you can open Package Manager or Software Manager, search for and install each one. I did that for the last three in my list.


Next, make sure setuptools is installed:

Code: Select all

Dependency      Ubuntu
setuptools      python3-setuptools
Check dependencies:

Code: Select all

dpkg --list python3-setuptools

Code: Select all

$ dpkg --list python3-setuptools python3-pip
||/ Name                     Version           Architecture      Description
+++-========================-=================-=================-=====================================================
un  python3-setuptools       <none>            <none>            (no description available)
Use Software Manager or Package Manager to install, as needed.


Once you're done with that you can move on to downloading the source and building the program.

When you clone the repository it will create a subdirectory containing all the source files. So, in your terminal window, navigate to the directory you'd like that folder to be created in:

Code: Select all

cd ~/<your_directory_path>
In my case, I used:

Code: Select all

$ cd ~/Documents/Computer/sensors
Then clone the project files:

Code: Select all

git clone https://github.com/jonasmalacofilho/liquidctl
The output looks like this:

Code: Select all

$ git clone https://github.com/jonasmalacofilho/liquidctl
Cloning into 'liquidctl'...
remote: Enumerating objects: 179, done.
remote: Counting objects: 100% (179/179), done.
remote: Compressing objects: 100% (109/109), done.
remote: Total 3941 (delta 115), reused 114 (delta 68), pack-reused 3762
Receiving objects: 100% (3941/3941), 945.58 KiB | 9.36 MiB/s, done.
Resolving deltas: 100% (2777/2777), done.
Now enter the liquidctl directory just created:

Code: Select all

cd liquidctl
Now, if everything is just right, one command will finish the job:

Code: Select all

sudo python3 setup.py install
The output looks like this:

Code: Select all

$ sudo python3 setup.py install
[sudo] password for mike:           
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
creating liquidctl.egg-info
writing liquidctl.egg-info/PKG-INFO
writing dependency_links to liquidctl.egg-info/dependency_links.txt
writing entry points to liquidctl.egg-info/entry_points.txt
writing requirements to liquidctl.egg-info/requires.txt
writing top-level names to liquidctl.egg-info/top_level.txt
writing manifest file 'liquidctl.egg-info/SOURCES.txt'
reading manifest file 'liquidctl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'liquidctl.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/liquidctl
copying liquidctl/__init__.py -> build/lib/liquidctl
copying liquidctl/extraversion.py -> build/lib/liquidctl
copying liquidctl/pmbus.py -> build/lib/liquidctl
copying liquidctl/keyval.py -> build/lib/liquidctl
copying liquidctl/util.py -> build/lib/liquidctl
copying liquidctl/version.py -> build/lib/liquidctl
copying liquidctl/cli.py -> build/lib/liquidctl
creating build/lib/liquidctl/driver
copying liquidctl/driver/base.py -> build/lib/liquidctl/driver
copying liquidctl/driver/rgb_fusion2.py -> build/lib/liquidctl/driver
copying liquidctl/driver/__init__.py -> build/lib/liquidctl/driver
copying liquidctl/driver/nzxt_smart_device.py -> build/lib/liquidctl/driver
copying liquidctl/driver/corsair_hid_psu.py -> build/lib/liquidctl/driver
copying liquidctl/driver/asetek.py -> build/lib/liquidctl/driver
copying liquidctl/driver/usb.py -> build/lib/liquidctl/driver
copying liquidctl/driver/coolit_platinum.py -> build/lib/liquidctl/driver
copying liquidctl/driver/kraken_two.py -> build/lib/liquidctl/driver
copying liquidctl/driver/seasonic.py -> build/lib/liquidctl/driver
copying liquidctl/driver/kraken_gen4.py -> build/lib/liquidctl/driver
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/liquidctl
creating build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/base.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/rgb_fusion2.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/__init__.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/nzxt_smart_device.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/corsair_hid_psu.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/asetek.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/usb.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/coolit_platinum.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/kraken_two.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/seasonic.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/driver/kraken_gen4.py -> build/bdist.linux-x86_64/egg/liquidctl/driver
copying build/lib/liquidctl/__init__.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/extraversion.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/pmbus.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/keyval.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/util.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/version.py -> build/bdist.linux-x86_64/egg/liquidctl
copying build/lib/liquidctl/cli.py -> build/bdist.linux-x86_64/egg/liquidctl
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/base.py to base.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/rgb_fusion2.py to rgb_fusion2.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/nzxt_smart_device.py to nzxt_smart_device.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/corsair_hid_psu.py to corsair_hid_psu.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/asetek.py to asetek.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/usb.py to usb.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/coolit_platinum.py to coolit_platinum.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/kraken_two.py to kraken_two.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/seasonic.py to seasonic.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/driver/kraken_gen4.py to kraken_gen4.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/extraversion.py to extraversion.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/pmbus.py to pmbus.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/keyval.py to keyval.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/util.py to util.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/version.py to version.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/liquidctl/cli.py to cli.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying liquidctl.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/liquidctl-1.3.3-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing liquidctl-1.3.3-py3.6.egg
Copying liquidctl-1.3.3-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding liquidctl 1.3.3 to easy-install.pth file
Installing liquidctl script to /usr/local/bin

Installed /usr/local/lib/python3.6/dist-packages/liquidctl-1.3.3-py3.6.egg
Processing dependencies for liquidctl==1.3.3
Searching for pyusb==1.0.0
Best match: pyusb 1.0.0
Adding pyusb 1.0.0 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for hidapi==0.7.99.post21
Best match: hidapi 0.7.99.post21
Adding hidapi 0.7.99.post21 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for docopt==0.6.2
Best match: docopt 0.6.2
Adding docopt 0.6.2 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Finished processing dependencies for liquidctl==1.3.3

Now you should be able to test the program you just built:

Code: Select all

liquidctl --help

Code: Select all

$ liquidctl --help
liquidctl – monitor and control liquid coolers and other devices.

Usage:
  liquidctl [options] list
  liquidctl [options] initialize [all]
  liquidctl [options] status
  liquidctl [options] set <channel> speed (<temperature> <percentage>) ...
  liquidctl [options] set <channel> speed <percentage>
  liquidctl [options] set <channel> color <mode> [<color>] ...
  liquidctl --help
  liquidctl --version

Device selection options (see: list -v):
  -m, --match <substring>     Filter devices by description substring
  -n, --pick <number>         Pick among many results for a given filter
  --vendor <id>               Filter devices by vendor id
  --product <id>              Filter devices by product id
  --release <number>          Filter devices by release number
  --serial <number>           Filter devices by serial number
  --bus <bus>                 Filter devices by bus
  --address <address>         Filter devices by address in bus
  --usb-port <port>           Filter devices by USB port in bus
  -d, --device <id>           Select device by listing id

Animation options (devices/modes can support zero or more):
  --speed <value>             Abstract animation speed (device/mode specific)
  --time-per-color <value>    Time to wait on each color (seconds)
  --time-off <value>          Time to wait with the LED turned off (seconds)
  --alert-threshold <number>  Threshold temperature for a visual alert (°C)
  --alert-color <color>       Color used by the visual high temperature alert

Other device options:
  --single-12v-ocp            Enable single rail +12V OCP
  --pump-mode <mode>          Set the pump mode (certain Corsair coolers)
  --legacy-690lc              Use Asetek 690LC in legacy mode (old Krakens)
  --unsafe <features>         Comma-separated bleeding-edge features to enable

Other interface options:
  -v, --verbose               Output additional information
  -g, --debug                 Show debug information on stderr
  --version                   Display the version number
  --help                      Show this message

Deprecated:
  --hid <ignored>             Deprecated

Examples:
  liquidctl list --verbose
  liquidctl initialize all
  liquidctl --match kraken set pump speed 90
  liquidctl --product 0x170e set led color fading 350017 ff2608
  liquidctl status

Copyright (C) 2018–2020  Jonas Malaco, CaseySJ, Tom Frey and contributors

liquidctl incorporates work by leaty, KsenijaS, Alexander Tong, Jens Neumaier,
Kristóf Jakab, Sean Nelson, Chris Griffith, notaz, realies and Thomas Pircher.

SPDX-License-Identifier: GPL-3.0-or-later

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Now use it for real!

First list detected devices:

Code: Select all

liquidctl list --verbose

Code: Select all

$ liquidctl list --verbose
Device ID 0: Corsair HX1000i
├── Vendor ID: 0x1b1c
├── Product ID: 0x1c07
├── Release number: 0x0002
├── Bus: hid
├── Address: /dev/hidraw0
└── Driver: CorsairHidPsuDriver using module hidraw
Then initialize communications with (all) the detected devices:

Code: Select all

sudo liquidctl initialize

Finally, what we've all been waiting for...

Code: Select all

sudo liquidctl status

Code: Select all

$ sudo liquidctl status
WARNING: reading the +12V OCP mode is an experimental feature
Corsair HX1000i
├── Current uptime                   17:13:58  
├── Total uptime            19 days, 15:13:58  
├── Temperature 1                        47.0  °C
├── Temperature 2                        41.8  °C
├── Fan control mode                 Hardware  
├── Fan speed                               0  rpm
├── Input voltage                      115.00  V
├── Total power                        178.00  W
├── +12V OCP mode                  Multi rail  
├── +12V output voltage                 12.00  V
├── +12V output current                 12.75  A
├── +12V output power                  152.00  W
├── +5V output voltage                   4.97  V
├── +5V output current                   3.38  A
├── +5V output power                    16.50  W
├── +3.3V output voltage                 3.28  V
├── +3.3V output current                 2.06  A
└── +3.3V output power                   6.50  W
You can see many things in this report. For example, my PSU is ticking along at less than 20% of capacity, isn't working hard enough to even turn on the fan, and appears to be amazingly efficient:

Total output watts = 175, efficiency ~ 175/178 = ~98%

I don't know if I believe that or not, but it's great to have the information available!

So there it is. I submit this tutorial because it was a bit of work doing the install, but everything went smoothly. If anybody else finds it useful, I'll be glad. It's at least a little something I can give back to the Mint community.

Thanks,

Mike D.
Deezyoker
Level 1
Level 1
Posts: 2
Joined: Sun Sep 11, 2022 10:35 am

Re: Installing liquidctl - How much power does my PC use?

Post by Deezyoker »

great tutorial! using Linux Mint 20.3 i had to use sudo pip install . instead of sudo python3 setup.py install as it was returning error python3: can't open file 'setup.py': [Errno 2] No such file or directory
Last edited by Deezyoker on Sun Sep 18, 2022 3:58 am, edited 1 time in total.
User avatar
SMG
Level 25
Level 25
Posts: 36511
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Installing liquidctl - How much power does my PC use?

Post by SMG »

Deezyoker wrote: Sun Sep 11, 2022 10:52 am great tutorial but i had to use sudo pip install . instead of sudo python3 setup.py install as it was returning error python3: can't open file 'setup.py': [Errno 2] No such file or directory
What version of Linux Mint are you currently using? This tutorial states it is "steps needed to build and test the program on Linux Mint 19.3, Tricia."

Python versions changed between LM19 versions and LM20 versions, so that might be why it did not work as listed for you.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
MikeNovember
Level 8
Level 8
Posts: 2109
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: Installing liquidctl - How much power does my PC use?

Post by MikeNovember »

Hi,

The hardware way, a clamp meter:

Image

:mrgreen:

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Pro with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
Deezyoker
Level 1
Level 1
Posts: 2
Joined: Sun Sep 11, 2022 10:35 am

Re: Installing liquidctl - How much power does my PC use?

Post by Deezyoker »

SMG wrote: Sun Sep 11, 2022 11:02 am
Deezyoker wrote: Sun Sep 11, 2022 10:52 am great tutorial but i had to use sudo pip install . instead of sudo python3 setup.py install as it was returning error python3: can't open file 'setup.py': [Errno 2] No such file or directory
What version of Linux Mint are you currently using? This tutorial states it is "steps needed to build and test the program on Linux Mint 19.3, Tricia."

Python versions changed between LM19 versions and LM20 versions, so that might be why it did not work as listed for you.
Linux Mint 20.3 ,i wasn't aware of how relevant that was. is there a way to post tutorial "fixes" for newer/alternate versions of mint?
User avatar
SMG
Level 25
Level 25
Posts: 36511
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Installing liquidctl - How much power does my PC use?

Post by SMG »

Deezyoker wrote: Fri Sep 16, 2022 7:09 amLinux Mint 20.3 ,i wasn't aware of how relevant that was. is there a way to post tutorial "fixes" for newer/alternate versions of mint?
There are several options. You can modify your first post (click the pencil button) and add you are using LM20.3. You can also create a new topic with the steps you used making sure to state you used LM20.3 (and add a link to this topic saying yours was based on it).

Some people return to their topics to add updates if they are still using the software and need to make adjustments to the instructions, but many do not. That is why it is good to check dates on post (or other information you might find on the internet) before following instructions.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Post Reply

Return to “Tutorials”