How do I make Powertop changes permanent?

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

Here's how you can make the changes permanent:

sudo powertop --html

This will generate a powertop-xxxxxxxxxx-xxxxxx.html file.

Now either open that up in the browser and copy the echo commands from "... in need of Tuning" to /etc/rc.local.

Or extract the commands using something like this:

echo "grep 'echo ' powertop-20120805-125538.html | sed 's/.*\(echo.*\);.*/\1/g'"

If rc.local contains exit 0 you need to make sure to put the commands before this line.