[rhel7-branch 5/9] dracut: fix boot with inst.ks and no inst.{repo,stage2} (#1238987)

wgwoods installerbot-noreply at redhat.com
Thu Jul 9 14:59:54 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
Reverts: a66cb157dcfeb418b02555cc8baa9ee8910184b5
---
 dracut/anaconda-lib.sh        | 20 ++++++++++++++++++--
 dracut/fetch-kickstart-net.sh |  1 -
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 9bd13dd..f084ff6 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -183,6 +183,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
@@ -206,7 +215,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 ;;
@@ -236,17 +245,24 @@ 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
         # make dracut create the net udev rules (based on the new cmdline)
         . $hookdir/pre-udev/*-net-genrules.sh
         udevadm control --reload
         udevadm trigger --action=add --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.
diff --git a/dracut/fetch-kickstart-net.sh b/dracut/fetch-kickstart-net.sh
index 2051e6d..f26ab25 100755
--- a/dracut/fetch-kickstart-net.sh
+++ b/dracut/fetch-kickstart-net.sh
@@ -55,7 +55,6 @@ info "anaconda fetching kickstart from $kickstart"
 if fetch_url "$kickstart" /tmp/ks.cfg; then
     parse_kickstart /tmp/ks.cfg
     run_kickstart
-    $hookdir/initqueue/online/*anaconda-netroot.sh
 else
     warn "failed to fetch kickstart from $kickstart"
 fi


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


More information about the anaconda-patches mailing list