[master 1/2] dracut: fix boot with inst.ks and no inst.{repo, stage2} (#1238987)

wgwoods installerbot-noreply at redhat.com
Tue Jul 7 16:09:23 UTC 2015


From: Will Woods <wwoods at redhat.com>

Okay so: commit 4883b96 moved fetch-kickstart-net.sh from the online
hook into initqueue (or initqueue/settled) to fix inst.ks.sendmac.

So when you boot with inst.ks=[URL], the order goes:

1. Network comes up
2. Run `online` hook
   * Schedule kickstart fetch in initqueue
   * Other online tasks from boot args (e.g. updates)
3. Run `initqueue`
   * fetch + run kickstart
     * add `anaconda-netroot.sh` (etc.) to `online` hook
     * `udevadm trigger` disk devices
     * `udevadm trigger` net devices

The problem is, triggering network devices is *not* sufficient to re-run
the `online` hook - this only happens when the NIC actually gets
_configured_, not when the device is triggered.

The fix is pretty straightforward: re-run the `online` hook for active
NICs after we run the kickstart, in order to pick up any new tasks that
the kickstart might have scheduled.

Resolves: RHBZ#1238987
---
 dracut/anaconda-lib.sh | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index c28a28e..0b1679c 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -213,6 +213,15 @@ parse_kickstart() {
     [ -e "$parsed_kickstart" ] && cp $parsed_kickstart /run/install/ks.cfg
 }
 
+# print a list of net devices that dracut says are set up.
+online_netdevs() {
+    local netif=""
+    for netif in /tmp/net.*.did-setup; do
+        netif=${netif#*.}; netif=${netif%.*}
+        [ -d "/sys/class/net/$netif" ] && echo $netif
+    done
+}
+
 # This is where we actually run the kickstart. Whee!
 # We can't just add udev rules (we'll miss devices that are already active),
 # and we can't just run the scripts manually (we'll miss devices that aren't
@@ -236,7 +245,7 @@ run_kickstart() {
     # re-parse new cmdline stuff from the kickstart
     . $hookdir/cmdline/*parse-anaconda-repo.sh
     . $hookdir/cmdline/*parse-livenet.sh
-    # TODO: parse for other stuff ks might set (dd? other stuff?)
+    . $hookdir/cmdline/*parse-anaconda-dd.sh
     case "$repotype" in
         http*|ftp|nfs*) do_net=1 ;;
         cdrom|hd|bd)    do_disk=1 ;;
@@ -266,14 +275,21 @@ run_kickstart() {
         rm /tmp/dd_args_ks
     fi
 
-    # replay udev events to trigger actions
+    # disk: replay udev events to trigger actions
     if [ "$do_disk" ]; then
+        # set up new rules
         . $hookdir/pre-trigger/*repo-genrules.sh
         udevadm control --reload
+        # trigger the rules for all the block devices we see
         udevadm trigger --action=change --subsystem-match=block
     fi
+
+    # net: re-run online hook
     if [ "$do_net" ]; then
         udevadm trigger --action=change --subsystem-match=net
+        for netif in $(online_netdevs); do
+            source_hook initqueue/online $netif
+        done
     fi
 
     # and that's it - we're back to the mainloop.


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/fcc80de3abf652d2a353a266ee5e31ae6b2169c9


More information about the anaconda-patches mailing list