georgewhewell / undervolt

Undervolt Intel CPUs under Linux
Other
1.55k stars 107 forks source link

Operation not permitted #16

Closed greenlaw110 closed 6 years ago

greenlaw110 commented 6 years ago

Console log:

root@luog-X510UQR:/opt/undervolt# ./undervolt.py --read
temperature target: -5 (95C)
Traceback (most recent call last):
  File "./undervolt.py", line 257, in <module>
    main()
  File "./undervolt.py", line 252, in main
    voltage = read_offset(plane)
  File "./undervolt.py", line 167, in read_offset
    write_msr(value_to_write)
  File "./undervolt.py", line 40, in write_msr
    os.write(f, pack('Q', val))
OSError: [Errno 1] Operation not permitted

System:

georgewhewell commented 6 years ago

Try with ‘sudo’

On 18 Jul 2018, at 00:29, Green Luo notifications@github.com wrote:

Console log:

root@luog-X510UQR:/opt/undervolt# ./undervolt.py --read temperature target: -5 (95C) Traceback (most recent call last): File "./undervolt.py", line 257, in main() File "./undervolt.py", line 252, in main voltage = read_offset(plane) File "./undervolt.py", line 167, in read_offset write_msr(value_to_write) File "./undervolt.py", line 40, in write_msr os.write(f, pack('Q', val)) OSError: [Errno 1] Operation not permitted System:

ASUS K510U - i7 8550U Linuxmint 19 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

greenlaw110 commented 6 years ago

I was running that with root

codemunin commented 6 years ago

Same Problem on Ubuntu 16.04. Tried: sudo python python3 pip and git clone

Output of sudo python3 undervolt.py -v -r: INFO:root:Read 0x640000 from /dev/cpu/0/msr INFO:root:Read 0x640000 from /dev/cpu/0/msr temperature target: -0 (100C) INFO:root:Writing 0x8000041000000000 to /dev/cpu/7/msr Traceback (most recent call last): File "undervolt.py", line 257, in main() File "undervolt.py", line 252, in main voltage = read_offset(plane) File "undervolt.py", line 167, in read_offset write_msr(value_to_write) File "undervolt.py", line 40, in write_msr os.write(f, pack('Q', val)) PermissionError: [Errno 1] Operation not permitted

georgewhewell commented 6 years ago

@greenlaw110 Ah, sorry- didn't see you already used root.

That's strange- could you try rdmsr 0x150 (from msr-tools package)? What's your kernel version?

codemunin commented 6 years ago

Kernel Version: 4.13.0-45-generic

I just edited the undervolt.py so that its not trying to os.write.

Then the read goes fine, but i can't undervolt.

sudo rdmsr 0x150 results in just: 0

codemunin commented 6 years ago

okay i tried manually a -50mV undervolt and this happend: sudo wrmsr 0x150 0x80000011F9A00000 wrmsr: pwrite: Operation not permitted

georgewhewell commented 6 years ago

@codemunin Hm, could you check if you have 'Secure Boot' enabled in BIOS- and if so, try disabling it? From a quick googling it appears that linux prevents any writes to MSR from userspace when using UEFI secure boot.

codemunin commented 6 years ago

i found this one, too. so if I disable secure boot it's running fine.

so i have to find a way to edit msr while secure boot is on, since my integraded graphics don't runs when secure boot is disabled.

so solved for me (but if you have any suggestions how to make the intel card running with disabled secure boot or make msr writeable, while secure boot is on - your welcome)

Thanks so far!

georgewhewell commented 6 years ago

Maybe you can try sudo capsh --caps="cap_sys_rawio+ep" -- undervolt -r- I expect that kernel will refuse to grant this capability in secure boot mode though. Sorry I cannot help- not familiar with these things really

syzzer commented 4 years ago

This caught me too while trying to increase battery life by undervolting, but actually it makes sense to not allow userland to undervolt a system. Undervolting could cause failures, and failures can lead to security issues. Just consider the recent Plundervolt attack: https://plundervolt.com/.