In the dynamic world of computing, pushing the boundaries of hardware performance is a pursuit that many tech enthusiasts and professionals engage in. Overclocking, the practice of increasing a CPU’s clock rate beyond its base operating speed, stands out as a popular method to squeeze out extra performance from a computer.
For Ubuntu users, the tool of choice for this task is often cpupower – a versatile and powerful utility that offers control over CPU frequency settings. In this guide, we’ve delved into the intricacies of using cpupower to safely and effectively overclock your CPU in Ubuntu, providing a pathway to enhanced system performance.
Understanding cpupower
Cpupower is a tool used in Linux systems, like Ubuntu, to monitor and adjust CPU frequency settings. It’s a part of the linux-tools package, a suite of tools for managing and diagnosing hardware and software.
Why use cpupower?
- Control: It gives you direct control over your CPU’s frequency.
- Flexibility: You can adjust settings based on your needs.
- Monitoring: It allows you to monitor the performance and temperature of your CPU.
Installing cpupower
Before we start overclocking, ensure you have cpupower installed. Open your terminal and type:
sudo apt install linux-tools-common linux-tools-`uname -r`
This command installs cpupower and kernel-specific package needed for the app to run on your Ubuntu system.
Example output:
foss_linux@fosslinux-ubuntu:~$ sudo apt install linux-tools-common linux-tools-`uname -r` Reading package lists... Done Building dependency tree... Done Reading state information... Done linux-tools-common is already the newest version (5.15.0-89.99). The following NEW packages will be installed: linux-hwe-6.2-tools-6.2.0-37 linux-tools-6.2.0-37-generic 0 upgraded, 2 newly installed, 0 to remove and 40 not upgraded. Need to get 7,990 kB of archives. After this operation, 28.5 MB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-hwe-6.2-tools-6.2.0-37 amd64 6.2.0-37.38~22.04.1 [7,988 kB] Get:2 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-tools-6.2.0-37-generic amd64 6.2.0-37.38~22.04.1 [1,812 B] Fetched 7,990 kB in 1s (8,449 kB/s) Selecting previously unselected package linux-hwe-6.2-tools-6.2.0-37. (Reading database ... 244511 files and directories currently installed.) Preparing to unpack .../linux-hwe-6.2-tools-6.2.0-37_6.2.0-37.38~22.04.1_amd64.d eb ... Unpacking linux-hwe-6.2-tools-6.2.0-37 (6.2.0-37.38~22.04.1) ... Selecting previously unselected package linux-tools-6.2.0-37-generic. Preparing to unpack .../linux-tools-6.2.0-37-generic_6.2.0-37.38~22.04.1_amd64.d eb ... Unpacking linux-tools-6.2.0-37-generic (6.2.0-37.38~22.04.1) ... Setting up linux-hwe-6.2-tools-6.2.0-37 (6.2.0-37.38~22.04.1) ... Setting up linux-tools-6.2.0-37-generic (6.2.0-37.38~22.04.1) ...
Checking your current CPU status
To see your current CPU frequency settings, type:
cpupower frequency-info
This command displays information about your CPU’s current frequency, the driver in use, and more.
Example output:
analyzing CPU 0: driver: intel_pstate CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 0.97 ms. hardware limits: 800 MHz - 3.50 GHz available cpufreq governors: performance, powersave current policy: frequency should be within 800 MHz and 3.50 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency: 1.20 GHz (asserted by call to hardware) boost state support: Supported: yes Active: yes
Breakdown of the output:
- Analyzing CPU 0: This indicates the information is for CPU 0. If you have multiple cores, each might be listed separately.
- Driver: Shows the driver managing the CPU frequency scaling,
intel_pstate
in this case. - Hardware limits: The minimum and maximum frequency limits of the CPU (800 MHz – 3.50 GHz here).
- Available cpufreq governors: Lists the governors available for managing CPU frequency.
performance
andpowersave
are common ones. - Current policy: Shows the current frequency range and the governor in use. In this example, the frequency is set to be between 800 MHz and 3.50 GHz, with the
performance
governor active. - Current CPU frequency: The current operating frequency of the CPU, which is 1.20 GHz in this example.
- Boost state support: Indicates if the CPU supports frequency boosting (turbo boost) and whether it’s active.
This output can vary depending on your CPU type, the configuration of your system, and the specific version of the tools and kernel you are using.
Overclocking with cpupower on Ubuntu
Step 1: Checking available frequencies
First, check the available frequency steps for your CPU:
cpupower frequency-info --freq
This command lists all the available frequencies that you can set for your CPU.
Example output:
analyzing CPU 0: available frequency steps: 800 MHz, 1.00 GHz, 1.20 GHz, 1.50 GHz, 1.80 GHz, 2.00 GHz, 2.20 GHz, 2.50 GHz, 2.80 GHz, 3.00 GHz, 3.20 GHz, 3.50 GHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil current policy: frequency should be within 800 MHz and 3.50 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware).
In this example, the CPU can be set to operate at frequencies ranging from 800 MHz to 3.50 GHz.
Step 2: Setting a new frequency
To set a new frequency, use:
sudo cpupower frequency-set -f [frequency]
Replace [frequency]
with your desired frequency. For example:
sudo cpupower frequency-set -f 3.5GHz
Example output:
Setting cpu: 0 Setting cpu: 1 Setting cpu: 2 Setting cpu: 3 Frequency 3.5 GHz was set.
This is a confirmation that the frequency has been successfully set to 3.5 GHz.
Step 3: Verifying the change
After setting the new frequency, verify it with:
cpupower frequency-info
This command should now show the new frequency you’ve set.
Monitoring and stability testing
After overclocking, it’s crucial to monitor your system’s stability and temperature. Use tools like lm-sensors
and stress
for this purpose.
Installing lm-sensors and stress
sudo apt-get install lm-sensors stress
Example output:
foss_linux@fosslinux-ubuntu:~$ sudo apt-get install lm-sensors stress Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: fancontrol read-edid i2c-tools The following NEW packages will be installed: lm-sensors stress 0 upgraded, 2 newly installed, 0 to remove and 40 not upgraded. Need to get 109 kB of archives. After this operation, 457 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 stress amd64 1.0.5-1 [18.4 kB] Get:2 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 lm-sensors amd64 1:3.6.0-7ubuntu1 [91.0 kB] Fetched 109 kB in 0s (254 kB/s) Selecting previously unselected package stress. (Reading database ... 244538 files and directories currently installed.) Preparing to unpack .../stress_1.0.5-1_amd64.deb ... Unpacking stress (1.0.5-1) ... Selecting previously unselected package lm-sensors. Preparing to unpack .../lm-sensors_1%3a3.6.0-7ubuntu1_amd64.deb ... Unpacking lm-sensors (1:3.6.0-7ubuntu1) ... Setting up stress (1.0.5-1) ... Setting up lm-sensors (1:3.6.0-7ubuntu1) ... Created symlink /etc/systemd/system/multi-user.target.wants/lm-sensors.service → /lib/systemd/system/lm-sensors.service. Processing triggers for man-db (2.10.2-1) ...
Monitoring temperature
Run sensors
to check your CPU temperature:
sensors
Example output:
coretemp-isa-0000 Adapter: ISA adapter Package id 0: +47.0°C (high = +82.0°C, crit = +102.0°C) Core 0: +46.0°C (high = +82.0°C, crit = +102.0°C) Core 1: +47.0°C (high = +82.0°C, crit = +102.0°C) Core 2: +44.0°C (high = +82.0°C, crit = +102.0°C) Core 3: +45.0°C (high = +82.0°C, crit = +102.0°C) acpitz-acpi-0 Adapter: ACPI interface temp1: +27.8°C (crit = +119.0°C) nouveau-pci-0100 Adapter: PCI adapter temp1: +33.0°C (high = +95.0°C, hyst = +3.0°C) (crit = +105.0°C, hyst = +5.0°C) (emerg = +135.0°C, hyst = +5.0°C)
Breakdown of the output:
- coretemp-isa-0000: This is the identifier for the CPU temperature sensor.
- Package id 0, Core 0, Core 1, etc.: These lines show the temperatures for the entire CPU package and individual cores. The values include current temperature, high, and critical thresholds.
- acpitz-acpi-0: This typically refers to a motherboard sensor.
- temp1: Shows the temperature reading from this sensor, along with the critical temperature threshold.
- nouveau-pci-0100: This is likely a GPU sensor, especially if you’re using an NVIDIA GPU with the Nouveau driver.
- temp1: Displays the GPU temperature, along with high, critical, and emergency thresholds.
Important notes:
- The output of
sensors
can vary greatly depending on your hardware and the sensors available in your system. - The names of the sensors (
coretemp-isa-0000
,acpitz-acpi-0
,nouveau-pci-0100
, etc.) and the number of readings will differ based on the specific hardware and drivers of your system. - It’s important to monitor these temperatures, especially when overclocking, as high temperatures can indicate that your cooling solutions are insufficient or that you’re pushing the hardware too hard.
Stress testing
Use stress
to load your CPU and monitor its behavior:
stress --cpu 8 --timeout 60
This command stresses 8 CPU cores for 60 seconds.
Example:
stress: info: [1234] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd
Breakdown of the output:
- [1234]: This is a process ID assigned to the stress test. The actual number will vary each time you run the command.
- dispatching hogs: Indicates that
stress
is starting the test. - 8 cpu: This confirms that 8 CPU workers are being used for the test.
- 0 io, 0 vm, 0 hdd: These values show that no I/O, virtual memory, or hard disk stress tests are being conducted in this instance.
During and after the test:
- During the test: While the test is running, you won’t see any additional output in the terminal. The
stress
command will fully utilize the specified number of CPU cores for the duration specified. You can monitor the CPU usage and system performance using other tools liketop
orhtop
during this period. - After the test: Once the 60 seconds are up, the
stress
command will complete, and you’ll get your command prompt back without any further output from thestress
command itself.
Important notes:
- System monitoring: It’s important to monitor your system’s temperature and performance during the test, especially if you’re doing this as part of overclocking or system stability testing.
- CPU load: This command will create a high load on the specified number of CPU cores, which can lead to increased temperatures. Make sure your cooling system is adequate.
- No output on completion: The
stress
tool does not provide a summary or result output upon completion. Its primary function is to create the specified load, not to analyze or report on system performance during the load.
Personal experience and advice
As someone who loves tinkering with tech, I’ve found overclocking with cpupower both exciting and rewarding. However, it’s not without risks. Always monitor your system’s temperature and stability. Overclocking can lead to overheating and potential hardware damage if not done carefully.
Common troubleshooting tips for overclocking with cpupower in Ubuntu
Overclocking can be a complex process, and sometimes things don’t go as planned. Here are some common troubleshooting tips to help you if you encounter issues while overclocking with cpupower in Ubuntu:
1. System becomes unstable or crashes
- Reduce the clock speed: If your system becomes unstable or crashes, it may be due to too high a frequency. Try lowering the overclocking frequency incrementally.
- Improve cooling: Overheating can cause instability. Ensure your cooling system is adequate and functioning correctly.
2. Unable to change frequency
- Check CPU compatibility: Some CPUs do not support overclocking or have limited overclocking capabilities. Verify that your CPU supports the changes you’re trying to make.
- Update BIOS/UEFI: Sometimes, updating your system’s BIOS/UEFI can resolve issues related to frequency scaling.
3. Overheating Issues
- Monitor temperatures closely: Use tools like
lm-sensors
to keep an eye on your CPU temperature. If temperatures are consistently high, reduce the overclocking frequency. - Enhance cooling solutions: Consider upgrading your cooling system, such as adding better thermal paste, more efficient coolers, or additional case fans.
4. Changes not persisting after reboot
- Modify boot parameters: Some changes made with cpupower may not persist after a reboot. You might need to add the necessary commands to your system’s startup scripts or cron jobs.
- Check for conflicting software: Other power management tools or settings in your system might override cpupower settings. Ensure there are no conflicts.
5. Frequency not reaching desired levels
- Check power settings: Ensure that your power settings in both the BIOS/UEFI and Ubuntu are set to performance modes, as power-saving modes can limit CPU frequency.
- Update cpupower: Make sure you are using the latest version of cpupower and your system is up-to-date.
6. System fails to boot
- Reset BIOS/UEFI to defaults: If overclocking causes boot failures, reset your BIOS/UEFI settings to default.
- Boot in safe mode: Boot Ubuntu in safe mode and revert any recent changes you made.
7. Software conflicts or errors
- Update your system: Ensure your Ubuntu installation and all its components are up-to-date.
- Check for kernel issues: Sometimes, specific kernels may have issues with overclocking tools. Try using a different kernel version.
8. Inaccurate sensor readings
- Calibrate sensors: If temperature or voltage readings seem off, you might need to calibrate your sensors or check for sensor-specific configurations.
By keeping these troubleshooting tips in mind, you can address most common issues encountered during CPU overclocking in Ubuntu.
Conclusion
Embarking on the overclocking journey with cpupower in Ubuntu is an adventure that combines technical skill with a dash of daring. We’ve explored the essential steps, from installing cpupower and understanding its capabilities to carefully adjusting and monitoring CPU frequencies. The importance of proceeding with caution cannot be overstated – overclocking, while offering potential performance gains, also carries risks such as overheating and hardware stress.