Skip to main content

Command Palette

Search for a command to run...

Ubuntu Random Freezes Fix: Limit Power PL1

Published
6 min read
Ubuntu Random Freezes Fix: Limit Power PL1

My Ubuntu server kept freezing. No warning. No error. Just completely stuck. Screen frozen, keyboard dead, only option was to hold the power button and force restart.

This happened randomly. Sometimes after a few hours, sometimes after a few days. I couldn't find a pattern. I checked RAM, disk, GPU, drivers, Docker, everything. All looked fine.

Turns out the problem was my CPU eating too much power. And the fix was literally one command.


Some Background

My server runs on an Intel i9-14900K with a Gigabyte motherboard and an NVIDIA RTX 4090. It handles PostgreSQL, Docker containers, Python scripts, and some web scraping workers. Nothing crazy. But every now and then, when multiple things run at the same time, the whole system just freezes.

No logs. No crash dump. No kernel panic. Just dead.


What Are PL1 and PL2?

Every Intel CPU has two power limits built in. Think of them as rules that tell the CPU how much electricity it's allowed to use.

PL1 (Power Limit 1) is the long-term limit. This is how much power the CPU can use continuously. All day, every day. Intel says for the i9-14900K, this should be 125 watts.

PL2 (Power Limit 2) is the short-term boost limit. When you suddenly need more power (compiling code, running heavy queries), the CPU is allowed to jump up to PL2 for a few seconds temporarily. Intel says this should be 253 watts. After a short burst, it must return to PL1.

So the normal behavior should look like this:

Normal load:    30W ... 50W ... 40W ... 60W
Sudden spike:   30W ... 50W ... 253W! ... 253W! ... back to 125W ... 60W ... 40W
                                ^^^^^^^^^^^^^^^^^^^^
                                PL2 boost (few seconds only)

The CPU goes fast when needed, then calms down. That's healthy.


What Was Wrong on My Server?

I checked my power limits with these commands:

PL1=$(cat /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw)
echo "PL1: $((PL1 / 1000000))W"

PL2=$(cat /sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw)
echo "PL2: $((PL2 / 1000000))W"

Result:

PL1: 253W
PL2: 253W

Both set to 253W. That means there is no "calm down" phase. The CPU is allowed to pull 253 watts forever if the workload demands it. No speed limit. Full power all the time.

This is a known issue with Gigabyte motherboards (and ASUS, MSI too). They ship with power limits set to maximum by default. Why? Because higher power means higher benchmark scores. Looks great in reviews. Not so great for stability.


Why This Causes Freezes

Imagine a water pipe rated for 125 liters per minute. Someone removed the limit and now 253 liters can flow through it. Most of the time you only use 10-20 liters, so nothing happens. But when many taps open at once, 253 liters rush through. The pipe can't handle the pressure and bursts.

Same thing with the CPU. At idle, my server uses about 2-3 watts. Normal workload is maybe 30-60 watts. No problem. But when PostgreSQL runs a heavy query while Docker containers are scraping websites and Python scripts are processing data, all at once, the CPU pulls 200+ watts sustained. The chip gets extremely hot, the motherboard power delivery gets stressed, and the whole system locks up.

Intel actually acknowledged this problem for 13th and 14th gen CPUs. They released microcode updates and told everyone to set PL1 back to 125W. Many people were having crashes and didn't know why.


The Fix

Step 1: Check your current power limits

PL1=$(cat /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw)
echo "PL1: $((PL1 / 1000000))W"

PL2=$(cat /sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw)
echo "PL2: $((PL2 / 1000000))W"

If PL1 shows anything above 125W, that's your problem.

Step 2: Fix it right now (instant, no reboot)

echo 125000000 | sudo tee /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw

That's it. One command. PL1 is now 125W. Your CPU will still boost to 253W for short bursts (PL2), but it won't stay there. It will always come back down to 125W.

Step 3: Verify it worked

PL1=$(cat /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw)
echo "PL1: $((PL1 / 1000000))W"

Should now show 125W.

Step 4: Make it permanent

The command above resets on reboot. You have two options to make it stick.

Option A: Fix in BIOS (recommended)

Reboot, enter BIOS (usually Del or F2 on Gigabyte boards), and look for one of these:

  • "Package Power Limit 1" or "PL1"

  • "Long Duration Power Limit"

  • Usually under "Tweaker" or "Advanced CPU Settings"

Set it to 125. Save and exit.

Option B: Set it automatically on every boot

Create a systemd service:

sudo bash -c 'cat > /etc/systemd/system/cpu-power-limit.service << EOF
[Unit]
Description=Set CPU PL1 Power Limit to 125W
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c "echo 125000000 > /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw"

[Install]
WantedBy=multi-user.target
EOF'

sudo systemctl enable cpu-power-limit.service

Now every time the server boots, PL1 gets set to 125W automatically.

Step 5: Keep Intel microcode updated

Intel released microcode patches specifically for this issue. Make sure it's installed and won't get auto-removed:

sudo apt install intel-microcode
sudo apt-mark manual intel-microcode

Will This Make My Server Slower?

No. My server uses 2-3 watts at idle and maybe 30-60 watts during normal work. The 125W limit is more than double what I normally use. The only thing that changes is the CPU can't sustain 253W for minutes at a time anymore. For a server running databases and containers, you will never notice the difference.


Quick Summary

Server kept freezing randomly. No errors, no logs, just dead. Turned out the motherboard had CPU power limits set way too high (253W sustained instead of Intel's recommended 125W). Under heavy load, the CPU would pull too much power for too long and the system would lock up.

Fixed it with one command:

echo 125000000 | sudo tee /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw

Then made it permanent in BIOS.

If you have a 13th or 14th gen Intel CPU and your system freezes randomly, check your PL1. There's a good chance your motherboard set it way too high.

Thanks!

Happy Debugging!!😀


Moral of the story: sometimes the fix isn't in the software. Sometimes your motherboard is just being too generous with the power, and your CPU doesn't know when to stop.

More from this blog

S

Sagar Budhathoki

17 posts

A Python/DevOps Engineer with hands-on experience in cloud computing, automating and optimizing mission-critical deployments in AWS, leveraging configuration management, CI/CD, etc. AI/ML enthusiast.