Manage Intel Turbo Boost with systemd

If you have a little laptop with an Intel CPU that supports turbo boost, you might find that it’s getting a little hot when you’re using it on your lap.

For example, taking a look at my CPU:
lscpu |egrep "Model name|MHz"

We can see that it’s a 2.7GHz CPU with turbo boost taking it up to 3.5GHz.

Model name: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
CPU MHz: 524.633
CPU max MHz: 3500.0000
CPU min MHz: 400.0000

Here’s a way that you can enable and disable turbo boost with a systemd service, which lets you hook it into other services or disable it on boot.

By default, turbo boost is on, so starting our service will disable it.

Create the service.
cat << EOF | sudo tee \
/etc/systemd/system/disable-turbo-boost.service
[Unit]
Description=Disable Turbo Boost on Intel CPU
 
[Service]
ExecStart=/bin/sh -c "/usr/bin/echo 1 > \
/sys/devices/system/cpu/intel_pstate/no_turbo"
ExecStop=/bin/sh -c "/usr/bin/echo 0 > \
/sys/devices/system/cpu/intel_pstate/no_turbo"
RemainAfterExit=yes
 
[Install]
WantedBy=sysinit.target
EOF

Reload systemd manager configuration.
sudo systemctl daemon-reload

Test it by running something CPU intensive and watching the current running MHz.

cat /dev/urandom > /dev/null &
lscpu |grep "CPU MHz"

CPU MHz: 3499.859

Now disable turbo boost and check the CPU speed again.
sudo systemctl start disable-turbo-boost
lscpu |grep "CPU MHz"

CPU MHz: 2699.987

Don’t forget to kill the CPU intensive process ๐Ÿ™‚

kill %1

If you want to disable turbo boost on boot by default, just enable the service.

sudo systemctl enable disable-turbo-boost

As turbo boost is enabled on a Linux system by default, to turn it back on you just need to turn off the script which disables it.

sudo systemctl disable disable-turbo-boost

14 Responses to “Manage Intel Turbo Boost with systemd”


  • your script is incomplete, I am getting this error:

    @archlinux โžœ ~ ยป sudo systemctl enable disable-turbo-boost
    The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
    settings in the [Install] section, and DefaultInstance for template units).
    This means they are not meant to be enabled using systemctl.
    Possible reasons for having this kind of units are:
    1) A unit may be statically enabled by being symlinked from another unit’s
    .wants/ or .requires/ directory.
    2) A unit’s purpose may be to act as a helper for some other unit which has
    a requirement dependency on it.
    3) A unit may be started when needed via activation (socket, path, timer,
    D-Bus, udev, scripted systemctl call, …).
    4) In case of template units, the unit is meant to be enabled with some
    instance name specified.

  • Thank you, my bad. I’ve updated the post to include support for this. Thanks.

  • Thanks a lot, that was really helpful

  • Your showing people the longest route to do something. Make sure you read the manuals first before posting articles.

  • Thank you, very usefull !

  • so how would you renable turbo boost

  • Turbo boost is enabled on a Linux system by default, so to turn it back on, just turn off the script which disables it.

    sudo systemctl disable disable-turbo-boost

    Basically, disable the disable service.

  • This was very useful, thanks a lot. No more fear of melting my laptop.

  • Hi,
    So, I have an issue.
    First of all, the script does nothing whatsoever on my laptop. I mean, it gives some random CPU readouts.

    I have an HP Stream 11, with Celeron N3060 CPU.
    It runs at a base clock speed of 1,60Ghz; 2 cores, no HT.
    It also has a boost speed of 2,48Ghz.
    In Windows, the little device runs at that 2,48Ghz constantly under load, without throttling down.
    The CPU does not get hot enough.
    In Linux (GalliumOS; a Xubuntu variant), even using all your shenanigans, the CPU core speed just does not exceed 1,60Ghz.

    It appears to me, Linux can’t boost CPU clock speed to turbo speeds.
    What do I need to do, to get at least a boost to 2Ghz?

  • it’s not work on ubuntu 18, i check that service by systemctl status disable-turbo-boost.service
    but it’s result is :
    disable-turbo-boost.service – Disable Turbo Boost on Intel CPU
    Loaded: loaded (/etc/systemd/system/disable-turbo-boost.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2018-11-27 13:47:22 WITA; 25s ago
    Process: 2904 ExecStart=/bin/sh -c /usr/bin/echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo (code=exited, status=127)
    Main PID: 2904 (code=exited, status=127)

    Nov 27 13:47:22 gungp-GL552VX systemd[1]: Started Disable Turbo Boost on Intel CPU.
    Nov 27 13:47:22 gungp-GL552VX sh[2904]: /bin/sh: 1: /usr/bin/echo: not found
    Nov 27 13:47:22 gungp-GL552VX systemd[1]: disable-turbo-boost.service: Main process exited, code=exited, status=127/n/a
    Nov 27 13:47:22 gungp-GL552VX systemd[1]: disable-turbo-boost.service: Failed with result ‘exit-code’.

  • I don’t know if that CPU is supported under Linux, I would assume so, but maybe not. So is turbo boost enabled? How are you checking the current CPU MHz? What happens you stress the CPU, like:

    dd if=/dev/urandom of=/dev/null

  • Looks like echo is in a different place in Ubuntu, see the error you pasted:

    /bin/sh: 1: /usr/bin/echo: not found

    Replace the path to echo in the script with the result of this command:

    which echo

Leave a Reply