[PATCH 1/2] dracut: fix crash with PXE ipappend and ks=file:..
Will Woods
wwoods at redhat.com
Mon Jul 30 22:30:48 UTC 2012
If you're using pxelinux with 'ipappend 2', it will add a "BOOTIF=..."
argument to your boot args.
parse-kickstart will rewrite your first 'network' line to a "ip=..."
argument for dracut.
But dracut refuses to allow "ip=..." and "BOOTIF=..." arguments to mix,
so this makes it die with the message:
FATAL: Mixing BOOTIF and ip= lines is dangerous
So: parse-kickstart should check the boot arguments, and not bother
generating an "ip=..." line if "BOOTIF" is already there.
---
dracut/parse-kickstart | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 3b6b861..d81dc72 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -23,6 +23,23 @@ from collections import OrderedDict
# Default logging: none
log = logging.getLogger('parse-kickstart').addHandler(logging.NullHandler())
+# So we can examine commandline args
+def readfile(f):
+ try:
+ val = open(f).readline().strip()
+ except IOError:
+ val = None
+ return val
+
+def read_cmdline(f):
+ args = OrderedDict()
+ for arg in readfile(f).split():
+ k,e,v = arg.partition("=")
+ args[k] = v
+ return args
+
+proc_cmdline = read_cmdline("/proc/cmdline")
+
# Here are the kickstart commands we care about:
class Method(commands.method.F14_Method):
@@ -79,7 +96,7 @@ class Network(commands.network.F16_Network):
# write ifcfg for all listed devices
ksnet_to_ifcfg(net)
# anaconda tradition: bring up the first device listed, and no others
- if len(self.network) == 1:
+ if len(self.network) == 1 and "BOOTIF" not in proc_cmdline:
netline = ksnet_to_dracut(args, lineno, net, bootdev=True)
return netline
@@ -215,13 +232,6 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
return " ".join(line)
-def readfile(f):
- try:
- val = open(f).readline().strip()
- except IOError:
- val = None
- return val
-
def ksnet_to_ifcfg(net, filename=None):
'''Write an ifcfg file for the given kickstart network config'''
dev = net.device
--
1.7.11.2
More information about the anaconda-patches
mailing list