Skip to content

fix: drop fixed unit name from power-profile udev rule to prevent wakeup failures#6091

Open
DiegoMirner wants to merge 1 commit into
basecamp:masterfrom
DiegoMirner:fix-power-profile-udev-unit-collision
Open

fix: drop fixed unit name from power-profile udev rule to prevent wakeup failures#6091
DiegoMirner wants to merge 1 commit into
basecamp:masterfrom
DiegoMirner:fix-power-profile-udev-unit-collision

Conversation

@DiegoMirner

Copy link
Copy Markdown

Problem

On laptops with USB-C only charging (e.g. ASUS Zenbook with Intel Meteor Lake), multiple power_supply udev events fire simultaneously on resume from sleep. Each event calls:

systemd-run --no-block --collect --unit=omarchy-power-profile ...

Because all events try to create a transient unit with the same fixed name, the second (and any subsequent) invocation fails with:

Failed to start transient service unit: Unit omarchy-power-profile.service was already loaded or has a fragment file.
exit: 1

This shows up in the journal on every wakeup as:

(udev-worker): ucsi-source-psy-USBC000:002: Process '/usr/bin/systemd-run ... --unit=omarchy-power-profile ...' failed with exit code 1.

Fix

Remove the --unit=omarchy-power-profile argument so each event gets a unique auto-generated transient unit name. powerprofilesctl set is idempotent, so concurrent runs are harmless — the last one to execute simply wins.

Test

Verified by triggering two rapid back-to-back systemd-run calls with the same unit name (reproduces the error), then without the fixed name (both succeed with exit 0). Also confirmed via sudo udevadm trigger --subsystem-match=power_supply --attr-match=type=USB that no failures appear in the journal after the fix.

🤖 Generated with Claude Code

…eup failures

When multiple USB-C power supply udev events fire rapidly on resume,
systemd-run fails with exit code 1 because the named unit
omarchy-power-profile already exists. Removing the fixed --unit= lets
each event get a unique transient unit name, avoiding the collision.
powerprofilesctl set is idempotent so concurrent runs are harmless.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 06:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the udev rules used to trigger omarchy-powerprofiles-set on power supply changes by altering the systemd-run invocation.

Changes:

  • Removes the explicit --unit=omarchy-power-profile from the systemd-run calls in the generated udev rules.
  • Keeps the After=power-profiles-daemon.service ordering property and existing triggers for Mains and USB.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
Comment on lines +3 to +4
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants