File: increase-udev-timeout.patch

package info (click to toggle)
virtme-ng 1.38-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 612 kB
  • sloc: python: 4,422; sh: 493; makefile: 32
file content (66 lines) | stat: -rw-r--r-- 2,864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From ffa730675f2befb9e8695f467df3061b1ab6faa0 Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda <ribalda@chromium.org>
Date: Mon, 13 Oct 2025 12:19:19 +0000
Subject: [PATCH] virtme-init: Increase timeout for udevadm settle

By default, udevadm has a 2 minutes timeout:
https://github.com/systemd/systemd/blob/main/src/udev/udevadm-settle.c#L27

This is more than enough for a normal system, but when running inside a
virtual machine without kvm this timeout might not be enough.

Media-ci has seen a spike of this errors:
[  174.273649] virtme-init: waiting for udev to settle
Failed to wait for daemon to reply: Connection timed out
[  296.460652] virtme-init: udev is done
[  300.023643] ip (123) used greatest stack depth: 11808 bytes left
touch: cannot touch '/etc/sudoers': Read-only file system
touch: cannot touch '/etc/sudoers': Read-only file system
mount: /etc/sudoers: mount point does not exist.
       dmesg(1) may have more information after failed mount system call.
virtme-init: cannot find script I/O ports; make sure virtio-serial is available
https://gitlab.freedesktop.org/linux-media/users/ci/-/jobs/85882743

When it works, it requires around 100+ seconds to settle:
[  124.949429] virtme-init: waiting for udev to settle
[  227.774217] udevadm (136) used greatest stack depth: 11680 bytes left
[  227.787152] virtme-init: udev is done

In theory we could even have --timeout=infinity, but that could break
other use-cases.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.com>
Applied-Upstream: commit:ffa730675f2befb9e8695f467df3061b1ab6faa0
---
 virtme/guest/virtme-init   | 2 +-
 virtme_ng_init/src/main.rs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init
index 19bf223..4d12ad0 100755
--- a/virtme/guest/virtme-init
+++ b/virtme/guest/virtme-init
@@ -222,7 +222,7 @@ if [[ -n $udevd ]]; then
     udevadm trigger --type=subsystems --action=add > /dev/null 2>&1
     udevadm trigger --type=devices --action=add > /dev/null 2>&1
     log "waiting for udev to settle"
-    udevadm settle
+    udevadm settle --timeout=300
     log "udev is done"
 else
     log "udevd not found"
diff --git a/virtme_ng_init/src/main.rs b/virtme_ng_init/src/main.rs
index 6dcab34..192127f 100644
--- a/virtme_ng_init/src/main.rs
+++ b/virtme_ng_init/src/main.rs
@@ -592,7 +592,7 @@ fn run_udevd() -> Option<thread::JoinHandle<()>> {
             utils::run_cmd("udevadm", &["trigger", "--type=subsystems", "--action=add"]);
             utils::run_cmd("udevadm", &["trigger", "--type=devices", "--action=add"]);
             log!("waiting for udev to settle");
-            utils::run_cmd("udevadm", &["settle"]);
+            utils::run_cmd("udevadm", &["settle", "--timeout=300"]);
             log!("udev is done");
         });
         Some(handle)
-- 
2.51.0.760.g7b8bcc2412-goog