1

I am trying to modify my power method for my ati card as it's like having a helicopter in the room. I use the same methods described here.

sudo bash -c echo "profile" > /sys/class/drm/card0/device/power_method
bash: /sys/class/drm/card0/device/power_method: Permission denied

I also tried to switch to root sudo -i and do the same but not working. Any ideas?

0

The redirection operator is not part of your sudo command. In other words, when you execute sudo bash -c echo "profile" > /sys/class/drm/card0/device/power_method, what actually happens is:

  1. The shell executes sudo bash -c echo "profile"
  2. sudo, which has the setuid bit set, asks for your password, and forks the process bash -c echo "profile" with EUID set to 0 (i.e., the command is executed as root)
  3. The bash command executes echo "profile" and prints profile to standard output as root.
  4. bash terminates, sudo terminates
  5. The shell running your original command takes the string from standard output and tries to redirect it to /sys/class/drm/card0/device/power_method, which gets you a Permission denied since the shell is not running with root privileges.

There are a number of ways to solve this. One is to give the entire string with the redirection operator as argument to bash -c:

sudo bash -c 'echo "profile" > /sys/class/drm/card0/device/power_method'

I've also often seen people use tee, which looks somewhat nicer (and doesn't execute the echo command as root):

echo "profile" | sudo tee /sys/class/drm/card0/device/power_method

tee reads from standard input and outputs that to both standard output and all files you passed it as parameters.

  • No both doesn't work. I get bash: line 0: echo: write error: Invalid argument – OdinRW Sep 21 '14 at 18:36
  • Ah, but that's probably a driver thing now. Both methods do work, and you are now allowed to write to /sys/class/drm/card0/device/power_method. However, you can't just write anything arbitrary to that file. Looking at the Xorg radeon KMS Power Management Options, I can successfully write the words dynpm and profile to /sys/class/drm/card0/device/power_method', but if I try to write dpm into the file I get the same error as you do. Maybe your driver doesn't support profile. What card are you running? I'm on a Radeon HD 6950. – Malte Skoruppa Sep 21 '14 at 18:53
  • I have Radeon HD 3650 – OdinRW Sep 21 '14 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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