georgewhewell / undervolt

Undervolt Intel CPUs under Linux
Other
1.53k stars 106 forks source link

Error: could not insert 'msr' #46

Open nrthIxne opened 5 years ago

nrthIxne commented 5 years ago

So I tried to use this in order to undervolt my i7-8750H as it puts out a little too much heat for my liking. However, when i type:

undervolt -r

I get the following error:

modprobe: ERROR: could not insert 'msr': Operation not permitted Traceback (most recent call last): File "/home/stefan/anaconda3/bin/undervolt", line 11, in <module> sys.exit(main()) File "/home/stefan/anaconda3/lib/python3.7/site-packages/undervolt.py", line 231, in main subprocess.check_call(['modprobe', 'msr']) File "/home/stefan/anaconda3/lib/python3.7/subprocess.py", line 341, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['modprobe', 'msr']' returned non-zero exit status 1.

I installed msr-tools and when i type sudo undervolt -r it tells me sudo: undervolt: Command not found. Does anybody have any idea on how to fix this? Any help is greatly appreciated.

felipemello1 commented 5 years ago

I used synaptic to install msr-tools

I also did: sudo modprobe msr

After that, the message changed to: Traceback (most recent call last): File "/home/felipemello/anaconda3/bin/undervolt", line 11, in sys.exit(main()) File "/home/felipemello/anaconda3/lib/python3.7/site-packages/undervolt.py", line 271, in main tjunc=read_temperature(), File "/home/felipemello/anaconda3/lib/python3.7/site-packages/undervolt.py", line 157, in read_temperature return (read_msr(0x1a2) & (127 << 24)) >> 24 File "/home/felipemello/anaconda3/lib/python3.7/site-packages/undervolt.py", line 54, in read_msr f = os.open(n, os.O_RDONLY) PermissionError: [Errno 13] Permission denied: '/dev/cpu/0/msr'

I believe it is because of the Secure Boot. I am thinking about disabling it, but I am not sure if it is unsafe.

However this guy here said that he disabled it and it didn't work:

tiziw, from iuvolt, said here this: "In the notebookreview thread linked in credits someone noted that if Secure Boot is enabled wrmsr does not work as the writes are blocked from userspace.

In order for it to still work you'll have to either recompile the msr module or recompile the whole kernel if the module built into the kernel. You will have to either disable Secure Boot or recompile msr with the the patch mentioned here."

Hedronmx commented 5 years ago

I already disabled secure boot and the same error occurs
PermissionError: [Errno 13] Permission denied: '/dev/cpu/0/msr'

Alecppt commented 5 years ago

one alternative is to use intel-undervolt . I had the same error as well and disabling secure boot could not solve the problem. However, intel-undervolt works without msr permission error. Tested on xps 9570.

georgewhewell commented 5 years ago

try sudo $(which undervolt) -r

you don't need msr-tools or modprobe msr (script will do that for you)

pahenn commented 5 years ago

I'm trying to use this workaround with the walkthrough to create a startup service, but I'm getting the following error

` ✘  ~  systemctl status undervolt.service Warning: The unit file, source configuration file or drop-ins of undervolt.service changed on disk. Run 'systemctl daemo ● undervolt.service - undervolt Loaded: loaded (/etc/systemd/system/undervolt.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2019-01-30 19:07:37 CST; 4s ago Process: 5390 ExecStart=/usr/bin/sudo $(which undervolt) -v --core -150 --cache -150 --gpu -50 (code=exited, status=1/ Main PID: 5390 (code=exited, status=1/FAILURE)

Jan 30 19:07:37 pop-os systemd[1]: Starting undervolt... Jan 30 19:07:37 pop-os sudo[5390]: sudo: undervolt): command not found Jan 30 19:07:37 pop-os systemd[1]: undervolt.service: Main process exited, code=exited, status=1/FAILURE Jan 30 19:07:37 pop-os systemd[1]: undervolt.service: Failed with result 'exit-code'. Jan 30 19:07:37 pop-os systemd[1]: Failed to start undervolt. lines 1-12/12 (END) `

Any suggestions?

georgewhewell commented 5 years ago

@pahennessey find the path to undervolt.py with which undervolt and put that path in the service file, don't use which in the service file.

pahenn commented 5 years ago

Of course, @georgewhewell , the obvious answer! Thanks!

sjpatel21 commented 5 years ago

I also got this error and I fixed by running it with sudo: sudo undervolt --read

eugenkaltenegger commented 5 years ago

Had the same error message as @Ostkreutz . sudo undervolt --read gave me the following error: sudo: undervolt: command not found moving the executable from home/myname/.local/bin to /bin solved the problem. Now I can run undervolt with sudo permissions. I still get the permission error when I run it without root permissions. Its also possible to add undervolt to the sudoers list (in /etc/ directory). Doing so makes moving redundant.

NicolasNewman commented 5 years ago

@Coffeecoder Alternatively, you could install it via sudo pip install undervolt

dashart-ke commented 5 years ago

I had the same issue. After disabling secure boot undervolt was working as expected again. XPS 7590 with i7-9750H (please add to list of working devices ;) ).

But this is already noted in the README file.