Ubuntu – How to make Powertop changes permanent

powertop

I'm on a Compaq 615 and it's fan is loud. Not much you can do about that but I'm trying to keep the CPU/GPU as cool as possible. This is what Powertop has to say:

PowerTOP 1.97 - Overview - Idle stats - Frequency stats - Device stats - Tunables

If I change all of them to "good", the changes don't survive a reboot.

I added the line to the "grub"-file as suggested here

How do I make the Powertop suggested "Tunables" permanent?

Best Answer

If you change all of them to good anyway, you could simply use the command

sudo powertop --auto-tune

Call powertop auto-tune automatically at boot time

1.

On systems using systemd as startup manager (like Ubuntu) install it as a service:

cat << EOF | sudo tee /etc/systemd/system/powertop.service
[Unit]
Description=PowerTOP auto tune

[Service]
Type=oneshot
Environment="TERM=dumb"
RemainAfterExit=true
ExecStart=/usr/sbin/powertop --auto-tune

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable powertop.service

2.

On systems not using systemd, or if you want to use the old style with /etc/rc.local file, add this line at the end to /etc/rc.local:

powertop --auto-tune
exit 0

Note: if the script already contains exit 0 be sure you place all commands before that line, cause that exits the script

If you want to set all to good but one line you could first auto-tune and then disable one setting with an extra line, for example, if you want to re-enable the touchscreen-device (at usb 2-7), add this before the exit 0:

powertop --auto-tune
echo 'on' > '/sys/bus/usb/devices/2-7/power/control'
exit 0

Note: on Linux with systemd, make sure /etc/rc.local is executed at startup by the compatibility service

systemctl status rc-local.service
Related Question