Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i/builtin/power-control: add paths for battery charging thresholds to power-control interface #13722

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

AdnanHodzic
Copy link
Contributor

@AdnanHodzic AdnanHodzic commented Mar 17, 2024

auto-cpufreq project has had snap package for few years now, and with release of 2.2.0 which adds functionality to set battery charging thresholds, its snap package is in broken state since.

Reason for this is because hardware-observe interface doesn't have ability to write to /sys/class/power_supply/. This was discussion and this PR was suggested as part of Snapcraft forum: Request for kernel-module-control interface for auto-cpufreq by @alexmurray

Currently only 2 locations auto-cpufreq will need to write to are:

/sys/class/power_supply/BAT*/charge_start_threshold
/sys/class/power_supply/BAT*/charge_stop_threshold

but this list might extended in future.

Since this is my first contribution to snapd, I hope I've made the right changes, as this is how I interpreted where & how changes should be made. If not please let me know what I need to fix/improve.

Thanks!

Adnan

Copy link

github-actions bot commented Mar 17, 2024

Everyone contributing to this PR have now signed the CLA. Thanks!

@AdnanHodzic
Copy link
Contributor Author

PR failed on CLA check, because I didn’t fill out the Contributor agreement form. Which I did do afterwards as individual contributor and since I didn’t know what to fill out in “Please add the Canonical Project Manager or contact” field I put your name here @alexmurray.

I see @kenvandine volunteered himself for this field in another (same) issue someone encountered, and could be someone I could refer to but I went with Alex :)

If I did this step right, is there to re-run this step or I need to re-create this PR?

Copy link
Collaborator

@alexmurray alexmurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdnanHodzic Thanks for this but it is the wrong interface - hardware-observe should not be granting write permission - instead can this please be added to the power-control interface as I suggested previously? https://forum.snapcraft.io/t/request-for-kernel-module-control-interface-for-auto-cpufreq/38953/12 Thanks.

@AdnanHodzic
Copy link
Contributor Author

AdnanHodzic commented Mar 18, 2024

@AdnanHodzic Thanks for this but it is the wrong interface - hardware-observe should not be granting write permission - instead can this please be added to the power-control interface as I suggested previously? https://forum.snapcraft.io/t/request-for-kernel-module-control-interface-for-auto-cpufreq/38953/12 Thanks.

@alexmurray I apologize for misunderstanding, changes amended and pushed.

P.S: unfortunately, CLA check step is still failing.

@AdnanHodzic AdnanHodzic changed the title Add paths for battery charging thresholds to hardware-observe interface Add paths for battery charging thresholds to power-control interface Mar 18, 2024
Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Copy link
Member

@Meulengracht Meulengracht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@zyga
Copy link
Collaborator

zyga commented Mar 18, 2024

I re-ran the CLA check but it failed again. I don't quite know how that works (how soon is the check able to see the data). Let's wait 24 hours, rebase on master and push - we've landed a bunch of fixes ahead of release so this will both give us another chance to see the data and give us a view of any impact / failures.

@@ -49,6 +49,10 @@ const powerControlConnectedPlugAppArmor = `

# for android kernels, see https://android.googlesource.com/kernel/msm/+/android-msm-bullhead-3.10-marshmallow-dr/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt
/sys/module/lpm_levels/parameters/sleep_disabled rw,

# Needed for ACPI modules to read and set values for battery charging thresholds
/sys/class/power_supply/BAT{,*}/charge_start_threshold rw,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ realpath /sys/class/power_supply/BAT0/charge_stop_threshold  
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1b/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_stop_threshold

AppArmor evaluates files based on their canonical name, so I think instead you might need something like:

/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,

You can test this by editing the existing snap profile for auto-cpufreq which should be at /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq

And then reloading it via:

sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq

Let me know what you find.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made and pushed suggested changes as:

/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw, definitely makes more sense.

You can test this by editing the existing snap profile for auto-cpufreq which should be at /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq

for auto-cpufreq under /var/lib/snapd/apparmor/profiles there are a few files:

snap.auto-cpufreq.auto-cpufreq
snap.auto-cpufreq.auto-cpufreq-gtk
snap.auto-cpufreq.hook.configure
snap.auto-cpufreq.service
snap-update-ns.auto-cpufreq

What I'm looking for exactly am I looking to test as part of these files as some of them are over 1000 lines.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you should add that line:

/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,

to all of the snap.auto-cpufreq.* profiles, then reload them via sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.xxx and check that things work as you expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rebuilt snap package locally, using the latest snapcraft.yaml contents on master branch.

I installed it using --dangerous flag, i.e sudo snap install auto-cpufreq_2.2.0_amd64.snap --dangerous

I've added:

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,

right before } to every file that had mention of auto-cpufreq under /var/lib/snapd/apparmor/profiles except snap-update-ns.auto-cpufreq

Completely list I added these lines to:

snap.auto-cpufreq.auto-cpufreq
snap.auto-cpufreq.auto-cpufreq-gtk
snap.auto-cpufreq.hook.configure
snap.auto-cpufreq.service

Reloaded each one of the above files with sudo apparmor_parser -r but running auto-cpufreq still failed, i.e:

sudo auto-cpufreq --live

Using settings defined in /etc/auto-cpufreq.conf file

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

PermissionError(13, 'Permission denied')
Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 6.5.0-25-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4600 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0      0.0%       nan °C      4096 MHz
CPU1      2.0%       nan °C      4542 MHz
CPU2      1.0%       nan °C      4380 MHz
CPU3      4.0%       nan °C       400 MHz
CPU4      2.0%       nan °C      4475 MHz
CPU5      1.0%       nan °C       400 MHz
CPU6      0.0%       nan °C       400 MHz
CPU7      0.0%       nan °C      4292 MHz

---------------------------- CPU frequency scaling ----------------------------

Traceback (most recent call last):
  File "/snap/auto-cpufreq/x2/bin/auto-cpufreq", line 8, in <module>
    sys.exit(main())
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/auto_cpufreq/bin/auto_cpufreq.py", line 139, in main
    set_autofreq()
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/auto_cpufreq/core.py", line 1146, in set_autofreq
    elif charging():
  File "/snap/auto-cpufreq/x2/lib/python3.10/site-packages/auto_cpufreq/core.py", line 331, in charging
    with open(Path(power_supply_path + supply + "/type")) as f:
PermissionError: [Errno 13] Permission denied: '/sys/class/power_supply/AC/type'

Which seems to be the same problem that I was mentioning in forum post.

What I did then is I uploaded the latest snap build to beta channel snapcraft upload auto-cpufreq_2.2.0_amd64.snap --release beta and re-installed auto-cpufreq from beta channel sudo snap install auto-cpufreq --channel=beta and re-ran the same command:

sudo auto-cpufreq --live

Using settings defined in /etc/auto-cpufreq.conf file

Note: You can quit live mode by pressing "ctrl+c"
Traceback (most recent call last):
  File "/snap/auto-cpufreq/150/bin/auto-cpufreq", line 8, in <module>
    sys.exit(main())
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/auto_cpufreq/bin/auto_cpufreq.py", line 122, in main
    battery_setup()
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/auto_cpufreq/battery_scripts/battery.py", line 41, in battery_setup
    if lsmod("thinkpad_acpi"):
  File "/snap/auto-cpufreq/150/lib/python3.10/site-packages/auto_cpufreq/battery_scripts/battery.py", line 10, in lsmod
    output = subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'lsmod'

After I moved config file, sudo mv /etc/auto-cpufreq.conf /tmp and re-ran auto-cpufreq, its run looked lot more successful then before:

sudo auto-cpufreq --live

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

Linux distro: Ubuntu 23.10 (Mantic Minotaur)
Linux kernel: 6.5.0-25-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 800 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0     10.0%        49 °C       800 MHz
CPU1     20.4%        51 °C       800 MHz
CPU2      9.3%        49 °C       800 MHz
CPU3     10.3%        51 °C       800 MHz
CPU4     11.3%        49 °C       801 MHz
CPU5     16.5%        51 °C       800 MHz
CPU6      8.2%        49 °C       800 MHz
CPU7     10.1%        51 °C       800 MHz

CPU fan speed: 0 RPM

---------------------------- CPU frequency scaling ----------------------------

Battery is: charging

Setting to use: "performance" governor
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
/snap/auto-cpufreq/150/usr/bin/cpufreqctl.auto-cpufreq: line 105: echo: write error: Device or resource busy
Setting to use: "balance_performance" EPP
Setting maximum CPU frequency to 4600 Mhz

Total CPU usage: 11.8 %
Total system load: 1.83
Average temp. of all cores: 50.00 °C 

High CPU load (load average: 1.83, 1.15, 1.05)
setting turbo boost: on

-------------------------------------------------------------------------------

                "auto-cpufreq" is about to refresh ..

But as I said in forum post, if I install previous auto-cpufreq 2.0.0 version from (stable) release, it'll run just fine without any errors using this same config file. As also mentioned in blog, I think the only big change that was added to config file since v2.2.0 release is ability to limit battery charging threshold.

@Meulengracht Meulengracht changed the title Add paths for battery charging thresholds to power-control interface i/builtin/power-control: add paths for battery charging thresholds to power-control interface Mar 18, 2024
@Meulengracht Meulengracht reopened this Mar 18, 2024
@AdnanHodzic
Copy link
Contributor Author

I re-ran the CLA check but it failed again. I don't quite know how that works (how soon is the check able to see the data). Let's wait 24 hours, rebase on master and push - we've landed a bunch of fixes ahead of release so this will both give us another chance to see the data and give us a view of any impact / failures.

@zyga today around 12CET I got an email that I got added to "contributor-agreement-canonical" and it gets past CLA check now.

Only thing that remains is a change @alexmurray requested, which I did.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.90%. Comparing base (a5a6458) to head (8c76fc5).
Report is 7 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13722      +/-   ##
==========================================
- Coverage   78.90%   78.90%   -0.01%     
==========================================
  Files        1043     1043              
  Lines      134337   134345       +8     
==========================================
+ Hits       106004   106010       +6     
  Misses      21721    21721              
- Partials     6612     6614       +2     
Flag Coverage Δ
unittests 78.90% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexmurray
Copy link
Collaborator

The details above still don't necessarily convince me that this is working as expected - I think we really need to see the following:

  1. install the snap without any changes to the apparmor profile, run https://snapcraft.io/snappy-debug then run auto-cpufreq and capture the DENIALS which get logged.
  2. check that the DENIALS mention paths like /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1b/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_stop_threshold
  3. edit the apparmor profile to add the proposed rules:
/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
  1. reload the apparmor profile
  2. rerun auto-cpufreq and capture DENIALS via snappy-debug again and check that there is now no mention of any denial for the affected file

@AdnanHodzic
Copy link
Contributor Author

The details above still don't necessarily convince me that this is working as expected - I think we really need to see the following:

  1. install the snap without any changes to the apparmor profile, run https://snapcraft.io/snappy-debug then run auto-cpufreq and capture the DENIALS which get logged.
  2. check that the DENIALS mention paths like /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1b/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_stop_threshold
  3. edit the apparmor profile to add the proposed rules:
/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
  1. reload the apparmor profile
  2. rerun auto-cpufreq and capture DENIALS via snappy-debug again and check that there is now no mention of any denial for the affected file

Agreed, something is still not right.

I'm at KubeCon ATM and don't have access to my private laptop, hence it'll take me some time to check this myself.

In meantime I'll ask one of the project contributors if they can check this. Just as heads up if any other names then mine start making comments to the PR.

@AdnanHodzic
Copy link
Contributor Author

@alexmurray I finally got to what was requested of me:

The details above still don't necessarily convince me that this is working as expected - I think we really need to see the following:

  1. install the snap without any changes to the apparmor profile, run https://snapcraft.io/snappy-debug then run auto-cpufreq and capture the DENIALS which get logged.
  2. check that the DENIALS mention paths like /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1b/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_stop_threshold

Example denial looks like:

= AppArmor =
Time: 2024-03-29T07:4
Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type" pid=544772 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
File: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type (read)
Suggestions:
* adjust program to not access '/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type'
* adjust program to not access '/sys/devices/LNXSYSTM:[0-9]*/LNXSYBUS:[0-9]*/PNP[0-9]*A[0-9]*:[0-9]*/device:[0-9]*/PNP[0-9]*C[0-9]*:[0-9]*/ACPI[0-9]*:[0-9]*/power_supply/AC/type'

You can see the contents of whole file here.

  1. edit the apparmor profile to add the proposed rules:
/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
  1. reload the apparmor profile
  2. rerun auto-cpufreq and capture DENIALS via snappy-debug again and check that there is now no mention of any denial for the affected file

Example denial looks like:

= AppArmor =
Time: 2024-03-29T07:5
Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type" pid=550652 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
File: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type (read)
Suggestions:
* adjust program to not access '/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type'
* adjust program to not access '/sys/devices/LNXSYSTM:[0-9]*/LNXSYBUS:[0-9]*/PNP[0-9]*A[0-9]*:[0-9]*/device:[0-9]*/PNP[0-9]*C[0-9]*:[0-9]*/ACPI[0-9]*:[0-9]*/power_supply/AC/type'

Which looks the same to me as before apparmor profile changes? Hence I'm either doing something wrong or changes aren't applied accordingly.

You can see the contents of whole file here.

Hope this helps ...

@jslarraz
Copy link
Collaborator

jslarraz commented Apr 2, 2024

Hi @AdnanHodzic

This line

Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type" pid=544772 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

indicates that your application also need (at least read) access to

/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type

which is not granted by the proposed apparmor rules

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,

Could you give it a try also including (in addition to previous ones) following apparmor rule to see if anything changes?

/sys/devices/**/power_supply/AC/type r,

Thanks!

@ernestl ernestl added the Needs security review Can only be merged once security gave a :+1: label Apr 12, 2024
@AdnanHodzic
Copy link
Contributor Author

AdnanHodzic commented Apr 27, 2024

Hi @AdnanHodzic

This line

Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type" pid=544772 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

indicates that your application also need (at least read) access to

/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC/type

which is not granted by the proposed apparmor rules

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,

Could you give it a try also including (in addition to previous ones) following apparmor rule to see if anything changes?

/sys/devices/**/power_supply/AC/type r,

Thanks!

Hi @jslarraz!

I apologize for such delayed reply, I was travelling for work last few weeks and didn't have access to my private laptop.

Regardless, I did what you suggested here, I've appended /sys/devices/**/power_supply/AC/type r, line, but then I was facing following issue:

sudo auto-cpufreq --live

Using settings defined in /etc/auto-cpufreq.conf file

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

PermissionError(13, 'Permission denied')
Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 6.8.0-31-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4600 MHz
CPU min frequency: 400 MHz

Core	Usage	Temperature	Frequency
CPU0      8.1%       nan °C      2800 MHz
CPU1     21.2%       nan °C      2800 MHz
CPU2     31.0%       nan °C      2800 MHz
CPU3     20.2%       nan °C      2801 MHz
CPU4      9.1%       nan °C       400 MHz
CPU5     28.7%       nan °C      2800 MHz
CPU6     13.0%       nan °C      2800 MHz
CPU7      6.1%       nan °C      2799 MHz

---------------------------- CPU frequency scaling ----------------------------

Traceback (most recent call last):
  File "/snap/auto-cpufreq/x1/bin/auto-cpufreq", line 8, in <module>
    sys.exit(main())
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/bin/auto_cpufreq.py", line 139, in main
    set_autofreq()
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/core.py", line 1153, in set_autofreq
    elif charging():
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/core.py", line 343, in charging
    with open(Path(power_supply_path + supply + "/online")) as f:
PermissionError: [Errno 13] Permission denied: '/sys/class/power_supply/AC/online'

Which I fixed by appending /sys/devices/**/power_supply/AC/online r, line, so this was a full block of changes:

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,·
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,·
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,

that I made to:

/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq-gtk
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.hook.configure
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.service
/var/lib/snapd/apparmor/profiles/snap-update-ns.auto-cpufreq

However, while now the app doesn't crash, I'm still facing permission issues, i.e:

sudo auto-cpufreq --live

Using settings defined in /etc/auto-cpufreq.conf file

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

PermissionError(13, 'Permission denied')
Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 6.8.0-31-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4600 MHz
CPU min frequency: 400 MHz

Core	Usage	Temperature	Frequency
CPU0     12.1%       nan °C      3100 MHz
CPU1      7.0%       nan °C      3100 MHz
CPU2     22.8%       nan °C       400 MHz
CPU3      8.1%       nan °C      3104 MHz
CPU4     14.0%       nan °C       400 MHz
CPU5     34.7%       nan °C      3100 MHz
CPU6      4.0%       nan °C      3100 MHz
CPU7      5.1%       nan °C      3100 MHz

---------------------------- CPU frequency scaling ----------------------------

Battery is: charging

Setting to use: "performance" governor
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference: Permission denied
Setting to use: "balance_performance" EPP

Total CPU usage: 25.8 %
Total system load: 1.76
Average temp. of all cores: nan °C 

High CPU load (load average: 1.76, 1.99, 2.09)
setting turbo boost: on
Warning: Changing CPU turbo is not supported. Skipping.

-------------------------------------------------------------------------------

		"auto-cpufreq" is about to refresh ..

and "Temperatures" are being reported as nan °C. I tried appending /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor rw, but that didn't result in getting rid of i.e:

/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied

Hence looking forward to hear if you have any other suggestions how to resolve this issue.

@jslarraz
Copy link
Collaborator

Could you please share DENIALS captured via snappy-debug when you running auto-cpufreq with the new set of app armor rules?

@AdnanHodzic
Copy link
Contributor Author

Could you please share DENIALS captured via snappy-debug when you running auto-cpufreq with the new set of app armor rules?

Most of the denials revolved around:

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/proc/389103/cmdline" pid=389560 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000
File: /proc/389103/cmdline (read)
Suggestion:
* adjust program to not access '@{PROC}/@{pid}/cmdline'

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/proc/389151/cmdline" pid=389560 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000
File: /proc/389151/cmdline (read)
Suggestion:
* adjust program to not access '@{PROC}/@{pid}/cmdline'

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=389560 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/proc/389234/cmdline" pid=389560 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000
File: /proc/389234/cmdline (read)
Suggestion:
* adjust program to not access '@{PROC}/@{pid}/cmdline'

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=389560 comm="python3" requested_mask="read" denied_mask="read" peer="snap.snappy-debug.snappy-debug"
Ptrace: peer=snap.snappy-debug.snappy-debug (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-01T10:0
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=389560 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

Which is weird since system-observe is already part of snapcraft.yaml.

@jslarraz
Copy link
Collaborator

jslarraz commented May 2, 2024

So, I think that operation="ptrace" class="ptrace" are safe to ignore. However, cmdline related ones looks more interesting

Log: apparmor="DENIED" operation="open" class="file" profile="snap.auto-cpufreq.auto-cpufreq" name="/proc/389234/cmdline" pid=389560 comm="python3" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000
File: /proc/389234/cmdline (read)

Those are certainly unexpected as it should be allowed by the template.

Could you please confirm that this rule effectively ended up in your application profile?

cat /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq | grep cmdline

Output should contain owner @{PROC}/@{pid}/cmdline r,

The only thing that comes to my mind already is that the denial may be related to running the application as sudo. Could you please add the following rule (note it does not contain the owner prefix) to your application profile, reload it and rerun the application?

@{PROC}/@{pid}/cmdline r,

Thanks

@AdnanHodzic
Copy link
Contributor Author

Could you please confirm that this rule effectively ended up in your application profile?

cat /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq | grep cmdline

Output should contain owner @{PROC}/@{pid}/cmdline r,

cat /var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq | grep cmdline
  # LP: #1546825 for details). comm is a subset of cmdline, so allow it too.
  owner @{PROC}/@{pid}/cmdline r,
  @{PROC}/cmdline r,

The only thing that comes to my mind already is that the denial may be related to running the application as sudo. Could you please add the following rule (note it does not contain the owner prefix) to your application profile, reload it and rerun the application?

@{PROC}/@{pid}/cmdline r,

I've added following block:

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,
@{PROC}/@{pid}/cmdline r, 

to following files:

/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq-gtk
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.hook.configure
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.service
/var/lib/snapd/apparmor/profiles/snap-update-ns.auto-cpufreq

Reloaded each file with sudo apparmor_parser -r and output I still get is the same:

sudo auto-cpufreq --live                                                            

Using settings defined in /etc/auto-cpufreq.conf file

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

PermissionError(13, 'Permission denied')
Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 6.8.0-31-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 800 MHz
CPU min frequency: 400 MHz

Core	Usage	Temperature	Frequency
CPU0      8.0%       nan °C       800 MHz
CPU1      6.1%       nan °C       800 MHz
CPU2     10.1%       nan °C       800 MHz
CPU3      3.1%       nan °C       800 MHz
CPU4      7.1%       nan °C       800 MHz
CPU5      5.1%       nan °C       800 MHz
CPU6     29.7%       nan °C       800 MHz
CPU7      2.0%       nan °C       800 MHz

---------------------------- CPU frequency scaling ----------------------------

Traceback (most recent call last):
  File "/snap/auto-cpufreq/x1/bin/auto-cpufreq", line 8, in <module>
    sys.exit(main())
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/bin/auto_cpufreq.py", line 140, in main
    set_autofreq()
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/core.py", line 1144, in set_autofreq
    elif charging():
  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/core.py", line 329, in charging
    with open(Path(power_supply_path + supply + "/type")) as f:
PermissionError: [Errno 13] Permission denied: '/sys/class/power_supply/BAT0/type'

@jslarraz
Copy link
Collaborator

jslarraz commented May 3, 2024

So it seems we are still missing at least the following rule

/sys/devices/**/power_supply/BAT[0-9]*/type r,

@AdnanHodzic
Copy link
Contributor Author

So it seems we are still missing at least the following rule

/sys/devices/**/power_supply/BAT[0-9]*/type r,

besides this one I also needed to add /sys/devices/**/power_supply/BAT[0-9]*/status r, otherwise it would fail with

  File "/snap/auto-cpufreq/x1/lib/python3.10/site-packages/auto_cpufreq/core.py", line 345, in charging
    with open(Path(power_supply_path + supply + "/status")) as f:
PermissionError: [Errno 13] Permission denied: '/sys/class/power_supply/BAT0/status'

Final list of all rules added is now:

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/type r,
/sys/devices/**/power_supply/BAT[0-9]*/status r,                                                          
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,
@{PROC}/@{pid}/cmdline r,

and with it I'll still end up getting a lot of "Permission denied"

sudo auto-cpufreq --live                                             

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

PermissionError(13, 'Permission denied')
Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 6.8.0-31-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 800 MHz
CPU min frequency: 400 MHz

Core	Usage	Temperature	Frequency
CPU0     26.3%       nan °C       800 MHz
CPU1      6.1%       nan °C       800 MHz
CPU2      2.0%       nan °C       800 MHz
CPU3      1.0%       nan °C       800 MHz
CPU4      4.0%       nan °C       800 MHz
CPU5      8.1%       nan °C       800 MHz
CPU6      3.0%       nan °C       800 MHz
CPU7      3.0%       nan °C       800 MHz

---------------------------- CPU frequency scaling ----------------------------

Battery is: discharging

Setting to use: "powersave" governor
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference: Permission denied
Setting to use: "balance_power" EPP
Setting maximum CPU frequency to 4600 Mhz
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq: Permission denied
/snap/auto-cpufreq/x1/usr/bin/cpufreqctl.auto-cpufreq: line 105: /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq: Permission denied

Total CPU usage: 19.9 %
Total system load: 2.28
Average temp. of all cores: nan °C 

High CPU load (load average: 2.28, 1.69, 1.44)
setting turbo boost: off
Warning: Changing CPU turbo is not supported. Skipping.

-------------------------------------------------------------------------------

		"auto-cpufreq" is about to refresh ..

List of of few snappy denials:

kernel.printk_ratelimit = 0
= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.canonical-livepatch.canonical-livepatchd"
Ptrace: peer=snap.canonical-livepatch.canonical-livepatchd (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.multipass.multipassd"
Ptrace: peer=snap.multipass.multipassd (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="capable" class="cap" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" capability=19  capname="sys_ptrace"
Capability: sys_ptrace
Suggestions:
* adjust program to not require 'CAP_SYS_PTRACE' (see 'man 7 capabilities')
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="multipass.snapcraft-auto-cpufreq.qemu-system-x86_64"
Ptrace: peer=multipass.snapcraft-auto-cpufreq.qemu-system-x86_64 (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="/usr/sbin/cupsd"
Ptrace: peer=/usr/sbin/cupsd (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.cups.cupsd"
Ptrace: peer=snap.cups.cupsd (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.cups.cups-browsed"
Ptrace: peer=snap.cups.cups-browsed (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.cups.cupsd"
Ptrace: peer=snap.cups.cupsd (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="snap.cups.cups-browsed"
Ptrace: peer=snap.cups.cups-browsed (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

= AppArmor =
Time: 2024-05-03T09:5
Log: apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.auto-cpufreq.auto-cpufreq" pid=416906 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
Ptrace: peer=unconfined (read)
Suggestions:
* add 'system-observe' to 'plugs'
* do nothing if program otherwise works properly

@jslarraz
Copy link
Collaborator

jslarraz commented May 3, 2024

Is your snap plugging cpu-control interface? If not, could you please add that plug and give it another try?

Note that connecting a new interface will make snapd to recreate the apparmor profile, so you will need to add the rules in discussion afterward again

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw,
/sys/devices/**/power_supply/BAT[0-9]*/type r,
/sys/devices/**/power_supply/BAT[0-9]*/status r,                                                          
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,
@{PROC}/@{pid}/cmdline r,

@AdnanHodzic
Copy link
Contributor Author

Is your snap plugging cpu-control interface? If not, could you please add that plug and give it another try?

Yes it is, current snapcraft.yaml looks like:

name: auto-cpufreq
base: core22
summary: Automatic CPU speed & power optimizer for Linux
description: |
  Automatic CPU speed & power optimizer for Linux based on active
  monitoring of laptop's battery state, CPU usage and system load.
  Ultimately allowing you to improve battery life without making
  any compromises.

license: LGPL-3.0
grade: stable
confinement: strict
adopt-info: auto-cpufreq

compression: lzo

architectures:
  - build-on: [amd64]
    build-for: [amd64]
  - build-on: [amd64]
    build-for: [arm64]

parts:
  auto-cpufreq:
    plugin: python
    python-packages:
       - setuptools
       - wheel
       - requests
    build-packages:
       - gcc
       - python3-dev
    stage-packages:
       - coreutils
       - dmidecode
       - pkexec
    source: .
    override-pull: |
      snapcraftctl pull
      snapcraftctl set-version `grep ^version $SNAPCRAFT_PART_SRC/pyproject.toml | sed 's/.*"\(.*\)"/\1/'`

  deploy-scripts:
    plugin: dump
    source: scripts
    organize:
      cpufreqctl.sh: usr/bin/cpufreqctl.auto-cpufreq
      snapdaemon.sh: usr/bin/snapdaemon

  copy-image:
    plugin: dump
    source: images

plugs:
   etc-auto-cpufreq-conf:
    interface: system-files
    write:
    - /etc/auto-cpufreq.conf

apps:
  auto-cpufreq:
    command: bin/auto-cpufreq
    environment:
      PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
      LC_ALL: C.UTF-8
      LANG: C.UTF-8
      PKG_MARKER: SNAP
    plugs:
      - cpu-control
      - system-observe
      - hardware-observe
      - etc-auto-cpufreq-conf

  auto-cpufreq-gtk:
    command: bin/auto-cpufreq-gtk
    extensions: [gnome]
    environment:
      PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
      LC_ALL: C.UTF-8
      LANG: C.UTF-8
      PKG_MARKER: SNAP
    plugs:
      - cpu-control
      - system-observe
      - hardware-observe
      - desktop
      - desktop-legacy
      - wayland
      - x11
  service:
    command: usr/bin/snapdaemon
    plugs:
      - cpu-control
      - system-observe
      - hardware-observe
    environment:
      LC_ALL: C.UTF-8
      LANG: C.UTF-8
      PKG_MARKER: SNAP
    daemon: simple

@jslarraz
Copy link
Collaborator

jslarraz commented May 6, 2024

Could you also please confirm that the interface is effectively connect by issuing snap connections auto-cpufreq?

I'm asking because cpu-control seems to include rules for the permissions denied you are observing (/sys/devices/system/cpu/cpufreq/policy*/scaling_governor,energy_performance_preference,scaling_max_freq )

@AdnanHodzic
Copy link
Contributor Author

Could you also please confirm that the interface is effectively connect by issuing snap connections auto-cpufreq?

I'm asking because cpu-control seems to include rules for the permissions denied you are observing (/sys/devices/system/cpu/cpufreq/policy*/scaling_governor,energy_performance_preference,scaling_max_freq )

Yes cpu-control plug is connected:

snap connections auto-cpufreq
Interface               Plug                                Slot                            Notes
content[gnome-42-2204]  auto-cpufreq:gnome-42-2204          gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   auto-cpufreq:gtk-3-themes           gtk-common-themes:gtk-3-themes  -
content[icon-themes]    auto-cpufreq:icon-themes            gtk-common-themes:icon-themes   -
content[sound-themes]   auto-cpufreq:sound-themes           gtk-common-themes:sound-themes  -
cpu-control             auto-cpufreq:cpu-control            -                               -
desktop                 auto-cpufreq:desktop                :desktop                        -
desktop-legacy          auto-cpufreq:desktop-legacy         :desktop-legacy                 -
gsettings               auto-cpufreq:gsettings              :gsettings                      -
hardware-observe        auto-cpufreq:hardware-observe       -                               -
opengl                  auto-cpufreq:opengl                 :opengl                         -
system-files            auto-cpufreq:etc-auto-cpufreq-conf  -                               -
system-observe          auto-cpufreq:system-observe         -                               -
wayland                 auto-cpufreq:wayland                :wayland                        -
x11                     auto-cpufreq:x11                    :x11                            -

@alexmurray
Copy link
Collaborator

@AdnanHodzic actually that output shows the interface is not connected - if it was it would look like

cpu-control             auto-cpufreq:cpu-control            :cpu-control                               manual

Can you please try running:

sudo snap connect auto-cpufreq:cpu-control

@AdnanHodzic
Copy link
Contributor Author

@AdnanHodzic actually that output shows the interface is not connected - if it was it would look like

cpu-control             auto-cpufreq:cpu-control            :cpu-control                               manual

Can you please try running:

sudo snap connect auto-cpufreq:cpu-control

My bad, I misinterpreted it and I just went through all plugs that were in snapcraft.yaml and connected them manually:

snap connections auto-cpufreq             
Interface               Plug                                Slot                            Notes
content[gnome-42-2204]  auto-cpufreq:gnome-42-2204          gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   auto-cpufreq:gtk-3-themes           gtk-common-themes:gtk-3-themes  -
content[icon-themes]    auto-cpufreq:icon-themes            gtk-common-themes:icon-themes   -
content[sound-themes]   auto-cpufreq:sound-themes           gtk-common-themes:sound-themes  -
cpu-control             auto-cpufreq:cpu-control            :cpu-control                    manual
desktop                 auto-cpufreq:desktop                :desktop                        -
desktop-legacy          auto-cpufreq:desktop-legacy         :desktop-legacy                 -
gsettings               auto-cpufreq:gsettings              :gsettings                      -
hardware-observe        auto-cpufreq:hardware-observe       :hardware-observe               manual
opengl                  auto-cpufreq:opengl                 :opengl                         -
system-files            auto-cpufreq:etc-auto-cpufreq-conf  :system-files                   manual
system-observe          auto-cpufreq:system-observe         :system-observe                 manual
wayland                 auto-cpufreq:wayland                :wayland                        -
x11                     auto-cpufreq:x11                    :x11                            -

Unfortunately, when I run sudo auto-cpufreq --live I get same errors as I did above ...

@AdnanHodzic
Copy link
Contributor Author

Hey @alexmurray @jslarraz, good news!

Today I made an auto-cpufreq v2.3.0 release and along with it pulled latest updates on my system (Ubuntu 24.04) that included some snapd changes. Rebuilt the .snap package, made necessary plug connections that are in my snapcraft.yaml, i.e:

sudo snap connect auto-cpufreq:cpu-control
sudo snap connect auto-cpufreq:system-observe
sudo snap connect auto-cpufreq:hardware-observe
sudo snap connect auto-cpufreq:etc-auto-cpufreq-conf
sudo snap connect auto-cpufreq:desktop
sudo snap connect auto-cpufreq:desktop-legacy
sudo snap connect auto-cpufreq:wayland
sudo snap connect auto-cpufreq:x11

sudo snap connections auto-cpufreq
Interface               Plug                                Slot                            Notes
content[gnome-42-2204]  auto-cpufreq:gnome-42-2204          gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   auto-cpufreq:gtk-3-themes           gtk-common-themes:gtk-3-themes  -
content[icon-themes]    auto-cpufreq:icon-themes            gtk-common-themes:icon-themes   -
content[sound-themes]   auto-cpufreq:sound-themes           gtk-common-themes:sound-themes  -
cpu-control             auto-cpufreq:cpu-control            :cpu-control                    manual
desktop                 auto-cpufreq:desktop                :desktop                        -
desktop-legacy          auto-cpufreq:desktop-legacy         :desktop-legacy                 -
gsettings               auto-cpufreq:gsettings              :gsettings                      -
hardware-observe        auto-cpufreq:hardware-observe       :hardware-observe               manual
opengl                  auto-cpufreq:opengl                 :opengl                         -
system-files            auto-cpufreq:etc-auto-cpufreq-conf  :system-files                   manual
system-observe          auto-cpufreq:system-observe         :system-observe                 manual
wayland                 auto-cpufreq:wayland                :wayland                        -
x11                     auto-cpufreq:x11                    :x11                            -

Along with proposed changes:

/sys/devices/**/power_supply/BAT[0-9]*/charge_start_threshold rw, 
/sys/devices/**/power_supply/BAT[0-9]*/charge_stop_threshold rw, 
/sys/devices/**/power_supply/BAT[0-9]*/type r,
/sys/devices/**/power_supply/BAT[0-9]*/status r,
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,
@{PROC}/@{pid}/cmdline r,

to all apparmor profile files:

/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.auto-cpufreq-gtk
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.hook.configure
/var/lib/snapd/apparmor/profiles/snap.auto-cpufreq.service
/var/lib/snapd/apparmor/profiles/snap-update-ns.auto-cpufreq

and after reloading the changes with apparmor_parser -r on each file, I'm happy to report that everything works as expected!

sudo auto-cpufreq --live                                                            

Note: You can quit live mode by pressing "ctrl+c"

----------------------------------- Warning -----------------------------------

Due to Snap package confinement limitations please consider installing auto-cpufreq using
auto-cpufreq-installer: https://github.com/AdnanHodzic/auto-cpufreq/#auto-cpufreq-installer

Unable to detect state of GNOME Power Profiles daemon service!
This daemon might interfere with auto-cpufreq and should be disabled.

Steps to perform this action using auto-cpufreq: power_helper script:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq/auto_cpufreq
python3 power_helper.py --gnome_power_disable

Reference: https://github.com/AdnanHodzic/auto-cpufreq#configuring-auto-cpufreq

----------------------------------- Warning -----------------------------------

Unable to detect if you are using a TLP service!
This daemon might interfere with auto-cpufreq which can lead to unexpected results.
We strongly encourage you not to use TLP unless you really know what you are doing.

-------------------------------------------------------------------------------

Linux distro: Ubuntu 24.04 LTS (Noble Numbat)
Linux kernel: 6.8.0-31-generic
Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 800 MHz
CPU min frequency: 400 MHz

Core	Usage	Temperature	Frequency
CPU0     41.8%        46 °C       800 MHz
CPU1     21.6%        47 °C       800 MHz
CPU2     24.5%        46 °C       800 MHz
CPU3     34.3%        48 °C       800 MHz
CPU4     13.0%        46 °C       800 MHz
CPU5     20.2%        47 °C       800 MHz
CPU6      9.2%        46 °C       800 MHz
CPU7     11.3%        48 °C       800 MHz

CPU fan speed: 0 RPM

---------------------------- CPU frequency scaling ----------------------------

Battery is: discharging

Setting to use: "powersave" governor
Setting to use: "balance_power" EPP
Setting maximum CPU frequency to 4600 Mhz

Total CPU usage: 22.6 %
Total system load: 2.84
Average temp. of all cores: 46.75 °C 

High CPU load (load average: 2.84, 3.24, 3.26)
setting turbo boost: on

-------------------------------------------------------------------------------

		"auto-cpufreq" is about to refresh ...

I've pushed the changes to power_control interface, please let me know if any additional changes are needed, otherwise I hope this PR is ready to be merged.

Copy link
Collaborator

@alexmurray alexmurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for the inclusion of /proc/pid/cmdline - this should be removed.

/sys/devices/**/power_supply/BAT[0-9]*/status r,
/sys/devices/**/power_supply/AC/type r,
/sys/devices/**/power_supply/AC/online r,
@{PROC}/@{pid}/cmdline r,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@{PROC}/@{pid}/cmdline r, is not really appropriate in the power-control interface - can this be removed and instead if this is really required, your snap should plug the system-observe interface which already provides access to this data.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line removed, changes pushed

Copy link
Collaborator

@alexmurray alexmurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AdnanHodzic - LGTM!

@alexmurray alexmurray removed the Needs security review Can only be merged once security gave a :+1: label May 14, 2024
@AdnanHodzic
Copy link
Contributor Author

Thanks @AdnanHodzic - LGTM!

@alexmurray I see merge is still blocked, is there anything else I can do to have it merged?

@alexmurray
Copy link
Collaborator

@AdnanHodzic I've just approved the GitHub actions to run, once they are complete then one of the snapd maintainers can choose to merge it (unfortunately I don't have that permission).

@AdnanHodzic
Copy link
Contributor Author

@AdnanHodzic I've just approved the GitHub actions to run, once they are complete then one of the snapd maintainers can choose to merge it (unfortunately I don't have that permission).

Thanks for the clarification, now that Github are complete I'll wait for one of snapd maintainers to merge it then.

@jslarraz
Copy link
Collaborator

jslarraz commented Jun 3, 2024

Just did a last pass on this. The rules added to the power-control interface look consistent with the expected behavior of this interface and appropriate according to the discussion hold here. The resulting changes LGTM

@ernestl ernestl merged commit 018c9cf into snapcore:master Jun 3, 2024
44 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants