You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users have reported a 2.5-minute delay when setting the threshold using pkexec.
Troubleshooting indicates this issue occurs on Ubuntu (Wayland) and Debian (Wayland) systems running polkit version 124 or greater.
When the extension runs the pkexec command to set the threshold, the execution takes 2.5 minutes.
This causes the extension to either start after a 2.5-minute delay or take the same time to apply the threshold. (Newer extension versions will display a timeout message after 5 seconds.)
I have created a script to use sudo instead of pkexec command as a workaround for this issue.
Systems Affected by the Delay in pkexec Execution
** Known Affected Systems:**
Ubuntu-based systems with polkit >= 124 running Wayland.
Debian-based systems with polkit >= 124 running Wayland.
Known Non-Affected Systems:
Ubuntu-based systems with polkit >= 124 running Xorg.
Debian-based systems with polkit >= 124 running Xorg.
Fedora systems (both Wayland and Xorg).
Workaround: Use sudo Instead of pkexec
To resolve this issue, replace pkexec with sudo for commands setting the threshold. This requires creating an exemption to allow batteryhealthchargingctl to run with sudo without requiring a password. This can be done manually or using the provided bash script.
Some systems, like Debian, do not add users to the sudo group by default. If prompted, use su instead of sudo to update the configuration.
Steps
Run the script using:
bash bhc_patch.sh
If running the script for the first time, use Option A to perform all operations.
Options Available
Option 1: Install Polkit rules and batteryhealthchargingctl (if not already installed).
Option 2: Modify the sudo configuration to allow batteryhealthchargingctl to run without a password. This creates the sudo configuration file /etc/sudoers.d/batteryhealthcharging-{username}.
Option 3: Patch the Battery Health Charging extension by replacing pkexec with sudo in driver.js and helper.js.
Option A: Perform all the above operations.
Option 4: Remove the sudo configuration, deleting the /etc/sudoers.d/batteryhealthcharging-{username} file.
Workaround: Do it yourself
If you do no want to run the script, you can edit files yourself.
Important Notes
Replace {USERNAME} with your actual username in all the following steps below. example instead of
If unsure of your username, run the command whoami in the terminal.
1. Edit Sudoer Configuration
Rather than modifying /etc/sudoers directly, create a file in the /etc/sudoers.d/ directory to leave the original file untouched for easier upgrades.
Kindly test the script that changes the extension to use sudo and install configuration for sudo to run batteryhealthchargingctl without password.
Let me know how it goes.
Bug with Polkit on Ubuntu/Debian running Wayland
pkexec
.pkexec
command to set the threshold, the execution takes 2.5 minutes.Systems Affected by the Delay in pkexec Execution
** Known Affected Systems:**
polkit >= 124
running Wayland.polkit >= 124
running Wayland.Known Non-Affected Systems:
polkit >= 124
running Xorg.polkit >= 124
running Xorg.Workaround: Use sudo Instead of pkexec
To resolve this issue, replace
pkexec
withsudo
for commands setting the threshold. This requires creating an exemption to allowbatteryhealthchargingctl
to run withsudo
without requiring a password. This can be done manually or using the provided bash script.Workaround Using the Script
Download script
bhc_patch.zip
Note
Some systems, like Debian, do not add users to the
sudo
group by default. If prompted, usesu
instead ofsudo
to update the configuration.Steps
Run the script using:
If running the script for the first time, use Option A to perform all operations.
Options Available
batteryhealthchargingctl
(if not already installed).batteryhealthchargingctl
to run without a password. This creates the sudo configuration file/etc/sudoers.d/batteryhealthcharging-{username}
.pkexec
withsudo
indriver.js
andhelper.js
./etc/sudoers.d/batteryhealthcharging-{username}
file.Workaround: Do it yourself
If you do no want to run the script, you can edit files yourself.
Important Notes
{USERNAME}
with your actual username in all the following steps below. example instead ofwhoami
in the terminal.1. Edit Sudoer Configuration
Rather than modifying
/etc/sudoers
directly, create a file in the/etc/sudoers.d/
directory to leave the original file untouched for easier upgrades.Replace
{USERNAME}
with your username.This will allow
batteryhealthchargingctl
to execute withsudo
without requiring a password.2. Edit the Battery Health Charging Extension
Replace
pkexec
withsudo
in the following files:~/.local/share/gnome-shell/extensions/[email protected]/lib/driver.js
~ /home/abc123/.local/share/gnome-shell/extensions/[email protected]/lib/helper.js
Example: Modifying driver.js
Change this line:
To:
The text was updated successfully, but these errors were encountered: