Repository navigation
Conversation
fwerkor
force-pushed
the
fix/coldplug-devnodes
branch
from
October 9, 2026 05:01
3c56eb9 to
b79e42e
Compare
coldplug replaces /dev with an empty tmpfs and then relies on asynchronous uevents to recreate device nodes. Reuse the existing mkdev scanner so devices already present in sysfs are available synchronously before the state machine can advance. Because the normal hotplug mknod path may now encounter those nodes with EEXIST, explicitly apply the requested mode to existing nodes before applying any configured group. The regular udevtrigger/hotplug pass still remains authoritative for final permissions and handlers. Signed-off-by: Cao Yuhang <caoyuhang@fwerkor.com>
fwerkor
force-pushed
the
fix/coldplug-devnodes
branch
from
October 9, 2026 05:04
b79e42e to
9b4237a
Compare
fwerkor
marked this pull request as ready for review
October 9, 2026 05:30
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.
Summary
procd_coldplug()replaces/devwith a fresh tmpfs and then depends on asynchronousudevtrigger/hotplug processing to recreate device nodes. This leaves a window where devices already present in sysfs, including the active console tty, do not exist under/dev.In repeated downstream x86_64 QEMU reboot tests on an older procd baseline this reaches
STATE_UBUSbefore the console nodes are available, producing:and the expected
askconsoleshell never appears.Current procd already uses
patch_stdio()after 615e929, so a missing/dev/consolecan fall back to/dev/nullinstead of emitting that exact error. That protects procd's stdio but does not recreate the tty named byconsole=, so the underlying coldplug race foraskconsoleremains.Change
Reuse the existing
mkdev("*")sysfs scanner immediately after remounting/dev, before launchingudevtrigger. Devices that already exist in sysfs are therefore available synchronously.Those precreated nodes initially use the scanner's restrictive mode. The normal hotplug pass remains authoritative:
handle_makedev()now applies the requested mode whenmknod()succeeds or returnsEEXIST, then applies the configured group as before. This preserves the existing modes/groups for nodes such as tty, zero, random and urandom.This follows the same underlying rationale as 6dafa86 (
initd/coldplug: create /dev/null before running udevtrigger), while avoiding more per-device special cases.