udev: fix parent mapping and restore on detach#143
Draft
code-loyko wants to merge 2 commits into
Draft
Conversation
This is my first contribution to Qubes OS. I do not master all the components around these changes and am not confident in their potential impacts. I would appreciate a thorough review to verify their safety, and to check if this is indeed the correct approach. On my hardware, attaching a partition block device (ex: sdX1) broke its device ID mapping because the parent disk's keys (sdX) were deleted from QubesDB to hide it. Additionally, detaching the partition left the parent disk permanently hidden, and blocked subsequent reattachments with a "QubesDaemonAccessError" in dom0. This patch resolves these issues by: 1. Swapping the udev parent checks so USB partitions map directly to their physical USB port instead of the parent disk sdX. 2. Replacing the synchronous parent refresh with an asynchronous "udevadm trigger" to ensure it executes after unbinding finishes. I verified on my system that these changes successfully preserve the hardware mappings, restore automatic parent disk visibility on detach, and resolve the reattachment error. Fixes #10180 Fixes #9566
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
+ Coverage 71.09% 71.24% +0.14%
==========================================
Files 6 6
Lines 993 991 -2
==========================================
Hits 706 706
+ Misses 287 285 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Remove the redundant '--action=change' flag since udev trigger defaults to 'change', and remove the '/dev/null' redirect which was used during testing and committed by mistake.
code-loyko
marked this pull request as draft
July 13, 2026 08:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my first contribution to Qubes OS. I do not master all the components around these changes and am not confident in their potential impacts. I would appreciate a thorough review to verify their safety, and to check if this is indeed the correct approach.
On my hardware, attaching a partition block device (ex: sdX1) broke its device ID mapping because the parent disk's keys (sdX) were deleted from QubesDB to hide it. Additionally, detaching the partition left the parent disk permanently hidden, and blocked subsequent reattachments with a "QubesDaemonAccessError" in dom0.
This patch resolves these issues by:
I verified on my system that these changes successfully preserve the hardware mappings, restore automatic parent disk visibility on detach, and resolve the reattachment error.
Fixes QubesOS/qubes-issues#10828
Fixes QubesOS/qubes-issues#10180
Fixes QubesOS/qubes-issues#9566