To make the review of your request easier, please use the following template to provide all the required details and also include any other information that may be relevant.
name: MyASUS-for-Linux
description: MyASUS for Linux is the official ASUS companion app for ASUS
laptops (Avalonia/.NET UI). It allow users to access essential features such as battery care and fan control in one convenient application, designed to enhance users’ everyday computing experience.
The UI runs unprivileged. A small root daemon (batteryperf-daemon, `daemon: simple`) performs the hardware writes, and a reapply helper (batteryperf-reapply, autostart) restores the user’s saved settings at login. Both ship in the same snap.
snapcraft: PRIVATE (internal ASUS repository)
upstream: PRIVATE
upstream-relation: Developer and Publisher
supported-category: Does not fall into any category. This is a request for an exception (hardware/firmware settings utility for ASUS laptops).
reasoning: On the arm64 device (NVIDIA N1x), batteryperf-daemon controls the hardware exclusively through /dev/hidraw*. The AppArmor logs below were collected in devmode while exercising every feature (battery charge limit, performance mode, boot-time start and login-time reapply):
2 /dev/hidraw0 wr
2 /sys/devices/virtual/dmi/id/board_name r --– to read SMBIOS info for dedicated memory function support
2 /sys/firmware/efi/efivars/MyASUSStaticField-607005d5-3f75-4b2e-98f0-85ba66797a3e r —–to read MASF variable/NVIDIA variable for dedicated memory function support
There is no /sys/class/power_supply/BAT*/charge_control_end_threshold on this device, so the battery charge limit is set through hidraw, but it would be in our future x64 version.
There is no /sys/firmware/acpi/platform_profile on this device, so the performance mode setting is set through hidraw, but it would be in our future x64 version.
Why strict confinement is not sufficient:
1. /dev/hidraw* (wr) is the blocker. The kernel assigns the hidraw node number dynamically, so a fixed `system-files` entry is not reliable. The `hidraw` interface only connects to slots provided by a gadget snap, which a regular desktop or laptop does not have, so the plug cannot be connected.
2. The other two accesses could be covered by `hardware-observe` (DMI board_name) and `system-files` (one fixed efivar, read-only). We would be glad to use these. Without access to hidraw the snap cannot perform any hardware control, so these alone do not make strict workable.
3. The daemon must run as root and start at boot so settings can be applied before the user opens the UI. The UI never uses sudo and talks to the daemon over a local socket. The reapply helper uses autostart to ask the daemon to restore the saved settings at login.
To clarify further why strict confinement with standard interfaces is not viable for MyASUS-for-Linux at this stage:
Hardware Control Requirement (hidraw): On certain supported devices (such as the arm64 NVIDIA N1x platform mentioned in the request), key features like battery charge limits and performance modes do not expose standard ACPI platform profiles or standard power supply sysfs nodes (/sys/class/power_supply/BAT*/charge_control_end_threshold). They are controlled exclusively through /dev/hidraw*.
Limitations of Standard Alternatives: While we are fully willing to adopt standard interfaces where available (such as hardware-observe for DMI and read-only system-files for specific efivars), these alone cannot replace hidraw functionality. Without hidraw access, the daemon cannot perform any core hardware management on these devices, rendering strict confinement unusable for our users.
Dynamic Node Allocation: Because the kernel assigns hidraw node numbers dynamically, static paths via system-files are unreliable. Without a native plug-and-slot connection (which standard desktop/laptop gadget snaps currently lack for hidraw), classic confinement remains the necessary path to ensure reliable hardware communication.
We completely understand that strict confinement is preferred for general applications. However, given that this utility acts as an essential hardware bridge for ASUS laptops, we kindly request an exception via classic confinement so that users on these supported platforms can safely manage their device hardware.
Thank you for your time and guidance in reviewing this request.
If /dev/hidraw* (wr) is the blocker, I think it might be possible for you to use the custom-device interface as a workaround. Your snap would need to declare a custom-device slot declaring the devices you need to access and a custom-device plugs connecting to this slot (thanks @shishirsub10 for the suggestion). Would you be able to check whether this approach actually works as expected?
@pedronis whilst this is not the intended use of custom-device I believe you have approved its use this way to avoid the need for classic confinement. Are you ok with this if it works fine?
Thanks for the custom-device suggestion – we tested it on two real machines under strict confinement (one Qualcomm ARM64, one NVIDIA ARM64).
Good news: it does solve the original problem. With a broad device glob (/dev/hidraw[0-9]*) declared as both plug and slot in our own snap, the target device node becomes visible inside the strict sandbox on both machines – the “hidraw only connects to a gadget snap slot” limitation is no longer in the way.
But there’s a second blocker we ran into: actually opening the device still fails with “Operation not permitted” on both machines. The device node is root:root mode 0600. Our daemon runs as uid 0 inside the snap, but the kernel audit log shows AppArmor denying the capabilities needed to bypass that file permission check even for uid 0:
So: custom-device makes the device visible, but strict confinement still blocks the actual open() via this capability check. Same result on both machines, different IHVs, different Ubuntu versions – doesn’t look like a one-off.
Is there a way, through custom-device or something else, to also get past this specific check (e.g. can udev-tagging adjust the device’s permissions, or is this capability only restorable via a different interface)? Full logs from both machines available if useful.
Thanks again – this got us further than before, just not all the way.
The device node is root:root mode 0600. Our daemon runs as uid 0 inside the snap, but the kernel audit log shows AppArmor denying the capabilities needed to bypass that file permission check even for uid 0:
This sounds certainly unexpected to me. I would possibly expect this to happen when the root daemon tries to open some file owned by a different user, such us the regular unprivileged user. But in this case, root opening a root owned file should not require of any of these capabilities. If you can share the logs with us, it would be really helpful to understand what is happening .
Edit: I just saw you already shared the logs in your last message. Let me take a look
In the logs that you have sent, $ snap run --shell battery-perf-poc.batteryperf-daemon -c ‘dd if=/dev/hidraw2 of=/dev/null bs=1 count=0' is run as a regular user not the root user.
Good catch – the earlier log dropped the sudo prefix. The actual command was run as root.
To put it beyond doubt, we ran the same command both with and without sudo and compared: id, the dd error message, and whether the kernel audit log even generates a capable/dac_override entry. Results in the attached log – happy to answer questions if useful.
Thanks for the help – the hidraw access issue is resolved on our end now, confirmed on two machines.
That said, this was only one of two blockers we had for strict confinement. The other is unrelated to custom-device: system-files’ own documented Store-review policy says it shouldn’t be used for /sys paths we’re not the “clear owner” of, and our battery/performance code writes shared kernel sysfs paths (power_supply, platform_profile) that fall into that category. We haven’t found a workaround for that one yet, so we’re still weighing strict vs. classic overall.
You might be right about existing interfaces not being sufficient for this use case. But we could still make this work by making some changes to avoid classic.
/sys/devices/virtual/dmi/id/board_name: Can be added to hardware-observe interface, similar PR in the past that adds /sys/devices/virtual/dmi/id/{product_name,sys_vendor}
/sys/firmware/efi/efivars/MyASUSStaticField-607005d5-3f75-4b2e-98f0-85ba66797a3e: Since UUID changes for different devices and this is a read access, I am okay with more relaxed read access on the parent directory using system-files, i.e. /sys/firmware/efi/efivars/*. What do you think @jslarraz ?
If you still want to pursue classic, we would need an approval from the architects (@pedronis@jnsgruk ) since this application does not fit on any of the supported category.
Thanks – those two paths (board_name, MyASUSStaticField) are for our IHV detection, and we already have those working today via system-files as literal paths, so no urgency there.
The bigger open problems for us are still unaddressed:
Reading total system memory needs to scan /sys/firmware/dmi/entries/ to find the DMI Type 17 entry – that directory listing itself gets denied under strict, and we haven’t found an interface that grants it.
Our battery/perf code writes shared kernel sysfs paths (power_supply, platform_profile) that system-files’ own policy says we shouldn’t use it for, since we’re not the “clear owner.”
The battery sysfs path is a symlink that resolves to a machine-specific string, so the working declaration isn’t portable across models.
These three are what’s actually blocking us on strict right now.