Unable to read Intel RAPL files for CPU power : Permission denied
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 323
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 12
Description
Description
Due to a security issue all Linux distributions are changing right permission of the RAPL file, used by Code Carbon for CPU power. After updating the file could be read only by root.
There is a workaround, thanks to https://github.com/prometheus/node_exporter/issues/1892 :
sudo apt install sysfsutils- Add this line in
/etc/sysfs.conf:mode class/powercap/intel-rapl:0/energy_uj = 0444 - reboot
Without rebooting you could do sudo chmod -R a+r /sys/class/powercap/intel-rapl but it will be lost at next boot.
But you need root access to do this. Following https://github.com/mlco2/codecarbon/issues/232 that has been closed by a PR that reduce errors logs, I create this issue to find a workaround that don't need to be root.
We could use the CPU load and apply it to the CPU TDP, but it is not so simple as shown here https://medium.com/teads-engineering/estimating-aws-ec2-instances-power-consumption-c9745e347959
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Linux Intel RAPL permission-denied behavior described in the issue and reading linked issue #232 and the node_exporter discussion. Done means identifying a viable workaround that allows CPU power measurement without requiring root; no source file or test is named, so the implementation scope needs investigation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- operating-systems, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100