Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have got a .sh-script, trying to make powertop changes permanent.

'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control';

the commands in this .sh-script are all of this type.

I have a systemd-service in /etc/systemd/system with this content:

Description=My Script



The script "" is called correctly after boot, (for example "bluetooth off"-command in this file is called perfeclty) but the echo->-commands are not called successfully.

I noticed that typing

  sudo 'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control';

in a terminal gives a restriction-error, but

  sudo su
 'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control';


how do I have to change my systemd+bash-script to get the powertop-changes working on boot?

Thanks in advance!


Okay, I try to describe the flow again: I got the systemd service posted on top of this post. This service calls the "" in my /home/user/.

There are plenty commands in this looking like this:

echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:04:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:03.3/power/control';
thinkfan start

The "thinkfan start" needs also root-privileges to start correctly, this one works, but the "echo"-commands dont.

I also tryed

bash -c 'echo auto > /sys/bus/pci/devices/0000:00:1d.0/power/control;'
bash -c 'echo auto > /sys/bus/pci/devices/0000:00:1a.7/power/control;'
bash -c 'echo auto > /sys/bus/pci/devices/0000:00:1a.2/power/control;'
bash -c 'echo auto > /sys/bus/pci/devices/0000:00:02.0/power/control;'
bash -c 'echo auto > /sys/bus/pci/devices/0000:00:02.1/power/control;'  

doesnt work either :/

The sudo-test-stuff I mentioned above were just tests in a Terminal.

any advice?

share|improve this question
Do you actually have 'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control' in your script or echo 'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control'? In any case, if your script is called by systemd, sudo should not be necessary. Dows it work if you just echo the commands into the files, with no sudo? – terdon Apr 22 '13 at 16:03
no, the sudo-test was outside the script in a terminal. i have the systemd-service calling the script, where the "echo..."-commands are listed (without sudo). – breytex Apr 22 '13 at 17:24
Still not sure I understand, could you give us the whole picture? What sudo test, I thought systemd was running this at startup? Could you maybe post the script? Or at least a minimal example that reproduces the problem? – terdon Apr 23 '13 at 0:59
i tryed to make things more clear in my post-edit :-) – breytex Apr 23 '13 at 8:42
Does echo 'auto' | sudo tee 'file' work? – ignis Apr 23 '13 at 13:44

Are you sure that X-bit set for /home/my_username/ Keep in the mind that owner uid/gid of this script must be root to prevent shell code injection by malware. And

sudo echo 'auto' > '/sys/bus/pci/devices/0000:00:02.1/power/control';

won't work because '>' executed not by root. Try

sudo bash -c 'echo auto > /sys/bus/pci/devices/0000:00:02.1/power/control';
share|improve this answer
i tryed to make things more clear in my post-edit :-) – breytex Apr 23 '13 at 8:41

Yea, my bad. I called tlp start after the Powertop-tweaks. Dint know that tlp would mess the settings up this bad. So, if you have the same problem: call tlp start

share|improve this answer
Well done for figuring it out. Could you give a bit more detail please? When were you calling tlp start before and when are you calling it now? – terdon Apr 24 '13 at 1:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.