Browse Source

dracut/autoinstaller: Fix device race conditions

Michael Aldridge 2 months ago
parent
commit
ca771eb661

+ 11 - 1
dracut/autoinstaller/install.sh

@@ -21,6 +21,13 @@ VAI_welcome() {
     printf "=============================================================\n"
 }
 
+VAI_udev_settle() {
+    /usr/bin/udevd --daemon
+    /usr/bin/udevadm trigger --action=add --type=subsystems
+    /usr/bin/udevadm trigger --action=add --type=devices
+    /usr/bin/udevadm settle
+}
+
 VAI_get_address() {
     mkdir -p /var/lib/dhclient
 
@@ -236,10 +243,13 @@ VAI_configure_autoinstall() {
 
 VAI_main() {
     CURRENT_STEP=0
-    STEP_COUNT=16
+    STEP_COUNT=17
 
     VAI_welcome
 
+    VAI_print_step "Wait on hardware"
+    VAI_udev_settle
+
     VAI_print_step "Bring up the network"
     VAI_get_address
 

+ 1 - 0
dracut/autoinstaller/module-setup.sh

@@ -40,5 +40,6 @@ install() {
     inst /etc/ssl/certs.pem
 
     inst_hook pre-mount 01 "$moddir/install.sh"
+    inst_hook cmdline 99 "$moddir/parse-vai-root.sh"
     inst "$moddir/autoinstall.cfg" /etc/autoinstall.default
 }

+ 4 - 0
dracut/autoinstaller/parse-vai-root.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+if [ "${root}" = "vai" ] ; then
+    rootok=1
+fi