Skip to contentSkip to conversation

common/rc: add default _udev_wait timeout

PATCH Superseded David Disseldorp 2 participants 6 messages Mar 19 – Mar 23

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/rc: add default _udev_wait timeout

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index fd4ca964..aade0e5b 100644
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args
 	fi
 }
 
Signature · 1 line
2.51.0
#1 lore raw
Quoted 3 lines · David Disseldorp

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

If you don't have udevd running, then perhaps we should detect that and directly call "sleep 10"? Because otherwise...

Quoted 16 lines

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index fd4ca964..aade0e5b 100644

common/rc _udev_wait() · line 5547

Quoted 5 lines
common/rc +1 -1
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args

...a system running udevd that's taking forever to process rules can hit this 10 second timeout, at which point the test moves on and might just fail due to unconfigured /dev nodes.

/methinks this could be done like so:

	if [ ! -S /run/udev/control ]; then
		sleep 10
	elif [ -z "$UDEV_WAIT_PROG" ]; then
		...

I don't know if your test setup has prepopulated /dev or if you've a script that sets up devices, or something else. 10 seconds is just a copy-paste.

--D

Quoted 7 lines
common/rc +0 -0
 	fi
 }
 
Signature · 1 line
2.51.0
#2 lore raw
Quoted 7 lines · Darrick J. Wong
Quoted 3 lines · David Disseldorp

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

If you don't have udevd running, then perhaps we should detect that and directly call "sleep 10"? Because otherwise...

I normally have udevd running, but sometimes mess it up. My latest screw up came from ommitting a "/run" dir in the initramfs test env, which causes systemd-udevd to die on "/run/udev" creation. The error message is hard to spot amoungst the other boot messages...

Quoted 11 lines
Quoted 11 lines

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

common/rc _udev_wait() · line 5547

Quoted 10 lines
common/rc +1 -1
index fd4ca964..aade0e5b 100644
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args  

...a system running udevd that's taking forever to process rules can hit this 10 second timeout, at which point the test moves on and might just fail due to unconfigured /dev nodes.

The 10 seconds is arbitrary. If there's a concern that the timeout will prematurely fire on a regular systems then I'll gladly raise it up to a minute or so. I just want to get an explicit failure instead of a never-ending test.

Quoted 3 lines

/methinks this could be done like so:

if [ ! -S /run/udev/control ]; then

...

That's a good idea as a udevd sanity check. I'll add it to my test env.

Thanks, David

#3 lore raw
Quoted 7 lines · David Disseldorp
Quoted 5 lines · Darrick J. Wong
Quoted 3 lines · David Disseldorp

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

Quoted 7 lines
Quoted 2 lines

If you don't have udevd running, then perhaps we should detect that and directly call "sleep 10"? Because otherwise...

I normally have udevd running, but sometimes mess it up. My latest screw up came from ommitting a "/run" dir in the initramfs test env, which causes systemd-udevd to die on "/run/udev" creation. The error message is hard to spot amoungst the other boot messages...

Oh, ok. For some reason I thought you were trying to run fstests without udev. What if instead ./check looked for udevd and refused to proceed if it isn't running? AFAIK even the anti-systemd distros ship eudev.

Quoted 26 lines
Quoted 11 lines
Quoted 11 lines

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

common/rc _udev_wait() · line 5547

Quoted 10 lines
common/rc +1 -1
index fd4ca964..aade0e5b 100644
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args  

...a system running udevd that's taking forever to process rules can hit this 10 second timeout, at which point the test moves on and might just fail due to unconfigured /dev nodes.

Quoted 4 lines

The 10 seconds is arbitrary. If there's a concern that the timeout will prematurely fire on a regular systems then I'll gladly raise it up to a minute or so. I just want to get an explicit failure instead of a never-ending test.

<nod>

--D

Quoted 9 lines
Quoted 3 lines

/methinks this could be done like so:

if [ ! -S /run/udev/control ]; then

...

That's a good idea as a udevd sanity check. I'll add it to my test env.

Thanks, David

#4 lore raw

On Fri, 20 Mar 2026 07:44:13 -0700, Darrick J. Wong wrote:
...

Quoted 9 lines
Quoted 4 lines

I normally have udevd running, but sometimes mess it up. My latest screw up came from ommitting a "/run" dir in the initramfs test env, which causes systemd-udevd to die on "/run/udev" creation. The error message is hard to spot amoungst the other boot messages...

Oh, ok. For some reason I thought you were trying to run fstests without udev. What if instead ./check looked for udevd and refused to proceed if it isn't running? AFAIK even the anti-systemd distros ship eudev.

I've added the extra udevd sanity check to my test env, so I shouldn't need anything in check. I'd expect NFS, SMB, CephFS, etc. may still want to run without udevd.

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index fd4ca964..aade0e5b 100644

common/rc _udev_wait() · line 5547

Quoted 5 lines
common/rc +1 -1
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args    

...a system running udevd that's taking forever to process rules can hit this 10 second timeout, at which point the test moves on and might just fail due to unconfigured /dev nodes.

Quoted 6 lines
Quoted 4 lines

The 10 seconds is arbitrary. If there's a concern that the timeout will prematurely fire on a regular systems then I'll gladly raise it up to a minute or so. I just want to get an explicit failure instead of a never-ending test.

<nod>

I'd still like to see a timeout added, as a failed test (with timeout msg) is IMO a far better outcome than an endless wait. Any objections if I send a v2 patch with 60s timeout?

Thanks, David

#5 lore raw
Quoted 7 lines · David Disseldorp

On Fri, 20 Mar 2026 07:44:13 -0700, Darrick J. Wong wrote:
...

Quoted 5 lines
Quoted 4 lines

I normally have udevd running, but sometimes mess it up. My latest screw up came from ommitting a "/run" dir in the initramfs test env, which causes systemd-udevd to die on "/run/udev" creation. The error message is hard to spot amoungst the other boot messages...

Quoted 8 lines
Quoted 4 lines

Oh, ok. For some reason I thought you were trying to run fstests without udev. What if instead ./check looked for udevd and refused to proceed if it isn't running? AFAIK even the anti-systemd distros ship eudev.

I've added the extra udevd sanity check to my test env, so I shouldn't need anything in check. I'd expect NFS, SMB, CephFS, etc. may still want to run without udevd.

<nod>

Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
Quoted 11 lines
Quoted 11 lines

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers.

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

common/rc _udev_wait() · line 5547

Quoted 10 lines
common/rc +1 -1
index fd4ca964..aade0e5b 100644
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 10 $args    

...a system running udevd that's taking forever to process rules can hit this 10 second timeout, at which point the test moves on and might just fail due to unconfigured /dev nodes.

The 10 seconds is arbitrary. If there's a concern that the timeout will prematurely fire on a regular systems then I'll gladly raise it up to a minute or so. I just want to get an explicit failure instead of a never-ending test.

Quoted 5 lines
Quoted 1 line

<nod>

I'd still like to see a timeout added, as a failed test (with timeout msg) is IMO a far better outcome than an endless wait. Any objections if I send a v2 patch with 60s timeout?

Nope, 60 seconds should be enough for anyone. ;)

--D