0

I have been trying to find a way to display (AMD) GPU load in my conky, and while researching methods to display load, I found a command that - while requiring sudo - worked to print the GPU load to the terminal (sudo cat /sys/kernel/debug/dri/64/amdgpu_pm_info). Conky cannot run sudo commands, so I attempted to both:

  1. use visudo to allow myself access to the /sys/kernel/debug/dri/64 folder without having to enter the sudo password, and
  2. use chown to modify the permissions of the file to a+rwx.

Neither of these methods seemed to work to allow me to use the command without entering the sudo password, however.

All help is appreciated!

  • Just a question, why do you use sudo in the first place ? What does stat /sys/kernel/debug/dri/64/amdgpu_pm_info tells you ? – Sergiy Kolodyazhnyy Mar 15 '17 at 5:13
  • @Serg stat: cannot stat '/sys/kernel/debug/dri/64/amdgpu_pm_info': Permission denied – CodeRead Mar 15 '17 at 5:15
  • Also, how exactly did you modify sudeors? – muru Mar 15 '17 at 5:18
  • @muru, I added the line %username% ALL=(ALL) NOPASSWD: /sys/kernel/debug/dri/64 (and a variant in which amdgpu_pm_info was appended to the end of that line) with no change -- still prompted for a password. – CodeRead Mar 15 '17 at 5:27
  • 1
    Your sudoers line is incorrect in couple of aspects. One, the format is username ALL=(ALL) NOPASSWD: command. It's supposed to be for allowing executing a file. In your case, your goal is not executing a program file, but rather to read it. I think we can make a simple workaround for your case, but I'll have to post it tomorrow. Late night here – Sergiy Kolodyazhnyy Mar 15 '17 at 6:06
0

I'm trying to do the same, accessing this file from a shell script. Nothing works, even setting u+s permissions to the shell script. Only running the script itself with sudo works.

UPDATE:

I found this to work:

sudo chmod a+rx /sys/kernel/debug

You must do it exactly like this (incomplete path). Works for me.

| improve this answer | |

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.